-
Notifications
You must be signed in to change notification settings - Fork 17
/
esfrom.z80
1216 lines (1215 loc) · 14.2 KB
/
esfrom.z80
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
;;;
;;; Exatron Stringy Floppy ROM code, from the "ESF Advanced Programmer's Guide".
;;; Believed to be in the public domain.
;;;
; EXATRON STRINGY FLOPPY FIRMWARE FOR TRS-80 PAGE 1
CR EQU 0DH
SYNC EQU 16H
CEI EQU 0FBH
BSRAM EQU 401AH
BSINT EQU 2B02H
BSLIN EQU 40A2H
BSPRN EQU 0FAFH
BSMEM EQU 40B1H
BSERR EQU 19A2H
BSCONT EQU 1D1EH
BSFCE EQU 1E4AH
BSFIND EQU 1AF8H
BSHL EQU 40E6H
BSIEXP EQU 2B1CH
BSINTH EQU 4012H
BSRST2 EQU 4004H
BSPRTC EQU 032AH
BSCLR EQU 1E83H
BSRDY EQU 1A2BH
BSINC EQU 1D78H
BSEXE EQU 1D5BH
BSBGNP EQU 40A4H
BSENDP EQU 40F9H
BSMAXP EQU 40A0H
BSSYNE EQU 1997H
BSFIX EQU 1AE8H
BSCSV EQU 0ADH
BSCLD EQU 0A7H
BSCNW EQU 0BBH
BSKI EQU 4016H
BSKS EQU 4036H
BSKR EQU 03FBH
BSDLY EQU 0060H
BSSFT EQU 3880H
BSKEY EQU 3801H
BSBRK EQU 3840H
;
; *** *** VECTORS *** ***
;
ORG 3000H
JP REWIND
JP READX
JP WRITE
JP WEOFX
JP SAVEA
JP FBOF
JP SELECT
BASIC LD HL,(BSHL)
BS1 JP BSCONT
JP FBOFX
JP WRITEX
JP WEOF
JP NEWA
JP WBEOF
JP ERROR
JP GETN
JP AUTO
; EXATRON STRINGY FLOPPY FIRMWARE FOR TRS-80 PAGE 2
;
;*** *** >SYSTEM *** ***
; *? /1234N
;
;WHERE N=0 FOR @LOAD
; 1 FOR @LOAD 1
; 2 FOR @LOAD 2
; 3 FOR @LOAD 3
; 4 FOR @LOAD 4
; 5 FOR NO LOAD
; 6 FOR KEYBOUNCE
;
NOP
START INC A
INC A
INC A
INC A
INC A
INC A
LD (BSRAM),A
LD HL,CHECK
LD (BSRST2),HL
LD HL,(BSMEM)
LD (HL),BSSYNE/256
DEC HL
LD (HL),BSSYNE MOD 256
DEC HL
LD (HL),0C3H
DEC HL
LD (HL),0F0H
DEC HL
LD (BSMEM),HL
LD HL,HEAD
CALL PRTSTG
LD DE,50
CALL BSCLR
LD A,(BSRAM)
NEG
JR Z,ST1
LD HL,DEBNC
LD (BSKI),HL
ADD A,6
LD C,A
CP 5
JP NZ,LOADA
ST1 JP BSRDY
AUTO CALL BSFIND
LD HL,(BSBGNP)
DEC HL
JR BS1
;
;** MAKE BASIC LOOK FOR '@' ***
;
CHECK EX (SP),HL
LD A,L
CP BSEXE MOD 256
JR NZ,CH1
; EXATRON STRINGY FLOPPY FIRMWARE FOR TRS-80 PAGE 3
LD A,H
CP BSEXE/256
CH1 EX (SP),HL
JP NZ,BSINC
RST 10H
PUSH AF
AND 0DFH
CP '@'
JR Z,CH3
POP AF
RET
CH3 POP AF
POP AF
RST 10H
JR Z,CH4
CP '#'
JR NZ,CH5
RST 10H
CH4 JR Z,SA0
CALL BSIEXP
PUSH AF
CP 08H
JR NC,CH6
CALL SELECT
JP NZ,BSFCE
POP AF
LD A,(HL)
JP Z,BSCONT
CH5 LD DE,BASIC
PUSH DE
CP BSCSV
JR Z,SAVEB
CP BSCLD
JP Z,LOAD
CP BSCNW
JR Z,NEW
LD (BSHL),HL
LD HL,(BSMEM)
INC HL
INC HL
JP (HL)
GETN RST 10H
LD C,00H
JR Z,GT1
CALL BSIEXP
CP 64H
CH6 JP NC,BSFCE
LD C,A
GT1 LD (BSHL),HL
LD A,C
OR A
RET
;*** ADDED BASIC COMMANDS ***
;
;... '@NEW', @NEW1', ETC. ...
;
; EXATRON STRINGY FLOPPY FIRMWARE FOR TRS-80 PAGE 4
NEW CALL GETN
LD HL,NEWMSG
CALL PRTSTG
LD H,C
CALL NEWA
PUSH AF
AND 0B7H
JR NZ,NW0
CALL BSPRN
LD HL,BYTEMSG
CALL PRTSTG
NW0 POP AF
JP LR6
;
;... '@SAVE1', '@SAVE2', ECT. ...
;
SAVEB CALL GETN
SA0 JR Z,SA1
DEC HL
RST 10H
JR Z,SA2
RST 08H
DB ','
CALL INTGR
PUSH DE
RST 08H
DB ','
CALL INTGR
PUSH DE
LD DE,BASIC
JR Z,SA3
RST 08H
DB ','
CALL INTGR
JR Z,SA3
SA1 JP BSSYNE
SA2 CALL BSFIND
INC HL
LD DE,(BSBGNP)
SBC HL,DE
PUSH DE
PUSH HL
LD DE,0000H
SA3 LD HL,WRITMSG
CALL PRTSTG
LD A,C
POP BC
POP HL
CALL SAVEA
JP LR1
INTGR PUSH BC
CALL BSINT
DEC HL
RST 10H
POP BC
LD (BSHL),HL
RET
; EXATRON STRINGY FLOPPY FIRMWARE FOR TRS-80 PAGE 5
;
;... '@LOAD'. '@LOAD1', ETC. ...
;
LOAD CALL GETN
LOADA LD HL,READMSG
CALL PRTSTG
LD HL,(BSBGNP)
LD DE,0064H
ADD HL,DE
LD DE,(BSMAXP)
SBC HL,DE
PUSH HL
LD HL,(BSLIN)
INC HL
LD A,H
OR L
JR Z,LD1
LD HL,(BSBGNP)
LD DE,(BSENDP)
SCF
SBC HL,DE
EX (SP),HL
LD1 POP IY
LD HL,0000H
PUSH HL
LD H,C
LD L,0FFH
LD A,C
OR A
JR NZ,LD2
LD L,A
LD2 CALL MTON
LD3 CALL RPREAM
JR NZ,LRTN
LD A,D
OR A
JR Z,LD3
JP M,LD3
SUB H
AND L
JR NZ,LD3
CALL RDTWO
JR NZ,LRTN
RET NZ
RET NZ
LD H,D
PUSH HL
POP IX
PUSH HL
POP HL
NOP
CALL RDTWO
JR NZ,LRTN
LD H,D
LD A,D
OR L
JR Z,LOADB
; EXATRON STRINGY FLOPPY FIRMWARE FOR TRS-80 PAGE 6
PUSH HL
POP IY
PUSH HL
POP HL
LD4 CALL RDTWO
JR NZ,LRTN
LD E,L
POP HL
ADD HL,DE
JR C,LR5
PUSH DE
PUSH DE
POP HL
CALL RBLOCK
JR NZ,LRTN
POP DE
PUSH IY
POP HL
LD A,L
OR H
JR NZ,LD6
LD HL,(BSLIN)
INC HL
LD A,H
OR L
LD HL,RTNBS
JR Z,LD7
LD HL,AUTO
JR LD7
LD6 LD A,(BSSFT)
OR A
JR Z,LD7
LD HL,ABT
LD7 EX (SP),HL
XOR A
JR LR1
LOADB NOP
EX (SP),IY
LD IX,(BSBGNP)
JR LD4
LRTN POP HL
LR1 CALL MTOFF
LR6 LD HL,DONEMSG
JP Z,PRTSTG
CALL PRTERR
BFD LD E,2AH
JP BSERR
LR5 LD A,20H
OR A
JR LR1
RTNBS LD (BSENDP),IX
LD HL,(BSBGNP)
PUSH HL
JP BSFIX
ABT LD HL,BRKMSG
CALL PRTSTG
PUSH IX
; EXATRON STRINGY FLOPPY FIRMWARE FOR TRS-80 PAGE 7
POP HL
XOR A
SBC HL,DE
PUSH DE
CALL BSPRN
LD A,','
CALL BSPRTC
POP HL
CALL BSPRN
LD A,','
CALL BSPRTC
PUSH IY
POP HL
CALL BSPRN
JR BFD
;
;*** SUBROUTINES FOR ASMB CALL ***
; VECTORED FROM 3000H ETC.
;
; ALL RETURN WITH Z FOR CORRECT
; NZ FOR ERROR WITH REG.A =
; BIT0 --- WRITE WITHOUT DECAL
; BIT1 --- USER HIT BREAK
; BIT2 --- WRITE PASS EOT
; BIT3 --- READ PARTY ERROR
; BIT4 --- READ CHECKSUM ERROR
; BIT5 --- RECORD TOO LONG
; BIT6 --- VERIFY ERROR
; BIT7 --- EOF READ
;
;...WIND TAPE TO BOT ...
;
REWIND PUSH BC
PUSH DE
CALL MTON
CALL DELAY
RWDL LD A,(BSBRK)
AND 04H
RRCA
JR NZ,RWDF
IN A,(C)
AND 04H
JR Z,RWDL
XOR A
RWDF CALL MTOFF
POP DE
POP BC
RET
;
;... ERASE TAPE ...
; H = STARTING FILE NUMBER
; HL RETURNS NUMBER OF BYTES
;
NEWA PUSH BC
PUSH DE
CALL MTONW
AND 01H
; EXATRON STRINGY FLOPPY FIRMWARE FOR TRS-80 PAGE 8
JR NZ,NW11
LD A,H
CP 02H
JR NC,NW2
CALL REWIND
JR NZ,NW11
LD A,85H
LD (BSRAM),A
OUT (C),A
CALL DELAY
LD L,0FFH
CALL WRPRE
JR NZ,NW11
JR NW3
NW2 CALL RPREAM
JR NZ,NW11
LD A,D
ADD A,H
JR NZ,NW2
NW3 LD B,10H
NW4 DJNZ NW4
LD L,80H
CALL WPREAM
JP NZ,NW11
LD E,5AH
NW6 LD H,0FFH
LD D,H
CALL WRBIT
JP Z,NW6
NW7 LD B,01H
CALL WRBIT
DEC E
JP NZ,NW7
LD B,01H
OUT (C),B
NW8 CALL RPREAM
JR NZ,NW11
LD A,D
CP L
JR NZ,NW8
LD HL,0FFFFH
NW9 INC HL
IN A,(C)
AND 04H
JR NZ,NW10
CALL RDBYTE
JP NZ,NW10
PUSH AF
POP AF
INC D
LD A,08H
JR Z,NW9
NW10 AND 0FBH
NW11 CALL MTOFF
POP DE
POP BC
RET
; EXATRON STRINGY FLOPPY FIRMWARE FOR TRS-80 PAGE 9
;
;... READ DATA BLOCK ...
; HL --> BUFFER
; BC = BUFFER LENGTH AT ENTRY
; RECORD LENGTH AT RETURN
;
READX PUSH IX
PUSH DE
PUSH HL
POP IX
PUSH HL
PUSH IY
PUSH BC
LD A,C
CPL
LD C,A
LD A,B
CPL
LD B,A
PUSH BC
POP IY
CALL MTON
RLP CALL RPREAM
JR NZ,RRTN
LD A,D
OR A
LD A,04H
JR NZ,RRTN
LD A,(IX)
CALL RDTWO
JR NZ,RRTN
LD H,D
EX DE,HL
ADD IY,DE
EX DE,HL
JR C,BUFE
RET C
NOP
PUSH HL
POP HL
CALL RBLOCK
JR NZ,RRTN
POP DE
ADD IY,DE
INC IY
PUSH IY
RRTN CALL MTOFF
POP BC
POP IY
POP HL
POP DE
POP IX
RET
BUFE LD A,20H
OR A
JR RRTN
;
; EXATRON STRINGY FLOPPY FIRMWARE FOR TRS-80 PAGE 10
;... WRITE DATA RECORD ...
; HL --> BUFFER
; BC = BUFFER LENGTH
; D = DELAY TIME
;
WRITEX PUSH IX
PUSH HL
POP IX
PUSH HL
PUSH DE
PUSH BC
CALL MTONW
JR NZ,WRTN
LD L,00H
CALL WPREAM
JR NZ,WRTN
POP HL
PUSH HL
LD A,(IX+00H)
CALL WRTWO
JR NZ,WRTN
NOP
POP HL
PUSH HL
CALL WBLOCK
WRTN CALL MTOFF
POP HL
POP DE
PUSH HL
CALL Z,ONDLY
POP BC
POP HL
POP IX
RET
WRITE PUSH DE
LD D,3DH
CALL WRITEX
POP DE
RET
;
;...WRITE BUFFER & EOF ...
; HL --> BUFFER
; BC = BUFFER LENGTH
; A = FILL NUMBER
;
WBEOF PUSH AF
LD A,B
OR C
CALL NZ,WRITE
POP AF
JR WEOF
;... WRITE EOF MARK ...
; A= FILE NUMBER
;
WEOFX DEC A
WEOF PUSH BC
; EXATRON STRINGY FLOPPY FIRMWARE FOR TRS-80 PAGE 11
PUSH DE
PUSH HL
CPL
OR 80H
LD L,A
CALL MTONW
CALL Z,WRPRE
CALL MTOFF
POP HL
POP DE
POP BC
RET
;
;... WRITE PROGRAM FILE ...
; HL = LOAD ADDRESS
; DE = START ADDRESS
; BC = LENGTH
; A = FILE # (1 THRU 9)
;
SAVEA PUSH IX
PUSH IY
PUSH HL
PUSH DE
PUSH BC
PUSH HL
POP IX
PUSH HL
LD L,A
PUSH HL
PUSH DE
POP IY
PUSH BC
CALL MTONW
JR NZ,SVEJ
SV1 CALL RPREAM
JR NZ,SVEJ
LD A,D
ADD A,L
JR NZ,SV1
LD B,10H
SV2 DJNZ SV2
CALL WPREAM
JR NZ,SVEJ
ADC HL,DE
PUSH IX
POP HL
CALL WRTWO
JR NZ,SVEJ
ADC HL,DE
PUSH IY
POP HL
CALL WRTWO
SVEJ JR NZ,SVE
ADC HL,DE
ADC HL,DE
POP HL
CALL WRTWO
; EXATRON STRINGY FLOPPY FIRMWARE FOR TRS-80 PAGE 12
JR NZ,SVE1
PUSH HL
POP HL
NOP
CALL WBLOCK
JR NZ,SVE1
POP HL
POP IX
LD A,L
CPL
LD L,A
CALL WRPRE
JR NZ,SVR
LD A,L
CPL
LD L,A
LD A,01H
OUT (C),A
SV3 CALL RPREAM
JR NZ,SVR
LD A,D
CP L
JR NZ,SV3
RET NZ
PUSH HL
POP HL
CALL RDTWO
JR NZ,SVR
RET NZ
NOP
LD A,L
PUSH IX
POP HL
CP L
JR NZ,ERR
LD A,D
CP H
JR NZ,ERR
CALL RDTWO
JR NZ,SVR
RET NZ
NOP
LD A,L
PUSH IY
POP HL
CP L
JR NZ,ERR
LD A,D
CP H
JR NZ,ERR
CALL RDTWO
JR NZ,SVR
RET NZ
RET NZ
PUSH HL
POP HL
LD A,L
; EXATRON STRINGY FLOPPY FIRMWARE FOR TRS-80 PAGE 13
POP HL
PUSH HL
CP L
JR NZ,ERR
LD A,D
CP H
JR NZ,ERR
SV4 CALL RDBYTE
JR NZ,SVR
RET NZ
JR SV5
SVE POP HL
SVE1 POP HL
POP HL
SVR CALL MTOFF
POP BC
POP DE
POP HL
POP IY
POP IX
RET
SV5 LD A,(IX)
CP D
JR NZ,ERR
INC IX
DEC HL
LD A,H
OR L
JP NZ,SV4
CALL RDBYTE
JR NZ,SVR
LD B,6
SV7 DJNZ SV7
CALL RDBYTE
JR NZ,SVR
LD A,(BSRAM)
OR A
JR Z,SV6
LD A,10
SV6 JR SVR
ERR LD A,40H
JR SVR
;
;... FIND BEGINNING OF DATA FILE ...
; A = FILE NUMBER
;
FBOFX PUSH BC
PUSH DE
PUSH AF
CALL MTON
OP1 CALL RPREAM
JR NZ,OP2
POP AF
PUSH AF
ADD A,D
JR NZ,OP1
OP2 CALL MTOFF
; EXATRON STRINGY FLOPPY FIRMWARE FOR TRS-80 PAGE 14
POP DE
POP DE
CALL Z,ONDLY
POP BC
RET
FBOF PUSH DE
LD D,61
CALL FBOFX
POP DE
RET
;
;... SELECT DRIVE ...
; AF = DRIVE NUMBER
;
SELECT PUSH BC
OR 0F0H
LD C,A
IN A,(C)
AND 8
LD A,C
POP BC
RET NZ
PUSH HL
LD HL,(BSMEM)
INC HL
LD (HL),A
POP HL
RET
;
;...PRINT ERROR MESSAGE ...
; A = ERROR CODE
;
ERROR PUSH HL
PUSH AF
CALL PRTERR
POP AF
POP HL
RET
;
;*** *** STRINGS *** ***
;
HEAD DB 'EXAT'
DB 'RON '
DB 'STRI'
DB 'NGY '
DB 'FLOP'
DB 'PY V'
DB 'ERSI'
DB 'ON 4'
DB '.1',CR+80H
NEWMSG DB 'ERAS'
DB 'ING.'
DB '.'+80H
BYTEMSG DB ' BYT'
DB 'ES.','.'+80H
WRITMSG DB 'WRIT'
DB 'ING.'
; EXATRON STRINGY FLOPPY FIRMWARE FOR TRS-80 PAGE 15
DB '.'+80H
READMSG DB 'READ'
DB 'ING.'
DB '.'+80H
VRFMSG DB 'VERI'
DB 'F','Y'+80H
PERRMSG DB 'PARI'
DB 'T','Y'+80H
CERRMSG DB 'CHEC'
DB 'KSU','M'+80H
OMMSG DB 'OUT '
DB 'OF M'
DB 'EMOR'
DB 'Y'+80H
TTSMSG DB 'TAPE'
DB ' TOO'
DB ' SHO'
DB 'R','T'+80H
WPMSG DB 'WRIT'
DB 'E-PR'
DB 'OTEC'
DB 'TE','D',+80H ;;; minor bug in original: should be 'TE','D'+80H
EOFMSG DB 'EO','F'+80H
ERRMSG DB ' ERR'
DB 'OR',CR+80H
BRKMSG DB 'BREA'
DB 'K',CR+80H
DONEMSG DB 'DONE'
DB CR+80H
;
;*** *** SUB-SUBROUTINES *** ***
;
;PRINTER ERROR MESSAGE
;
PRTERR BIT 0,A
LD HL,WPMSG
JR NZ,PE1
BIT 1,A
LD HL,BRKMSG
JR NZ,PRTSTG
BIT 2,A
LD HL,TTSMSG
JR NZ,PE1
BIT 3,A
LD HL,PERRMSG
JR NZ,PE1
BIT 4,A
LD HL,CERRMSG
JR NZ,PE1
BIT 5,A
LD HL,OMMSG
JR NZ,PE1
BIT 6,A
LD HL,VRFMSG
JR NZ,PE1
LD HL,EOFMSG
BIT 7,A
; EXATRON STRINGY FLOPPY FIRMWARE FOR TRS-80 PAGE 16
RET Z
PE1 CALL PRTSTG
LD HL,ERRMSG
;
;PRINT STRING POINTED BY HL
;
PRTSTG LD A,(HL)
INC HL
PUSH AF
AND 7FH
CALL BSPRTC
POP AF
RLA
JR NC,PRTSTG
RET
;
;WRITE PREAMBLE, SYNC
; BYTE IN L AND TWO MORE
WRPRE CALL WPREAM
RET NZ
RET NZ
LD B,04H
WEWE DJNZ WEWE
JP WRTWO
;
;WRITE PREAMBLE, SYNS
; AND BYTE IN L
;*** 14 ***
WPREAM LD A,85H
LD (BSRAM),A
OUT (C),A
CALL DELAY
RET NZ
CALL WRBITS
RET NZ
NOP
JR WRBLK
WRBLK CALL WRBIT
RET NZ
RET NZ
LD B,04H
WRKWT2 DJNZ WRKWT2
LD A,(BSRAM)
AND 7FH
OUT (C),A
NOP
NOP
LD B,05H
LD D,SYNC
CALL WRBYTE
RET NZ
LD D,L
LD E,B
LD B,04H
JP WRBY
WRLOP NOP
NOP
; EXATRON STRINGY FLOPPY FIRMWARE FOR TRS-80 PAGE 17
;
;WRITE BLOCK OF HL
;POINTED BY IX
;*** 78/14 ***
WBLOCK LD D,(IX+00H)
CALL WRBYT
RET NZ
INC IX
DEC HL
LD A,H
OR L
JR NZ,WRLOP
RET NZ
LD B,01H
SUB A
SUB E
LD D,A
CALL WRBYTE
RET NZ
RET NZ
NOP
LD B,04H
CALL WRBYTE
RET NZ
RET NZ
LD B,05H
WRBY NOP
NOP
;
;WRITE BYTE IN D
;*** 13B+37/14 ***
;*** 42/14 ***
WRBYTE DJNZ WRBYTE
WRBYT LD A,(BSRAM)
OUT (C),A
LD A,D
ADD A,E
LD E,A
LD B,08H
INC HL
CALL WRBITS
DEC HL
RET NZ
RET NZ
LD B,02H
WRTWT DJNZ WRTWT
LD A,(BSRAM)
OR 80H
LD (BSRAM),A
AND 7FH
OUT (C),A
XOR A
RET
;
;WRITE B BYTES IN D
;*** 116,99,75/28 ***
WRBITL LD A,(IX+00H)
; EXATRON STRINGY FLOPPY FIRMWARE FOR TRS-80 PAGE 18
WRBITS IN A,(C)
AND 05H
RET NZ
WRBIT PUSH BC
LD A,(BSRAM)
RRC D
JR NC,WRZRO
XOR 80H
OUT (C),A
WRCLK XOR 80H
NOP