-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
alpha-mon4.lst
3484 lines (3482 loc) · 184 KB
/
alpha-mon4.lst
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
0000 .ENGINE alpha
0000 .ORG 0
0000 ; inicializace()
0000 F3 RESET: DI
0001 31 00 FF LXI SP,STACK
0004 C3 B5 00 JMP COLD
0007 41 DB "A" ; padding na osm byte
0008 RST1: ;mělo by být na adrese 0008
0008 C3 8A 00 JMP SEROUT
0010 .ORG 10h
0010 RST2: ;SERIN
0010 C3 A4 00 JMP SERIN
0018 .ORG 18h
0018 RST3: ;SYS CALL
0018 E3 XTHL
0019 4E MOV C,M
001A 23 INX H
001B E3 XTHL
001C C3 28 00 JMP SYSCALL
0020 .ORG 20h
0020 RST4: ;breakpoint
0020 F5 PUSH PSW
0021 22 01 FF SHLD BRKHL
0024 E3 XTHL
0025 C3 4B 00 JMP BRKPT
0028 SYSCALL:
0028 E5 PUSH h
0029 D5 PUSH d
002A 21 36 00 LXI h,SYSTAB
002D 59 MOV e,c
002E 16 00 MVI d,0
0030 19 DAD d
0031 19 DAD d
0032 19 DAD d
0033 D1 POP d
0034 E3 XTHL
0035 C9 RET
0036 SYSTAB:
0036 C3 00 00 JMP RESET
0039 C3 B9 00 JMP WARM
003C C3 AD 00 JMP SERST
003F C3 A4 00 JMP SERIN
0042 C3 8A 00 JMP SEROUT
0045 C3 96 00 JMP STROUT
0048 C3 7F 03 JMP PRINTADDR
004B BRKPT:
004B 22 07 FF SHLD BRKPSW
004E F1 POP PSW
004F 21 00 00 LXI h,0
0052 39 DAD sp
0053 22 05 FF SHLD brksp
0056 E1 POP H
0057 2B DCX h ;back 1 byte...
0058 22 03 FF SHLD BRKPC
005B 3A 00 FF LDA BRKBYTE
005E 77 MOV M,A ;restore original content
005F D5 PUSH d
0060 E1 POP h
0061 22 0B FF SHLD brkdE
0064 C5 PUSH b
0065 E1 POP h
0066 22 09 FF SHLD brkbC
0069 21 7E 00 LXI h,brkstr
006C CD 96 00 CALL strout
006F 2A 03 FF LHLD brkpc
0072 CD 7F 03 CALL printaddr
0075 3E 0D MVI a,0Dh
0077 CF RST 1
0078 3E 0A MVI a,0ah
007A CF RST 1
007B ;all registers saved
007B C3 BF 00 JMP main
007E 0D 0A BRKSTR: DB 0Dh,0Ah
0080 2A 42 52 45 41 4B 20 61 74 A0 .ISTR "*BREAK at "
008A ;--- Servisní rutiny
008A ;--- ======== ACIA
008A ; adresace sériového rozhraní
008A ACIA: EQU 0DEh
008A ACIAC: EQU ACIA
008A ACIAS: EQU ACIA
008A ACIAD: EQU ACIA+1
008A ACIA_TDRE: EQU 02h
008A ACIA_RDRF: EQU 01h
008A ;@SEROUT
008A ;Send character to ACIA
008A ;>A Character to send on serial port
008A ;--------------------------------
008A SEROUT:
008A F5 PUSH PSW
008B SO_WAIT:
008B DB DE IN ACIAS
008D E6 02 ANI ACIA_TDRE ;bit TDRE - pokud lze vysílat, je =1
008F CA 8B 00 JZ SO_WAIT
0092 F1 POP PSW
0093 D3 DF OUT ACIAD
0095 C9 RET
0096 ;@STROUT
0096 ;Send string to ACIA
0096 ;String is ended by char +80h
0096 ;>HL Address of string
0096 ;<HL Address of the last character
0096 ;*A,PSW
0096 ;--------------------------------
0096 STROUT:
0096 7E MOV A,M
0097 E6 7F ANI 7Fh
0099 CD 8A 00 CALL SEROUT
009C 7E MOV A,M
009D E6 80 ANI 80h
009F C0 RNZ
00A0 23 INX H
00A1 C3 96 00 JMP STROUT
00A4 ;@SERIN
00A4 ;Reads a character from serial port
00A4 ;If none is ready, returns A=0, Z=1
00A4 ;<A Character read, 0 if none received
00A4 ;<Z 1 = no character, 0 = character
00A4 ;-----------------------
00A4 SERIN:
00A4 DB DE IN ACIAS
00A6 E6 01 ANI ACIA_RDRF
00A8 C8 RZ
00A9 DB DF IN ACIAD
00AB B7 ORA A
00AC C9 RET
00AD ;@SERST
00AD ;Reads a serial port receiver status
00AD ;If none is received, returns A=0, Z=1
00AD ;Otherwise Z=0, A=FFh
00AD ;<A Status, 0 if none received, FF if character is ready
00AD ;<Z 1 = no character, 0 = character
00AD ;-----------------------
00AD SERST:
00AD DB DE IN ACIAS
00AF E6 01 ANI ACIA_RDRF
00B1 C8 RZ
00B2 3E FF MVI a,0FFh
00B4 C9 RET
00B5 ;--- ======= ACIA konec
00B5 ; Inicializace
00B5 COLD:
00B5 ;inicializace ACIA
00B5 3E 15 MVI A,15h ; 115200 Bd, 8 bit, no parity, 1 stop bit, no IRQ
00B7 D3 DE OUT ACIAC
00B9 ;Uvítací zpráva
00B9 WARM:
00B9 21 A4 03 LXI H,HELLO
00BC WARMPRINT:
00BC CD 96 00 CALL STROUT
00BF MAIN:
00BF 3E 3E MVI a,">"
00C1 CF RST 1
00C2 MAINLOOP:
00C2 CD A4 00 CALL SERIN
00C5 CA C2 00 JZ MAINLOOP
00C8 FE 3A CPI ":"
00CA CA 4C 02 JZ CHEXIN ; příkaz : - načtení HEX formátu
00CD FE 0D CPI 0Dh
00CF CA C2 00 JZ MAINLOOP
00D2 FE 0A CPI 0AH
00D4 CA C2 00 JZ MAINLOOP
00D7 FE 61 CPI "a"
00D9 DA DE 00 JC uppercase
00DC DE 20 SBI 20h
00DE UPPERCASE:
00DE FE 4D CPI "M"
00E0 CA D4 01 JZ CMEM ; příkaz M - změna paměti
00E3 FE 47 CPI "G"
00E5 CA F9 01 JZ CGO ; příkaz G - skok na zadanou adresu
00E8 FE 44 CPI "D"
00EA CA FD 01 JZ CDUMP ; příkaz D - výpis paměti
00ED ; CPI "B"
00ED ; JZ CBASIC ; příkaz D - výpis paměti
00ED FE 52 CPI "R"
00EF CA 17 01 JZ CREGS ; příkaz R - výpis registrů
00F2 FE 58 CPI "X"
00F4 CA 9E 01 JZ CBRK ; příkaz X - set breakpoint
00F7 FE 43 CPI "C"
00F9 CA BD 01 JZ CCONT ; příkaz C - breakpoint continue
00FC FE 55 CPI "U"
00FE CA 98 02 JZ CMOD ; příkaz C - breakpoint continue
0101 FE 48 CPI "H"
0103 CA 11 01 JZ CHELP ; příkaz C - breakpoint continue
0106 FE 3F CPI "?"
0108 CA 11 01 JZ CHELP ; příkaz C - breakpoint continue
010B NOCMD:
010B 21 C3 03 LXI H,WHAT
010E C3 BC 00 JMP WARMPRINT
0111 ; ---- commands
0111 CHELP:
0111 21 12 04 LXI H,HELP
0114 C3 BC 00 JMP WARMPRINT
0117 CREGS:
0117 21 08 FF LXI h,BRKPSW+1
011A 3E 41 MVI a,"A"
011C CD 6B 01 CALL crone
011F 21 0A FF LXI h,BRKBC+1
0122 3E 42 MVI a,"B"
0124 CD 6B 01 CALL crone
0127 2B DCX h
0128 3E 43 MVI a,"C"
012A CD 6B 01 CALL crone
012D 21 0C FF LXI h,BRKDE+1
0130 3E 44 MVI a,"D"
0132 CD 6B 01 CALL crone
0135 2B DCX h
0136 3E 45 MVI a,"E"
0138 CD 6B 01 CALL crone
013B 21 02 FF LXI h,BRKHL+1
013E 3E 48 MVI a,"H"
0140 CD 6B 01 CALL crone
0143 2B DCX h
0144 3E 4C MVI a,"L"
0146 CD 6B 01 CALL crone
0149 11 67 01 LXI d,crsp
014C 2A 05 FF LHLD BRKSP
014F CD 84 01 CALL crtwo
0152 22 05 FF SHLD BRKSP
0155 11 69 01 LXI d,crpc
0158 2A 03 FF LHLD BRKPC
015B CD 84 01 CALL crtwo
015E 22 03 FF SHLD BRKPC
0161 MAINCR:
0161 CD 01 03 CALL SERCRLF
0164 C3 BF 00 JMP main
0167 53 D0 CRSP: .ISTR "SP"
0169 50 C3 CRPC: .ISTR "PC"
016B CRONE:
016B F5 PUSH psw
016C 3E 0D MVI a,0Dh
016E CF RST 1
016F 3E 0A MVI a,0Ah
0171 CF RST 1
0172 F1 POP psw
0173 CF RST 1
0174 3E 20 MVI A," "
0176 CF RST 1
0177 7E MOV A,M
0178 CD 84 03 CALL PRINTHEX
017B 3E 20 MVI A," "
017D CF RST 1
017E 4E MOV C,M
017F CD 4D 03 CALL GETBYTE
0182 71 MOV M,C
0183 C9 RET
0184 CRTWO:
0184 E5 PUSH h
0185 3E 0D MVI a,0Dh
0187 CF RST 1
0188 3E 0A MVI a,0Ah
018A CF RST 1
018B D5 PUSH d
018C E1 POP h
018D CD 96 00 CALL strout
0190 3E 20 MVI A," "
0192 CF RST 1
0193 E1 POP h
0194 CD 7F 03 CALL PRINTADDR
0197 3E 20 MVI A," "
0199 CF RST 1
019A CD 14 03 CALL GETADDR1
019D C9 RET
019E CBRK:
019E CD 0B 03 CALL GETADDR
01A1 7E MOV A,M
01A2 32 00 FF STA BRKBYTE
01A5 36 E7 MVI M,0e7h ;RST 4
01A7 21 AD 01 LXI h,brkset
01AA C3 BC 00 JMP warmprint
01AD 42 52 45 41 4B 50 4F 49 4E 54 20 53 45 54 0D 8A BRKSET: .ISTR "BREAKPOINT SET",0dh,0ah
01BD CCONT:
01BD 2A 03 FF LHLD brkpc
01C0 E5 PUSH h
01C1 2A 07 FF LHLD brkpsw
01C4 E5 PUSH h
01C5 2A 0B FF LHLD brkde
01C8 E5 PUSH h
01C9 2A 09 FF LHLD brkbc
01CC E5 PUSH h
01CD 2A 01 FF LHLD brkhl
01D0 C1 POP b
01D1 D1 POP d
01D2 F1 POP psw
01D3 C9 RET
01D4 CMEM:
01D4 CD 0B 03 CALL GETADDR
01D7 CMEM1:
01D7 3E 0D MVI A,0DH
01D9 CF RST 1
01DA 3E 0A MVI A,0AH
01DC CF RST 1
01DD CD 7F 03 CALL PRINTADDR
01E0 3E 20 MVI A," "
01E2 CF RST 1
01E3 7E MOV A,M
01E4 CD 84 03 CALL PRINTHEX
01E7 3E 20 MVI A," "
01E9 CF RST 1
01EA 4E MOV C,M
01EB CD 4D 03 CALL GETBYTE
01EE 71 MOV M,C
01EF 23 INX H
01F0 78 MOV A,B
01F1 FE 0D CPI 0DH
01F3 CA D7 01 JZ CMEM1
01F6 C3 61 01 JMP MAINcr
01F9 CGO:
01F9 CD 0B 03 CALL GETADDR
01FC E9 PCHL
01FD DUMPCHARS: EQU 16
01FD CDUMP:
01FD CD 0B 03 CALL GETADDR
0200 3E 0D MVI A,0DH
0202 CF RST 1
0203 3E 0A MVI A,0AH
0205 CF RST 1
0206 CDUMPN:
0206 CD 7F 03 CALL PRINTADDR
0209 0E 10 MVI c,DUMPCHARS
020B 3E 20 MVI A," "
020D CF RST 1
020E E5 PUSH h
020F CDUMP1:
020F 7E MOV A,M
0210 CD 84 03 CALL PRINTHEX
0213 23 INX h
0214 0D DCR c
0215 C2 0F 02 JNZ cdump1
0218 E1 POP h
0219 3E 20 MVI A," "
021B CF RST 1
021C 0E 10 MVI C,DUMPCHARS
021E CDUMP2:
021E 7E MOV A,M
021F FE 20 CPI 20h
0221 DA 29 02 JC DUMPSANE
0224 FE 80 CPI 80h
0226 DA 2B 02 JC dumpchar
0229 DUMPSANE:
0229 3E 2E MVI a,"."
022B DUMPCHAR:
022B CD 8A 00 CALL SEROUT
022E 23 INX h
022F 0D DCR c
0230 C2 1E 02 JNZ cdump2
0233 3E 0D MVI A,0DH
0235 CF RST 1
0236 3E 0A MVI A,0AH
0238 CF RST 1
0239 CDUMPKEY:
0239 CD A4 00 CALL SERIN
023C CA 39 02 JZ CDUMPKEY
023F FE 20 CPI 20h ; mezerník ukončí dump
0241 CA BF 00 JZ MAIN
0244 FE 0D CPI 0dh ; enter jde na další adresu
0246 CA 06 02 JZ CDUMPN
0249 ;dump end
0249 C3 39 02 JMP CDUMPKEY
024C CHEXIN:
024C CD 2B 03 CALL GET1BYTE
024F 4F MOV C,A
0250 CD 44 03 CALL GET2BYTEREV
0253 ;type
0253 CD 2B 03 CALL GET1BYTE
0256 B7 ORA A
0257 C2 73 02 JNZ HEXLAST
025A ;byte2byte
025A HEXWRITER:
025A CD 2B 03 CALL GET1BYTE
025D 77 MOV M,A
025E 23 INX H
025F 0D DCR C
0260 C2 5A 02 JNZ HEXWRITER
0263 HEXCR:
0263 CD A4 00 CALL SERIN
0266 FE 0D CPI 0Dh
0268 C2 73 02 JNZ HEXLAST
026B 3E 24 MVI A,"$"
026D CD 8A 00 CALL SEROUT
0270 C3 BF 00 JMP MAIN
0273 HEXLAST:
0273 CD A4 00 CALL SERIN
0276 FE 0D CPI 0Dh
0278 C2 73 02 JNZ HEXLAST
027B 21 0C 04 LXI H,DONE
027E CD 96 00 CALL STROUT
0281 C3 BF 00 JMP MAIN
0284 ;
0284 CMODTEST:
0284 7E MOV a,m
0285 2C INR l
0286 FE 4D CPI "M"
0288 C0 RNZ
0289 7E MOV a,m
028A 2C INR l
028B FE 4F CPI "O"
028D C0 RNZ
028E 7E MOV a,m
028F 2C INR l
0290 FE 44 CPI "D"
0292 C0 RNZ
0293 7E MOV a,m
0294 2C INR l
0295 FE 34 CPI "4"
0297 C9 RET
0298 CMOD:
0298 21 CA 03 LXI h,mods
029B CD 96 00 CALL strout
029E .ENT $
029E 21 DD 04 LXI h,last
02A1 0E 41 MVI c,"A"
02A3 CMNEXT:
02A3 2E 03 MVI l,3
02A5 24 INR h
02A6 7C MOV a,h
02A7 FE 80 CPI 80h
02A9 D2 CA 02 JNC cmdone
02AC CM1:
02AC CD 84 02 CALL cmodtest
02AF C2 A3 02 JNZ cmnext
02B2 79 MOV a,c
02B3 0C INR c
02B4 CD 8A 00 CALL serout
02B7 3E 3A MVI a,":"
02B9 CD 8A 00 CALL serout
02BC 3E 20 MVI a,20h
02BE CD 8A 00 CALL serout
02C1 CD 96 00 CALL strout
02C4 CD 01 03 CALL sercrlf
02C7 C3 A3 02 JMP cmnext
02CA 21 E0 03 CMDONE: LXI h,modsel
02CD CD 96 00 CALL strout
02D0 CD A4 00 CMDWAI: CALL serin
02D3 CA D0 02 JZ cmdwai
02D6 FE 20 CPI 20h
02D8 CA 61 01 JZ maincr
02DB FE 0D CPI 0Dh
02DD CA 61 01 JZ maincr
02E0 FE 0A CPI 0Ah
02E2 CA 61 01 JZ maincr
02E5 DE 40 SBI 40h
02E7 4F MOV c,a
02E8 21 DD 04 LXI h,last
02EB CMDN:
02EB 2E 03 MVI l,3
02ED 24 INR h
02EE 7C MOV a,h
02EF FE 80 CPI 80h
02F1 D2 61 01 JNC maincr
02F4 CD 84 02 CMD1: CALL cmodtest
02F7 C2 EB 02 JNZ cmdn
02FA 0D DCR c
02FB C2 EB 02 JNZ cmdn
02FE 2E 00 MVI l,0
0300 E9 PCHL
0301 ;--- Pomocné rutiny
0301 SERCRLF:
0301 3E 0D MVI a,0Dh
0303 CD 8A 00 CALL serout
0306 3E 0A MVI a,0Ah
0308 C3 8A 00 JMP serout
030B GETADDR:
030B 21 07 04 LXI H,ADDR
030E CD 96 00 CALL STROUT
0311 21 00 00 LXI H,0
0314 GETADDR1:
0314 CD A4 00 CALL SERIN
0317 CA 14 03 JZ GETADDR1
031A CF RST 1
031B CD 69 03 CALL ISHEX
031E D8 RC
031F CD 77 03 CALL ATOHEX
0322 29 DAD H
0323 29 DAD H
0324 29 DAD H
0325 29 DAD H
0326 85 ADD L
0327 6F MOV L,A
0328 C3 14 03 JMP GETADDR1
032B GET1BYTE:
032B CD A4 00 CALL SERIN
032E CA 2B 03 JZ GET1BYTE
0331 CD 77 03 CALL ATOHEX
0334 87 ADD A
0335 87 ADD A
0336 87 ADD A
0337 87 ADD A
0338 47 MOV B,A
0339 GET1B1:
0339 CD A4 00 CALL SERIN
033C CA 39 03 JZ GET1B1
033F CD 77 03 CALL ATOHEX
0342 80 ADD B
0343 C9 RET
0344 GET2BYTEREV:
0344 CD 2B 03 CALL GET1BYTE
0347 67 MOV H,A
0348 CD 2B 03 CALL GET1BYTE
034B 6F MOV L,A
034C C9 RET
034D GETBYTE:
034D 06 00 MVI B,0
034F GETBYTE1:
034F CD A4 00 CALL SERIN
0352 CA 4F 03 JZ GETBYTE1
0355 CF RST 1
0356 CD 69 03 CALL ISHEX
0359 47 MOV B,A
035A D8 RC
035B CD 77 03 CALL ATOHEX
035E 57 MOV D,A
035F 79 MOV A,C
0360 87 ADD A
0361 87 ADD A
0362 87 ADD A
0363 87 ADD A
0364 82 ADD D
0365 4F MOV C,A
0366 C3 4F 03 JMP GETBYTE1
0369 ISHEX:
0369 FE 47 CPI "F"+1
036B 3F CMC
036C D8 RC
036D FE 30 CPI "0"
036F D8 RC
0370 FE 3A CPI "9"+1
0372 3F CMC
0373 D0 RNC
0374 FE 41 CPI "A"
0376 C9 RET
0377 ATOHEX:
0377 DE 30 SBI "0"
0379 FE 0A CPI 0Ah
037B D8 RC
037C DE 07 SBI "A"-"9"-1
037E C9 RET
037F PRINTADDR:
037F 7C MOV A,H
0380 CD 84 03 CALL PRINTHEX
0383 7D MOV A,L
0384 PRINTHEX:
0384 F5 PUSH PSW
0385 1F RAR
0386 1F RAR
0387 1F RAR
0388 1F RAR
0389 E6 0F ANI 0fh
038B C6 30 ADI "0"
038D FE 3A CPI "9"+1
038F DA 94 03 JC PRINTHEX1
0392 C6 07 ADI 7
0394 PRINTHEX1:
0394 CF RST 1
0395 F1 POP PSW
0396 E6 0F ANI 0FH
0398 C6 30 ADI "0"
039A FE 3A CPI "9"+1
039C DA 8A 00 JC SEROUT
039F C6 07 ADI 7
03A1 C3 8A 00 JMP SEROUT
03A4 ;--- Hlášky Monitoru
03A4 HELLO:
03A4 4F 4D 45 4E 20 41 4C 50 48 41 0D 0A DB "OMEN ALPHA",0Dh,0Ah
03B0 4D 4F 4E 49 54 4F 52 20 56 34 0D 0A DB "MONITOR V4",0Dh,0AH
03BC 52 45 41 44 59 0D 8A .ISTR "READY",0DH,0AH
03C3 WHAT:
03C3 57 48 41 54 3F 0D 8A .ISTR "WHAT?",0Dh,0Ah
03CA MODS:
03CA 45 45 50 52 4F 4D 20 4D 6F 64 75 6C 65 73 20 4C 69 73 74 3A 0D 8A .ISTR "EEPROM Modules List:",0Dh,0Ah
03E0 MODSEL:
03E0 53 65 6C 65 63 74 20 6D 6F 64 75 6C 65 2C 20 6F 72 20 70 72 65 73 73 20 45 4E 54 45 52 20 74 6F 20 65 78 69 74 20 BE .ISTR "Select module, or press ENTER to exit >"
0407 ADDR:
0407 41 64 64 72 BA .ISTR "Addr:"
040C DONE:
040C 44 4F 4E 45 0D 8A .ISTR "DONE",0Dh,0Ah
0412 0D 0A 43 4F 4D 4D 41 4E 44 53 3A HELP: DB 0dh,0ah,"COMMANDS:"
041D 0D 0A 4D 3A 20 53 68 6F 77 20 2F 20 61 6C 74 65 72 20 6D 65 6D 6F 72 79 DB 0dh,0ah,"M: Show / alter memory"
0435 0D 0A 44 3A 20 44 75 6D 70 20 6D 65 6D 6F 72 79 DB 0dh,0ah,"D: Dump memory"
0445 0D 0A 47 3A 20 47 6F 20 74 6F 20 61 64 64 72 65 73 73 20 28 52 75 6E 29 DB 0dh,0ah,"G: Go to address (Run)"
045D ; DB 0dh,0ah,"B: Start BASIC (if stored at 1000h)"
045D 0D 0A 55 3A 20 4C 69 73 74 20 75 73 65 72 20 6D 6F 64 75 6C 65 73 DB 0dh,0ah,"U: List user modules"
0473 0D 0A 58 3A 20 53 65 74 20 62 72 65 61 6B 70 6F 69 6E 74 DB 0dh,0ah,"X: Set breakpoint"
0486 0D 0A 43 3A 20 43 6F 6E 74 69 6E 75 65 20 61 66 74 65 72 20 62 72 65 61 6B DB 0dh,0ah,"C: Continue after break"
049F 0D 0A 52 3A 20 53 68 6F 77 20 2F 20 61 6C 74 65 72 20 72 65 67 69 73 74 65 72 73 20 28 75 73 65 20 69 6E 20 62 72 65 61 6B 29 DB 0dh,0ah,"R: Show / alter registers (use in break)"
04C9 0D 8A .ISTR 0dh,0ah
04CB ; thanks to all my patrons
04CB ; thanks to all my Patrons
04CB ; see more at https://www.patreon.com/omenmicro
04CB ;
04CB 44 61 6E 54 6F 6D 61 6E 65 6B 0D DB "DanTomanek",0dh
04D6 4B 61 6D 69 6C 5A 0D DB "KamilZ",0dh
04DD LAST: EQU $
04DD ;*************************************************************
04DD ;
04DD ; TINY BASIC FOR INTEL 8080
04DD ; VERSION 2.0
04DD ; BY LI-CHEN WANG
04DD ; MODIFIED AND TRANSLATED
04DD ; TO INTEL MNEMONICS
04DD ; BY ROGER RAUSKOLB
04DD ; 10 OCTOBER,1976
04DD ; @COPYLEFT
04DD ; ALL WRONGS RESERVED
04DD ;
04DD ;*************************************************************
04DD ;
04DD ; *** ZERO PAGE SUBROUTINES ***
04DD ;
04DD ; THE 8080 INSTRUCTION SET LETS YOU HAVE 8 ROUTINES IN LOW
04DD ; MEMORY THAT MAY BE CALLED BY RST N, N BEING 0 THROUGH 7.
04DD ; THIS IS A ONE BYTE INSTRUCTION AND HAS THE SAME POWER AS
04DD ; THE THREE BYTE INSTRUCTION CALL LLHH. TINY BASIC WILL
04DD ; USE RST 0 AS START AND RST 1 THROUGH RST 7 FOR
04DD ; THE SEVEN MOST FREQUENTLY USED SUBROUTINES.
04DD ; TWO OTHER SUBROUTINES (CRLF AND TSTNUM) ARE ALSO IN THIS
04DD ; SECTION. THEY CAN BE REACHED ONLY BY 3-BYTE CALLS.
04DD ;
04DD ; ROM Module
04DD ; Needs these instructions on the begin:
04DD .CSEG
04DD ALIGN 256
0500 .BLOCK
0500 C3 11 05 JMP START ; Jump to the begin
0503 ; Needed signature: MOD9 + module name + trailing zero
0503 4D 4F 44 34 54 69 6E 79 20 42 41 53 49 C3 .ISTR "MOD4Tiny BASIC"
0511 CR: EQU 0DH
0511 LF: EQU 0AH
0511 .macro DWA,
0511 ;
0511 DB >%%1 + 128
0511 DB <%%1
0511 .endm
0511
0511 ;
0511 ;.ORG 1000H
0511 31 FF FF START: LXI SP,STACK ;*** COLD START ***
0514 3E FF MVI A,0FFH
0516 C3 D4 0B JMP INIT
0519 ;
0519 3E 0D CRLF: MVI A,0dh ;*** CRLF ***
051B ;
051B RST2:
051B OUTC:
051B F5 PUSH PSW ;*** OUTC OR RST 2 ***
051C 3A 00 80 LDA OCSW ;PRINT CHARACTER ONLY
051F B7 ORA A ;IF OCSW SWITCH IS ON
0520 C3 FE 0B JMP OC2 ;REST OF THIS IS AT OC2
0523 ;
0523 RST3:
0523 EXPR:
0523 CD C1 08 CALL EXPR2 ;*** EXPR OR RST 3 ***
0526 E5 PUSH H ;EVALUATE AN EXPRESSION
0527 C3 7D 08 JMP EXPR1 ;REST OF IT AT EXPR1
052A 57 DB "W"
052B ;
052B RST4:
052B COMP:
052B 7C MOV A,H ;*** COMP OR RST 4 ***
052C BA CMP D ;COMPARE HL WITH DE
052D C0 RNZ ;RETURN CORRECT C AND
052E 7D MOV A,L ;Z FLAGS
052F BB CMP E ;BUT OLD A IS LOST
0530 C9 RET
0531 41 4E DB "AN"
0533 ;
0533 RST5:
0533 IGNBLK:
0533 1A SS1: LDAX D ;*** IGNBLK/RST 5 ***
0534 FE 20 CPI 20H ;IGNORE BLANKS
0536 C0 RNZ ;IN TEXT (WHERE DE->)
0537 13 INX D ;AND RETURN THE FIRST
0538 C3 33 05 JMP SS1 ;NON-BLANK CHAR. IN A
053B ;
053B RST6:
053B FINISH:
053B F1 POP PSW ;*** FINISH/RST 6 ***
053C CD 21 0A CALL FIN ;CHECK END OF COMMAND
053F C3 3A 0A JMP QWHAT ;PRINT "WHAT?" IF WRONG
0542 47 DB "G"
0543 ;
0543 RST7:
0543 TSTV:
0543 CD 33 05 CALL IGNBLK ;*** TSTV OR RST 7 ***
0546 D6 40 SUI 40H ;TEST VARIABLES
0548 D8 RC ;C:NOT A VARIABLE
0549 C2 67 05 JNZ TV1 ;NOT "@" ARRAY
054C 13 INX D ;IT IS THE "@" ARRAY
054D CD 78 09 CALL PARN ;@ SHOULD BE FOLLOWED
0550 29 DAD H ;BY (EXPR) AS ITS INDEX
0551 DA B5 05 JC QHOW ;IS INDEX TOO BIG?
0554 D5 PUSH D ;WILL IT OVERWRITE
0555 EB XCHG ;TEXT?
0556 CD BF 09 CALL SIZE ;FIND SIZE OF FREE
0559 CD 2B 05 CALL COMP ;AND CHECK THAT
055C DA 6A 0A JC ASORRY ;IF SO, SAY "SORRY"
055F 21 00 FC LXI H,VARBGN ;IF NOT GET ADDRESS
0562 CD E2 09 CALL SUBDE ;OF @(EXPR) AND PUT IT
0565 D1 POP D ;IN HL
0566 C9 RET ;C FLAG IS CLEARED
0567 FE 1B TV1: CPI 1BH ;NOT @, IS IT A TO Z?
0569 3F CMC ;IF NOT RETURN C FLAG
056A D8 RC
056B 13 INX D ;IF A THROUGH Z
056C 21 00 FC LXI H,VARBGN ;COMPUTE ADDRESS OF
056F 07 RLC ;THAT VARIABLE
0570 85 ADD L ;AND RETURN IT IN HL
0571 6F MOV L,A ;WITH C FLAG CLEARED
0572 3E 00 MVI A,0
0574 8C ADC H
0575 67 MOV H,A
0576 C9 RET
0577 ;
0577 RST1:
0577 TSTC:
0577 E3 XTHL ;*** TSTC OR RST 1 ***
0578 CD 33 05 CALL IGNBLK ;IGNORE BLANKS AND
057B BE CMP M ;TEST CHARACTER
057C 23 TC1: INX H ;COMPARE THE BYTE THAT
057D CA 87 05 JZ TC2 ;FOLLOWS THE RST INST.
0580 C5 PUSH B ;WITH THE TEXT (DE->)
0581 4E MOV C,M ;IF NOT =, ADD THE 2ND
0582 06 00 MVI B,0 ;BYTE THAT FOLLOWS THE
0584 09 DAD B ;RST TO THE OLD PC
0585 C1 POP B ;I.E., DO A RELATIVE
0586 1B DCX D ;JUMP IF NOT =
0587 13 TC2: INX D ;IF =, SKIP THOSE BYTES
0588 23 INX H ;AND CONTINUE
0589 E3 XTHL
058A C9 RET
058B ;
058B 21 00 00 TSTNUM: LXI H,0 ;*** TSTNUM ***
058E 44 MOV B,H ;TEST IF THE TEXT IS
058F CD 33 05 CALL IGNBLK ;A NUMBER
0592 FE 30 TN1: CPI 30H ;IF NOT, RETURN 0 IN
0594 D8 RC ;B AND HL
0595 FE 3A CPI 3AH ;IF NUMBERS, CONVERT
0597 D0 RNC ;TO BINARY IN HL AND
0598 3E F0 MVI A,0F0H ;SET B TO # OF DIGITS
059A A4 ANA H ;IF H>255, THERE IS NO
059B C2 B5 05 JNZ QHOW ;ROOM FOR NEXT DIGIT
059E 04 INR B ;B COUNTS # OF DIGITS
059F C5 PUSH B
05A0 44 MOV B,H ;HL=10*HL+(NEW DIGIT)
05A1 4D MOV C,L
05A2 29 DAD H ;WHERE 10* IS DONE BY
05A3 29 DAD H ;SHIFT AND ADD
05A4 09 DAD B
05A5 29 DAD H
05A6 1A LDAX D ;AND (DIGIT) IS FROM
05A7 13 INX D ;STRIPPING THE ASCII
05A8 E6 0F ANI 0FH ;CODE
05AA 85 ADD L
05AB 6F MOV L,A
05AC 3E 00 MVI A,0
05AE 8C ADC H
05AF 67 MOV H,A
05B0 C1 POP B
05B1 1A LDAX D ;DO THIS DIGIT AFTER
05B2 F2 92 05 JP TN1 ;DIGIT. S SAYS OVERFLOW
05B5 D5 QHOW: PUSH D ;*** ERROR "HOW?" ***
05B6 11 BC 05 AHOW: LXI D,HOW
05B9 C3 3E 0A JMP ERROR
05BC 48 4F 57 3F HOW: DB "HOW?"
05C0 0D DB CR
05C1 4F 4B OK: DB "OK"
05C3 0D DB CR
05C4 57 48 41 54 3F WHAT: DB "WHAT?"
05C9 0D DB CR
05CA 53 4F 52 52 59 SORRY: DB "SORRY"
05CF 0D DB CR
05D0 ;
05D0 ;*************************************************************
05D0 ;
05D0 ; *** MAIN ***
05D0 ;
05D0 ; THIS IS THE MAIN LOOP THAT COLLECTS THE TINY BASIC PROGRAM
05D0 ; AND STORES IT IN THE MEMORY.
05D0 ;
05D0 ; AT START, IT PRINTS OUT "(CR)OK(CR)", AND INITIALIZES THE
05D0 ; STACK AND SOME OTHER INTERNAL VARIABLES. THEN IT PROMPTS
05D0 ; ">" AND READS A LINE. IF THE LINE STARTS WITH A NON-ZERO
05D0 ; NUMBER, THIS NUMBER IS THE LINE NUMBER. THE LINE NUMBER
05D0 ; (IN 16 BIT BINARY) AND THE REST OF THE LINE (INCLUDING CR)
05D0 ; IS STORED IN THE MEMORY. IF A LINE WITH THE SAME LINE
05D0 ; NUMBER IS ALREADY THERE, IT IS REPLACED BY THE NEW ONE. IF
05D0 ; THE REST OF THE LINE CONSISTS OF A CR ONLY, IT IS NOT STORED
05D0 ; AND ANY EXISTING LINE WITH THE SAME LINE NUMBER IS DELETED.
05D0 ;
05D0 ; AFTER A LINE IS INSERTED, REPLACED, OR DELETED, THE PROGRAM
05D0 ; LOOPS BACK AND ASKS FOR ANOTHER LINE. THIS LOOP WILL BE
05D0 ; TERMINATED WHEN IT READS A LINE WITH ZERO OR NO LINE
05D0 ; NUMBER; AND CONTROL IS TRANSFERED TO "DIRECT".
05D0 ;
05D0 ; TINY BASIC PROGRAM SAVE AREA STARTS AT THE MEMORY LOCATION
05D0 ; LABELED "TXTBGN" AND ENDS AT "TXTEND". WE ALWAYS FILL THIS
05D0 ; AREA STARTING AT "TXTBGN", THE UNFILLED PORTION IS POINTED
05D0 ; BY THE CONTENT OF A MEMORY LOCATION LABELED "TXTUNF".
05D0 ;
05D0 ; THE MEMORY LOCATION "CURRNT" POINTS TO THE LINE NUMBER
05D0 ; THAT IS CURRENTLY BEING INTERPRETED. WHILE WE ARE IN
05D0 ; THIS LOOP OR WHILE WE ARE INTERPRETING A DIRECT COMMAND
05D0 ; (SEE NEXT SECTION). "CURRNT" SHOULD POINT TO A 0.
05D0 ;
05D0 31 FF FF RSTART: LXI SP,STACK
05D3 CD 19 05 ST1: CALL CRLF ;AND JUMP TO HERE
05D6 11 C1 05 LXI D,OK ;DE->STRING
05D9 97 SUB A ;A=0
05DA CD DE 0A CALL PRTSTG ;PRINT STRING UNTIL CR
05DD 21 E4 05 LXI H,ST2+1 ;LITERAL 0
05E0 22 01 80 SHLD CURRNT ;CURRENT->LINE # = 0
05E3 21 00 00 ST2: LXI H,0
05E6 22 09 80 SHLD LOPVAR
05E9 22 03 80 SHLD STKGOS
05EC 3E 3E ST3: MVI A,3EH ;PROMPT ">" AND
05EE CD 70 0A CALL GETLN ;READ A LINE
05F1 D5 PUSH D ;DE->END OF LINE
05F2 11 37 FC LXI D,BUFFER ;DE->BEGINNING OF LINE
05F5 CD 8B 05 CALL TSTNUM ;TEST IF IT IS A NUMBER
05F8 CD 33 05 CALL IGNBLK
05FB 7C MOV A,H ;HL=VALUE OF THE # OR
05FC B5 ORA L ;0 IF NO # WAS FOUND
05FD C1 POP B ;BC->END OF LINE
05FE CA D1 0C JZ DIRECT
0601 1B DCX D ;BACKUP DE AND SAVE
0602 7C MOV A,H ;VALUE OF LINE # THERE
0603 12 STAX D
0604 1B DCX D
0605 7D MOV A,L
0606 12 STAX D
0607 C5 PUSH B ;BC,DE->BEGIN, END
0608 D5 PUSH D
0609 79 MOV A,C
060A 93 SUB E
060B F5 PUSH PSW ;A=# OF BYTES IN LINE
060C CD B4 0A CALL FNDLN ;FIND THIS LINE IN SAVE
060F D5 PUSH D ;AREA, DE->SAVE AREA
0610 C2 23 06 JNZ ST4 ;NZ:NOT FOUND, INSERT
0613 D5 PUSH D ;Z:FOUND, DELETE IT
0614 CD D2 0A CALL FNDNXT ;FIND NEXT LINE
0617 ;DE->NEXT LINE
0617 C1 POP B ;BC->LINE TO BE DELETED
0618 2A 15 80 LHLD TXTUNF ;HL->UNFILLED SAVE AREA
061B CD 75 0B CALL MVUP ;MOVE UP TO DELETE
061E 60 MOV H,B ;TXTUNF->UNFILLED AREA
061F 69 MOV L,C
0620 22 15 80 SHLD TXTUNF ;UPDATE
0623 C1 ST4: POP B ;GET READY TO INSERT
0624 2A 15 80 LHLD TXTUNF ;BUT FIRST CHECK IF
0627 F1 POP PSW ;THE LENGTH OF NEW LINE
0628 E5 PUSH H ;IS 3 (LINE # AND CR)
0629 FE 03 CPI 3 ;THEN DO NOT INSERT
062B CA D0 05 JZ RSTART ;MUST CLEAR THE STACK
062E 85 ADD L ;COMPUTE NEW TXTUNF
062F 6F MOV L,A
0630 3E 00 MVI A,0
0632 8C ADC H
0633 67 MOV H,A ;HL->NEW UNFILLED AREA
0634 11 00 FC LXI D,TXTEND ;CHECK TO SEE IF THERE
0637 CD 2B 05 CALL COMP ;IS ENOUGH SPACE
063A D2 69 0A JNC QSORRY ;SORRY, NO ROOM FOR IT
063D 22 15 80 SHLD TXTUNF ;OK, UPDATE TXTUNF
0640 D1 POP D ;DE->OLD UNFILLED AREA
0641 CD 80 0B CALL MVDOWN
0644 D1 POP D ;DE->BEGIN, HL->END
0645 E1 POP H
0646 CD 75 0B CALL MVUP ;MOVE NEW LINE TO SAVE
0649 C3 EC 05 JMP ST3 ;AREA
064C ;
064C ;*************************************************************
064C ;
064C ; WHAT FOLLOWS IS THE CODE TO EXECUTE DIRECT AND STATEMENT
064C ; COMMANDS. CONTROL IS TRANSFERED TO THESE POINTS VIA THE
064C ; COMMAND TABLE LOOKUP CODE OF "DIRECT" AND "EXEC" IN LAST
064C ; SECTION. AFTER THE COMMAND IS EXECUTED, CONTROL IS
064C ; TRANSFERED TO OTHERS SECTIONS AS FOLLOWS:
064C ;
064C ; FOR "LIST", "NEW", AND "STOP": GO BACK TO "RSTART"
064C ; FOR "RUN": GO EXECUTE THE FIRST STORED LINE IF ANY, ELSE
064C ; GO BACK TO "RSTART".
064C ; FOR "GOTO" AND "GOSUB": GO EXECUTE THE TARGET LINE.
064C ; FOR "RETURN" AND "NEXT": GO BACK TO SAVED RETURN LINE.
064C ; FOR ALL OTHERS: IF "CURRENT" -> 0, GO TO "RSTART", ELSE
064C ; GO EXECUTE NEXT COMMAND. (THIS IS DONE IN "FINISH".)
064C ;*************************************************************
064C ;
064C ; *** NEW *** STOP *** RUN (& FRIENDS) *** & GOTO ***
064C ;
064C ; "NEW(CR)" SETS "TXTUNF" TO POINT TO "TXTBGN"
064C ;
064C ; "STOP(CR)" GOES BACK TO "RSTART"
064C ;
064C ; "RUN(CR)" FINDS THE FIRST STORED LINE, STORE ITS ADDRESS (IN
064C ; "CURRENT"), AND START EXECUTE IT. NOTE THAT ONLY THOSE
064C ; COMMANDS IN TAB2 ARE LEGAL FOR STORED PROGRAM.
064C ;
064C ; THERE ARE 3 MORE ENTRIES IN "RUN":
064C ; "RUNNXL" FINDS NEXT LINE, STORES ITS ADDR. AND EXECUTES IT.
064C ; "RUNTSL" STORES THE ADDRESS OF THIS LINE AND EXECUTES IT.
064C ; "RUNSML" CONTINUES THE EXECUTION ON SAME LINE.
064C ;
064C ; "GOTO EXPR(CR)" EVALUATES THE EXPRESSION, FIND THE TARGET
064C ; LINE, AND JUMP TO "RUNTSL" TO DO IT.
064C ;
064C CD 34 0A NEW: CALL ENDCHK ;*** NEW(CR) ***
064F 21 17 80 LXI H,TXTBGN
0652 22 15 80 SHLD TXTUNF
0655 ;
0655 CD 34 0A STOP: CALL ENDCHK ;*** STOP(CR) ***
0658 C3 D0 05 JMP RSTART
065B CD 34 0A BYE: CALL ENDCHK ;*** RUN(CR) ***
065E C7 RST 0
065F ;
065F CD 34 0A RUN: CALL ENDCHK ;*** RUN(CR) ***
0662 11 17 80 LXI D,TXTBGN ;FIRST SAVED LINE
0665 ;
0665 21 00 00 RUNNXL: LXI H,0 ;*** RUNNXL ***
0668 CD BC 0A CALL FNDLP ;FIND WHATEVER LINE #
066B DA D0 05 JC RSTART ;C:PASSED TXTUNF, QUIT
066E ;
066E EB RUNTSL: XCHG ;*** RUNTSL ***
066F 22 01 80 SHLD CURRNT ;SET "CURRENT"->LINE #
0672 EB XCHG
0673 13 INX D ;BUMP PASS LINE #
0674 13 INX D
0675 ;
0675 CD 18 0C RUNSML: CALL CHKIO ;*** RUNSML ***
0678 21 56 0C LXI H,TAB2-1 ;FIND COMMAND IN TAB2
067B C3 D4 0C JMP EXEC ;AND EXECUTE IT
067E ;
067E CD 23 05 GOTO: CALL EXPR ;*** GOTO EXPR ***
0681 D5 PUSH D ;SAVE FOR ERROR ROUTINE
0682 CD 34 0A CALL ENDCHK ;MUST FIND A CR
0685 CD B4 0A CALL FNDLN ;FIND THE TARGET LINE
0688 C2 B6 05 JNZ AHOW ;NO SUCH LINE #
068B F1 POP PSW ;CLEAR THE PUSH DE
068C C3 6E 06 JMP RUNTSL ;GO DO IT
068F ;
068F ;*************************************************************
068F ;
068F ; *** LIST *** & PRINT ***
068F ;
068F ; LIST HAS TWO FORMS:
068F ; "LIST(CR)" LISTS ALL SAVED LINES
068F ; "LIST #(CR)" START LIST AT THIS LINE #
068F ; YOU CAN STOP THE LISTING BY CONTROL C KEY
068F ;
068F ; PRINT COMMAND IS "PRINT ....;" OR "PRINT ....(CR)"
068F ; WHERE "...." IS A LIST OF EXPRESIONS, FORMATS, BACK-
068F ; ARROWS, AND STRINGS. THESE ITEMS ARE SEPERATED BY COMMAS.
068F ;
068F ; A FORMAT IS A POUND SIGN FOLLOWED BY A NUMBER. IT CONTROLS
068F ; THE NUMBER OF SPACES THE VALUE OF A EXPRESION IS GOING TO
068F ; BE PRINTED. IT STAYS EFFECTIVE FOR THE REST OF THE PRINT
068F ; COMMAND UNLESS CHANGED BY ANOTHER FORMAT. IF NO FORMAT IS
068F ; SPECIFIED, 6 POSITIONS WILL BE USED.
068F ;
068F ; A STRING IS QUOTED IN A PAIR OF SINGLE QUOTES OR A PAIR OF
068F ; DOUBLE QUOTES.
068F ;
068F ; A BACK-ARROW MEANS GENERATE A (CR) WITHOUT (LF)
068F ;
068F ; A (CRLF) IS GENERATED AFTER THE ENTIRE LIST HAS BEEN
068F ; PRINTED OR IF THE LIST IS A NULL LIST. HOWEVER IF THE LIST
068F ; ENDED WITH A COMMA, NO (CRLF) IS GENERATED.
068F ;
068F CD 8B 05 LIST: CALL TSTNUM ;TEST IF THERE IS A #
0692 CD 34 0A CALL ENDCHK ;IF NO # WE GET A 0
0695 CD B4 0A CALL FNDLN ;FIND THIS OR NEXT LINE
0698 DA D0 05 LS1: JC RSTART ;C:PASSED TXTUNF
069B CD 60 0B CALL PRTLN ;PRINT THE LINE
069E CD 18 0C CALL CHKIO ;STOP IF HIT CONTROL-C
06A1 CD BC 0A CALL FNDLP ;FIND NEXT LINE
06A4 C3 98 06 JMP LS1 ;AND LOOP BACK
06A7 ;
06A7 0E 06 PRINT: MVI C,6 ;C = # OF SPACES
06A9 CD 77 05 CALL TSTC ;IF NULL LIST & ";"
06AC 3B DB 3BH
06AD 06 DB PR2-$-1
06AE CD 19 05 CALL CRLF ;GIVE CR-LF AND
06B1 C3 75 06 JMP RUNSML ;CONTINUE SAME LINE
06B4 CD 77 05 PR2: CALL TSTC ;IF NULL LIST (CR)
06B7 0D DB CR
06B8 06 DB PR0-$-1
06B9 CD 19 05 CALL CRLF ;ALSO GIVE CR-LF AND
06BC C3 65 06 JMP RUNNXL ;GO TO NEXT LINE
06BF CD 77 05 PR0: CALL TSTC ;ELSE IS IT FORMAT?
06C2 23 DB "#"
06C3 07 DB PR1-$-1
06C4 CD 23 05 CALL EXPR ;YES, EVALUATE EXPR.
06C7 4D MOV C,L ;AND SAVE IT IN C
06C8 C3 D1 06 JMP PR3 ;LOOK FOR MORE TO PRINT
06CB CD EC 0A PR1: CALL QTSTG ;OR IS IT A STRING?
06CE C3 E2 06 JMP PR8 ;IF NOT, MUST BE EXPR.
06D1 CD 77 05 PR3: CALL TSTC ;IF ",", GO FIND NEXT
06D4 2C DB ","
06D5 06 DB PR6-$-1
06D6 CD 21 0A CALL FIN ;IN THE LIST.
06D9 C3 BF 06 JMP PR0 ;LIST CONTINUES
06DC CD 19 05 PR6: CALL CRLF ;LIST ENDS
06DF CD 3B 05 CALL FINISH