-
Notifications
You must be signed in to change notification settings - Fork 0
/
mbzx124.asm
1389 lines (1239 loc) · 27.8 KB
/
mbzx124.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
; Copyright 2024 Jean-Baptiste M. "JBQ" "Djaybee" Queru
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU Affero General Public License as
; published by the Free Software Foundation, either version 3 of the
; License, or (at your option) any later version.
;
; As an added restriction, if you make the program available for
; third parties to use on hardware you own (or co-own, lease, rent,
; or otherwise control,) such as public gaming cabinets (whether or
; not in a gaming arcade, whether or not coin-operated or otherwise
; for a fee,) the conditions of section 13 will apply even if no
; network is involved.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU Affero General Public License for more details.
;
; You should have received a copy of the GNU Affero General Public License
; along with this program. If not, see <https://www.gnu.org/licenses/>.
;
; SPDX-License-Identifier: AGPL-3.0-or-later
; Coding style:
; - ASCII
; - hard tabs, 8 characters wide, except in ASCII art
; - 2 spaces from edge to instruction
; - 1 space between instruction and parameter
; - 80 columns total
; - Per-instruction comments start at 3 tabs for assembly with
; short instructions (Z80), 4 tabs for assembly with
; long instructions (68000)
;
; - Assembler directives are .lowercase with a leading period
; - Mnemomics are lowercase when they typically read like words (move),
; UPPERCASE when they read like acronyms (DJNZ).
; - Registers are lowercase when they use multiple characters and are
; uniquely recognizable (d0), UPPERCASE when they use
; single characters (A)
; - Symbols for code are CamelCase
; - Symbols for variables are snake_case
; - Symbols for app-specific constants are ALL_CAPS
; - Symbols for OS constants, hardware registers are ALL_CAPS
; - File-specific symbols start with an underscore
; - Related symbols start with the same prefix (so they sort together)
; - Hexadecimal constants are lowercase ($eaf00d).
;
; - Include but comment out instructions that help readability but
; don't do anything (e.g. redundant CLC on 6502 when the carry is
; guaranteed already to be clear). The comment symbol should be
; where the instruction would be, i.e. not on the first column.
; There should be an explanation in a comment.
; - Use the full instruction mnemonic whenever possible, and especially
; when a shortcut would potentially cause confusion. E.g. use
; movea instead of move on 680x0 when the code relies on the
; flags not getting modified.
; #############################################################################
; #############################################################################
; ### ###
; ### ###
; ### Assembler setup directives ###
; ### ###
; ### ###
; #############################################################################
; #############################################################################
; ******************
; * zasm paramters *
; ******************
.reqcolon ; labels are required to have colons
; that way zasm can recognize non-labels
.dotnames ; labels are allowed to contain dots
; note that zasm doesn't make them local
.z80 ; We're on a ZX Spectrum
; ***************
; * output type *
; ***************
#target ram ; Create a plain binary image
; *****************
; * memory layout *
; *****************
; Contended RAM
#data screen, $4000, $1b00 ; 6 kiB of screen bitmap
#data attributes, $5800, $300 ; 0.75 kiB of screen attributes
#data slowbss, $5b00, $300 ; 0.75 kiB of ULA variables
#code slowtext, $5e00, $2200 ; 8.5 kiB of code in ULA RAM, right after BASIC
; Fast RAM
#code text, $8000, $7000 ; 28 kiB of code in CPU RAM
#data bss, $f000, $dfd ; ~3.5 kB of variables in CPU RAM
#data irqvecs, $fdfd, $104 ; ~0.25 kB for IM 2 interrupt handling
#data stack, $ff01, $ff ; ~0.25 kB of stack
; #############################################################################
; #############################################################################
; ### ###
; ### ###
; ### Boilerplate ###
; ### ###
; ### ###
; #############################################################################
; #############################################################################
#code slowtext
; #################
; ## ##
; ## Basic setup ##
; ## ##
; #################
; disable interrupts
DI
; set up stack
LD SP, 0
; ##########################
; ## ##
; ## IM 2 interrupt setup ##
; ## ##
; ##########################
; Starting at address $fe00, we have 257 bytes of $fd. That way, with the
; I register set to $fe, no matter what's on the data bus, the CPU will
; jump to address $fdfd. In turn, $fdfd contains a JP instruction to the
; real interrupt handler.
;
; It's a nice fit, the JP instruction takes exactly the top 3 of the page
; at $fd, the $fe page is filled, and the first byte of the $ff page is
; used, which leaves space for a 255-byte stack in the $ff page.
LD HL, $fdfd ; Start to write data at $fdfd
; Write the JP instruction
LD A, opcode(JP nn)
LD (HL), A ; Write the JP opcode
INC L ; HL is now $fdfe
LD DE, IrqVbl
LD (HL), E ; Little-endian, write low byte first
INC L ; HL is now $fdff
LD (HL), D ; write high byte
INC HL ; HL is now $fe00
; Write the first 256 bytes of the IM 2 vectors
LD A, $fd
LD B, L ; L is $00, so B is 0, i.e. loop 256 times
SetIrq:
LD (HL), A
INC L ; We're staying within the same page
DJNZ SetIrq
; Write the last byte of the IM 2 vectors
INC H ; HL was $fe00 (L had wrapped around), now $ff00
LD (HL), A
; Set up interrupt control vector register
LD A, $fe
LD I, A
; Enable interrupts in mode 2
IM 2
EI
; ##########################
; ## ##
; ## Wait half a second ##
; ## ##
; ## To see splash screen ##
; ## on emulators ##
; ## ##
; ##########################
LD B, 25
Pause:
HALT
DJNZ Pause
; ######################
; ## ##
; ## Clear the screen ##
; ## ##
; ######################
; Wait for VBL to avoid tearing
HALT
; Set black border
XOR A ; Cheap way to clear A
OUT ($fe), A
; Clear attribute block
; Do it first so that the screen appears all black in a single frame
XOR A
LD HL, attributes
LD B, 3
ClearAttributes:
LD (HL), A
INC L
JR NZ, ClearAttributes ; Here JP would be faster but bigger
INC H
DJNZ ClearAttributes
; Clear screen block
XOR A
LD HL, screen
LD B, 24
ClearScreen:
LD (HL), A
INC L
JR NZ, ClearScreen ; Here JP would be faster but bigger
INC H
DJNZ ClearScreen
; Set attributes
LD HL, attributes
LD D, 3
SetScreen0:
LD B, 8
SetScreen1:
LD A, %01011111
.rept 2
LD (HL), A
INC L
.endm
LD A, %01010111
.rept 6
LD (HL), A
INC L
.endm
DJNZ SetScreen1
LD B, 24
SetScreen2:
LD A, %01001111
.rept 2
LD (HL), A
INC L
.endm
LD A, %01000111
.rept 6
LD (HL), A
INC L
.endm
DJNZ SetScreen2
INC H
DEC D
JR NZ, SetScreen0
JP MainLoop ; The rest of the code is in non-contended RAM
; #############################################################################
; #############################################################################
; ### ###
; ### ###
; ### Main loop ###
; ### ###
; ### ###
; #############################################################################
; #############################################################################
; Design goal:
; - various display elements as pseudo-bitplanes in paper attribute
; * scrolltext, middle third, probably green because it's brighter
; * vertical and horizontal bars
; * brightness as a spotlight
; - some bitmaps, technically that can exist anywhere on screen, using the
; ink color. Top and bottom thirds are good candidates because the
; scrolltext isn't there, and because they're easier to use when
; racing the beam.
; Optimization-driven design:
; - Use the fact that the screen is split into 3 slices, and that code that
; doesn't cross between slices can be made simpler. This is true for
; both the bitmap and the attributes. In practice, make the attribute
; scrolltext fill exactly the middle slice.
; - Make the vertical and horizontal bars move by at most one block per frame.
; That way, they can be drawn incrementally.
; Drawing the vertical and horizontal bars:
; - Draw line by line
; - 4 types of line, based on status of horizontal bars:
; * off -> off
; * off -> on
; * on -> off
; * on -> on
; - 3 actions for vertical bars:
; * move left
; * move right
; * no move
; * with 8 possible horizontal positions for each (?)
#code text ; This code is is non-contended RAM
MainLoop:
HALT ; Wait for a VBL
; There's a little bit of trickery here, though I don't think it's as
; uncommon a technique as it seems.
;
; The first step of the trickery is to compute the list of routines to call
; before calling them, and to store those on the stack (which means that they
; need to be in reverse order). That way, there's less back-and-forth
; between the code that figures out which routines to call and the actual
; code of those routines, i.e. there's less clobbering of registers.
;
; The second step of the trickery is to realize that calling a sequence
; of subroutines is annoying. It should look like a POP HL / CALL (HL),
; but that latter instruction doesn't exist, the sequence is instead
; POP HL / CALL nn / JP (HL), 31 cycles total, with each subroutine finishing
; with a RET which takes 10 cycles for a total of 41 cycles. It is instead
; better for each subroutine to jump to the next one directly,
; i.e. POP HL / JP (HL), which takes 14 cycles. Note that doing things this
; way also requires some special care so that the last subroutine in the list
; returns to the caller properly.
;
; The third step of the trickery is to realize that the POP HL / JP (HL)
; is in reality the RET instruction, which is a fancy name for POP PC.
; That instruction only takes 10 cycles (it's a POP after all, so it
; takes the same duration as a plain POP since the Z80 doesn't prefetch),
; and doesn't clobber any register.
;
; The trickery as a whole is therefore to PUSH the continuation address on
; the stack, followed by the addresses of the various subroutines to call,
; in reverse order. Calling the first subroutine happens with a RET,
; each subroutine calls the next with a RET, and the last one returns to
; the main flow also with a RET (so the last subroutine exits like the other
; ones and therefore doesn't need anything special).
;
; Folks working with some RISC processors probably recognize some of those
; patterns. Also, the approach of mismatching CALL and RET instruction
; breaks speculative execution on modern processors, and is therefore used
; to mitigate vulnerabilities that rely on speculative execution, e.g.
; Meltdown and Spectre.
; ################################
; ## ##
; ## Update display coordinates ##
; ## ##
; ################################
LD HL, vbars_x
LD A, (HL)
DEC A
AND 7
; LD (HL), A
LD HL, text_x
LD A, (HL)
INC A
AND 31
; LD (HL), A
LD HL, sprite_x
LD A, (HL)
DEC A
JP P, SpriteNoWrap
LD A, 30
SpriteNoWrap:
LD (HL), A
; ######################################
; ## ##
; ## Draw the top third of the screen ##
; ## ##
; ######################################
; Push the address we'll jump to once we're done
LD HL, TopDone
PUSH HL
; Compute the address of the routine that matches the bars' X coordinate
LD A, (vbars_x)
ADD A
LD E, A
LD D, 0
LD HL, DrawVList
ADD HL, DE
LD E, (HL)
INC HL
LD D, (HL)
; Write the computed address 8 times on the stack
.rept 8
; PUSH DE
.endm
LD HL, DrawHVLeft0
; Prepare parameters for subroutines
LD HL, attributes ; Destination address
LD DE, 6 ; must be 6, to skip unchanged columns
LD BC, $0800 ; the colors we write, B then C
; Jump to the first routine
RET
TopDone:
; Draw a timing line
LD A, 1
OUT ($fe), A
LD B, 16
Wait1:
DJNZ Wait1
LD A, 0
OUT ($fe), A
; #########################################
; ## ##
; ## Draw the middle third of the screen ##
; ## ##
; #########################################
; Push the address we'll jump to once we're done
LD HL, MiddleDone
PUSH HL
; Compute the address of the routine that matches the bars' X coordinate
LD A, (vbars_x)
ADD A
ADD A
LD E, A
LD D, 0
LD HL, DrawTextList
ADD HL, DE
LD E, (HL)
INC HL
LD D, (HL)
INC HL
LD C, (HL)
INC HL
LD B, (HL)
LD HL, TextNextPage
; Write the computed address 8 times on the stack
PUSH DE
PUSH DE
PUSH DE
PUSH DE
PUSH HL
PUSH DE
PUSH DE
PUSH BC
PUSH BC
; Prepare parameters for subroutines
LD HL, Logo ; Source address
LD A, (text_x)
LD L, A
LD DE, attributes + $100 ; Destination address
; Jump to the first routine
RET
MiddleDone:
; Draw a timing line
LD A, 2
OUT ($fe), A
LD B, 16
Wait2:
DJNZ Wait2
LD A, 0
OUT ($fe), A
; #########################################
; ## ##
; ## Draw the bottom third of the screen ##
; ## ##
; #########################################
LD HL, BottomDone
PUSH HL
LD A, (vbars_x)
ADD A
LD E, A
LD D, 0
LD HL, DrawVList
ADD HL, DE
LD E, (HL)
INC HL
LD D, (HL)
.rept 8
; PUSH DE
.endm
LD HL, attributes + $200
LD DE, 6
LD BC, $0800
RET
BottomDone:
LD A, 3
OUT ($fe), A
LD B, 16
Wait3:
DJNZ Wait3
LD A, 0
OUT ($fe), A
LD HL, SpriteWilly + 16
LD DE, $5000
LD A, (sprite_x)
ADD E
LD E, A
LD A, 6
ADD A
ADD A
ADD A
ADD A
ADD A
ADD E
LD E, A
LD C, 2
SpriteDrawX:
PUSH DE
LD B, 2
SpriteDrawY:
.rept 8
LD A, (HL)
INC L
LD (DE), A
INC D
.endm
LD A, E
ADD 32
LD E, A
LD A, D
SUB 8
LD D, A
DJNZ SpriteDrawY
POP DE
INC E
DEC C
JR NZ, SpriteDrawX
JP MainLoop
; #############################################################################
; #############################################################################
; ### ###
; ### ###
; ### Drawing subroutines ###
; ### ###
; ### ###
; #############################################################################
; #############################################################################
; ################################
; ## ##
; ## Horizontal bars off -> off ##
; ## ##
; ################################
; Parameters:
; HL: address where to write
; B: contains 0 (color of background)
; C: contains 8 (color of vertical bars)
; DE contains 6 (offset between colums)
; B.C.....
DrawVLeft0:
.rept 4
LD (HL), B
INC L
INC L
LD (HL), C
ADD HL, DE
.endm
RET
; .B.C....
DrawVLeft1:
INC L
.rept 3
LD (HL), B
INC L
INC L
LD (HL), C
ADD HL, DE
.endm
LD (HL), B
INC L
INC L
LD (HL), C
LD A, L
ADD 5
LD L, A
RET
; ..B.C...
DrawVLeft2:
INC L
INC L
.rept 3
LD (HL), B
INC L
INC L
LD (HL), C
ADD HL, DE
.endm
LD (HL), B
INC L
INC L
LD (HL), C
LD A, L
ADD 4
LD L, A
RET
; ...B.C..
DrawVLeft3:
INC L
INC L
INC L
.rept 3
LD (HL), B
INC L
INC L
LD (HL), C
ADD HL, DE
.endm
LD (HL), B
INC L
INC L
LD (HL), C
INC L
INC L
INC L
RET
; ....B.C.
DrawVLeft4:
LD A, L
ADD 4
LD L, A
.rept 3
LD (HL), B
INC L
INC L
LD (HL), C
ADD HL, DE
.endm
LD (HL), B
INC L
INC L
LD (HL), C
INC L
INC L
RET
; .....B.C
DrawVLeft5:
LD A, L
ADD 5
LD L, A
.rept 3
LD (HL), B
INC L
INC L
LD (HL), C
ADD HL, DE
.endm
LD (HL), B
INC L
INC L
LD (HL), C
INC L
RET
; C.....B.
DrawVLeft6:
.rept 4
LD (HL), C
ADD HL, DE
LD (HL), B
INC L
INC L
.endm
RET
; .C.....B
DrawVLeft7:
.rept 4
INC L
LD (HL), C
ADD HL, DE
LD (HL), B
INC L
.endm
RET
DrawVList:
.dw DrawVLeft0, DrawVLeft1, DrawVLeft2, DrawVLeft3
.dw DrawVLeft4, DrawVLeft5, DrawVLeft6, DrawVLeft7
; BBCCCCCC
DrawHVLeft0:
.rept 4
.rept 2
LD (HL), B
INC L
.endm
.rept 6
LD (HL), C
INC L
.endm
.endm
RET
; ########################################
; ## ##
; ## Scrolltext without horizontal bars ##
; ## ##
; ########################################
; Parameters/return:
; ABC: ignored/clobbered
; DE: destination address
; HL: source address
; ****************************************
; ** Vertical bars at positions 0 and 1 **
; ****************************************
TextVBar01:
.rept 4
.rept 2
LD A, (HL)
OR 8
LD (DE), A
INC L
INC E
.endm
.rept 6
LDI
.endm
.endm
LD A, L
ADD 32
LD L, A
RET
; ****************************************
; ** Vertical bars at positions 1 and 2 **
; ****************************************
TextVBar12:
.rept 4
LDI
.rept 2
LD A, (HL)
OR 8
LD (DE), A
INC L
INC E
.endm
.rept 5
LDI
.endm
.endm
LD A, L
ADD 32
LD L, A
RET
; ****************************************
; ** Vertical bars at positions 2 and 3 **
; ****************************************
TextVBar23:
.rept 4
.rept 2
LDI
.endm
.rept 2
LD A, (HL)
OR 8
LD (DE), A
INC L
INC E
.endm
.rept 4
LDI
.endm
.endm
LD A, L
ADD 32
LD L, A
RET
; ****************************************
; ** Vertical bars at positions 3 and 4 **
; ****************************************
TextVBar34:
.rept 4
.rept 3
LDI
.endm
.rept 2
LD A, (HL)
OR 8
LD (DE), A
INC L
INC E
.endm
.rept 3
LDI
.endm
.endm
LD A, L
ADD 32
LD L, A
RET
; ****************************************
; ** Vertical bars at positions 4 and 5 **
; ****************************************
TextVBar45:
.rept 4
.rept 4
LDI
.endm
.rept 2
LD A, (HL)
OR 8
LD (DE), A
INC L
INC E
.endm
.rept 2
LDI
.endm
.endm
LD A, L
ADD 32
LD L, A
RET
; ****************************************
; ** Vertical bars at positions 5 and 6 **
; ****************************************
TextVBar56:
.rept 4
.rept 5
LDI
.endm
.rept 2
LD A, (HL)
OR 8
LD (DE), A
INC L
INC E
.endm
LDI
.endm
LD A, L
ADD 32
LD L, A
RET
; ****************************************
; ** Vertical bars at positions 6 and 7 **
; ****************************************
TextVBar67:
.rept 4
.rept 6
LDI
.endm
.rept 2
LD A, (HL)
OR 8
LD (DE), A
INC L
INC E
.endm
.endm
LD A, L
ADD 32
LD L, A
RET
; ****************************************
; ** Vertical bars at positions 7 and 0 **
; ****************************************
TextVBar70:
.rept 4
LD A, (HL)
OR 8
LD (DE), A
INC L
INC E
.rept 6
LDI
.endm
LD A, (HL)
OR 8
LD (DE), A
INC L
INC E
.endm
LD A, L
ADD 32
LD L, A
RET
; ########################################
; ## ##
; ## Scrolltext without horizontal bars ##
; ## ##
; ########################################
; Parameters/return:
; ABC: ignored/clobbered
; DE: destination address
; HL: source address
; ****************************************
; ** Vertical bars at positions 0 and 1 **
; ****************************************
TextHVBar01:
LD BC, $1810
.rept 4
.rept 2
LD A, (HL)
OR B
LD (DE), A
INC L
INC E
.endm
.rept 6
LD A, (HL)
OR C
LD (DE), A
INC L
INC E
.endm
.endm
LD A, L
ADD 32
LD L, A
RET
; ****************************************
; ** Vertical bars at positions 1 and 2 **
; ****************************************
TextHVBar12:
LD BC, $1810
.rept 4
LD A, (HL)
OR C
LD (DE), A
INC L
INC E
.rept 2
LD A, (HL)
OR B
LD (DE), A
INC L
INC E
.endm
.rept 5
LD A, (HL)
OR C
LD (DE), A
INC L
INC E
.endm
.endm
LD A, L
ADD 32
LD L, A
RET
; ****************************************
; ** Vertical bars at positions 2 and 3 **
; ****************************************
TextHVBar23:
LD BC, $1810