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
|
SendScreenToPrinter:
.loop
call JoyTextDelay
call CheckCancelPrint
jr c, .cancel
ld a, [wJumptableIndex]
bit 7, a
jr nz, .finished
call PrinterJumptableIteration
call CheckPrinterStatus
call PlacePrinterStatusString
call DelayFrame
jr .loop
.finished
and a
ret
.cancel
scf
ret
Printer_CleanUpAfterSend:
xor a
ld [wPrinterConnectionOpen], a
ld [wPrinterOpcode], a
ret
Printer_PrepareTilemapForPrint:
push af
call Printer_StartTransmission
pop af
ld [wPrinterMargins], a
call Printer_CopyTilemapToBuffer
ret
Printer_ExitPrinter:
call ReturnToMapFromSubmenu
call Printer_RestartMapMusic
ret
PrintDexEntry:
ld a, [wPrinterQueueLength]
push af
ld hl, vTiles1
ld de, FontInversed
lb bc, BANK(FontInversed), $80
call Request1bpp
xor a
ldh [hPrinter], a
call Printer_PlayMusic
ldh a, [rIE]
push af
xor a
ldh [rIF], a
ld a, (1 << SERIAL) | (1 << VBLANK)
ldh [rIE], a
call Printer_StartTransmission
ln a, 1, 0
ld [wPrinterMargins], a
farcall PrintPage1
call ClearTilemap
ld a, %11100100
call DmgToCgbBGPals
call DelayFrame
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], 4 ; vblank mode that calls AskSerial
ld a, 8 ; 16 rows
ld [wPrinterQueueLength], a
call Printer_ResetJoypadRegisters
call SendScreenToPrinter
jr c, .skip_second_page ; canceled or got an error
call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
xor a
ldh [hBGMapMode], a
call Printer_StartTransmission
ln a, 0, 3
ld [wPrinterMargins], a
farcall PrintPage2
call Printer_ResetJoypadRegisters
ld a, 4
ld [wPrinterQueueLength], a
call SendScreenToPrinter
.skip_second_page
pop af
ldh [hVBlank], a
call Printer_CleanUpAfterSend
xor a
ldh [rIF], a
pop af
ldh [rIE], a
call Printer_ExitPrinter
ld c, 8
.low_volume_delay_frames
call LowVolume
call DelayFrame
dec c
jr nz, .low_volume_delay_frames
pop af
ld [wPrinterQueueLength], a
ret
PrintPCBox:
ld a, [wPrinterQueueLength]
push af
ld a, 18 / 2
ld [wPrinterQueueLength], a
ld a, e
ld [wAddrOfBoxToPrint], a
ld a, d
ld [wAddrOfBoxToPrint + 1], a
ld a, b
ld [wBankOfBoxToPrint], a
ld a, c
ld [wWhichBoxToPrint], a
xor a
ldh [hPrinter], a
ld [wFinishedPrintingBox], a
call Printer_PlayMusic
ldh a, [rIE]
push af
xor a
ldh [rIF], a
ld a, (1 << SERIAL) | (1 << VBLANK)
ldh [rIE], a
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], 4 ; vblank mode that calls AskSerial
xor a
ldh [hBGMapMode], a
call PrintPCBox_Page1
ln a, 1, 0 ; to be loaded to wPrinterMargins
call Printer_PrepareTilemapForPrint
call Printer_ResetRegistersAndStartDataSend
jr c, .cancel
call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
xor a
ldh [hBGMapMode], a
call PrintPCBox_Page2
ln a, 0, 0 ; to be loaded to wPrinterMargins
call Printer_PrepareTilemapForPrint
call Printer_ResetRegistersAndStartDataSend
jr c, .cancel
call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
xor a
ldh [hBGMapMode], a
call PrintPCBox_Page3
ln a, 0, 0 ; to be loaded to wPrinterMargins
call Printer_PrepareTilemapForPrint
call Printer_ResetRegistersAndStartDataSend
jr c, .cancel
call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
xor a
ldh [hBGMapMode], a
call PrintPCBox_Page4
ln a, 0, 3 ; to be loaded to wPrinterMargins
call Printer_PrepareTilemapForPrint
call Printer_ResetRegistersAndStartDataSend
.cancel
pop af
ldh [hVBlank], a
call Printer_CleanUpAfterSend
xor a
ldh [rIF], a
pop af
ldh [rIE], a
call Printer_ExitPrinter
pop af
ld [wPrinterQueueLength], a
ret
Printer_ResetRegistersAndStartDataSend:
call Printer_ResetJoypadRegisters
call SendScreenToPrinter
ret
PrintUnownStamp:
ld a, [wPrinterQueueLength]
push af
xor a
ldh [hPrinter], a
call Printer_PlayMusic
ldh a, [rIE]
push af
xor a
ldh [rIF], a
ld a, (1 << SERIAL) | (1 << VBLANK)
ldh [rIE], a
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], 4 ; vblank mode that calls AskSerial
xor a
ldh [hBGMapMode], a
call LoadTilemapToTempTilemap
farcall PlaceUnownPrinterFrontpic
ln a, 0, 0 ; to be loaded to wPrinterMargins
call Printer_PrepareTilemapForPrint
call SafeLoadTempTilemapToTilemap
call Printer_ResetJoypadRegisters
ld a, 18 / 2
ld [wPrinterQueueLength], a
.loop
call JoyTextDelay
call CheckCancelPrint
jr c, .done
ld a, [wJumptableIndex]
bit 7, a
jr nz, .done
call PrinterJumptableIteration
ld a, [wJumptableIndex]
cp $2
jr nc, .check_status
ld a, 6 / 2
ld [wPrinterRowIndex], a
.check_status
call CheckPrinterStatus
call PlacePrinterStatusString
call DelayFrame
jr .loop
.done
pop af
ldh [hVBlank], a
call Printer_CleanUpAfterSend
call SafeLoadTempTilemapToTilemap
xor a
ldh [rIF], a
pop af
ldh [rIE], a
pop af
ld [wPrinterQueueLength], a
ret
PrintMailAndExit:
call PrintMail
call Printer_ExitPrinter
ret
PrintMail:
ld a, [wPrinterQueueLength]
push af
xor a
ldh [hPrinter], a
call Printer_PlayMusic
ldh a, [rIE]
push af
xor a
ldh [rIF], a
ld a, (1 << SERIAL) | (1 << VBLANK)
ldh [rIE], a
xor a
ldh [hBGMapMode], a
ln a, 1, 3 ; to be loaded to wPrinterMargins
call Printer_PrepareTilemapForPrint
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], 4 ; vblank mode that calls AskSerial
ld a, 18 / 2
ld [wPrinterQueueLength], a
call SendScreenToPrinter
pop af
ldh [hVBlank], a
call Printer_CleanUpAfterSend
call Printer_CopyBufferToTilemap
xor a
ldh [rIF], a
pop af
ldh [rIE], a
pop af
ld [wPrinterQueueLength], a
ret
PrintPartymon:
ld a, [wPrinterQueueLength]
push af
xor a
ldh [hPrinter], a
call Printer_PlayMusic
ldh a, [rIE]
push af
xor a
ldh [rIF], a
ld a, (1 << SERIAL) | (1 << VBLANK)
ldh [rIE], a
xor a
ldh [hBGMapMode], a
farcall PrintPartyMonPage1
ln a, 1, 0 ; to be loaded to wPrinterMargins
call Printer_PrepareTilemapForPrint
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], 4 ; vblank mode that calls AskSerial
ld a, 16 / 2
ld [wPrinterQueueLength], a
call Printer_ResetJoypadRegisters
call SendScreenToPrinter
jr c, .cancel
call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
xor a
ldh [hBGMapMode], a
farcall PrintPartyMonPage2
ln a, 0, 3 ; to be loaded to wPrinterMargins
call Printer_PrepareTilemapForPrint
ld a, 18 / 2
ld [wPrinterQueueLength], a
call Printer_ResetJoypadRegisters
call SendScreenToPrinter
.cancel
pop af
ldh [hVBlank], a
call Printer_CleanUpAfterSend
call Printer_CopyBufferToTilemap
xor a
ldh [rIF], a
pop af
ldh [rIE], a
call Printer_ExitPrinter
pop af
ld [wPrinterQueueLength], a
ret
_PrintDiploma:
ld a, [wPrinterQueueLength]
push af
farcall PlaceDiplomaOnScreen
xor a
ldh [hPrinter], a
call Printer_PlayMusic
ldh a, [rIE]
push af
xor a
ldh [rIF], a
ld a, (1 << SERIAL) | (1 << VBLANK)
ldh [rIE], a
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], 4 ; vblank mode that calls AskSerial
ln a, 1, 0 ; to be loaded to wPrinterMargins
call Printer_PrepareTilemapForPrint
call Printer_ResetJoypadRegisters
ld a, 18 / 2
ld [wPrinterQueueLength], a
call SendScreenToPrinter
jr c, .cancel
call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
call LoadTilemapToTempTilemap
xor a
ldh [hBGMapMode], a
farcall PrintDiplomaPage2
ln a, 0, 3 ; to be loaded to wPrinterMargins
call Printer_PrepareTilemapForPrint
call SafeLoadTempTilemapToTilemap
call Printer_ResetJoypadRegisters
ld a, 18 / 2
ld [wPrinterQueueLength], a
call SendScreenToPrinter
.cancel
pop af
ldh [hVBlank], a
call Printer_CleanUpAfterSend
xor a
ldh [rIF], a
pop af
ldh [rIE], a
call Printer_ExitPrinter
pop af
ld [wPrinterQueueLength], a
ret
CheckCancelPrint:
ldh a, [hJoyDown]
and B_BUTTON
jr nz, .pressed_b
and a
ret
.pressed_b
ld a, [wUnusedGameboyPrinterSafeCancelFlag]
cp $0c
jr nz, .cancel
; wait for printer activity to finish before canceling?
.loop
ld a, [wPrinterOpcode]
and a
jr nz, .loop
ld a, $16 ; cancel
ld [wPrinterOpcode], a
ld a, $88
ldh [rSB], a
ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
.loop2
ld a, [wPrinterOpcode]
and a
jr nz, .loop2
.cancel
ld a, $1
ldh [hPrinter], a
scf
ret
Printer_CopyTilemapToBuffer:
hlcoord 0, 0
ld de, wPrinterTilemapBuffer
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
ret
Printer_CopyBufferToTilemap:
ld hl, wPrinterTilemapBuffer
decoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
ret
Printer_ResetJoypadRegisters:
xor a
ldh [hJoyReleased], a
ldh [hJoyPressed], a
ldh [hJoyDown], a
ldh [hJoyLast], a
ret
Printer_PlayMusic:
ld de, MUSIC_PRINTER
call PlayMusic2
ret
Printer_RestartMapMusic:
call RestartMapMusic
ret
CheckPrinterStatus:
; Check for printer errors
; If [wPrinterHandshake] == -1, we're disconnected
ld a, [wPrinterHandshake]
cp -1
jr nz, .printer_connected
ld a, [wPrinterStatusFlags]
cp -1
jr z, .error_2
.printer_connected
ld a, [wPrinterStatusFlags]
and %11100000
ret z ; no error
bit 7, a
jr nz, .error_1
bit 6, a
jr nz, .error_4
; paper error
ld a, PRINTER_ERROR_3
jr .load_text_index
.error_4
; temperature error
ld a, PRINTER_ERROR_4
jr .load_text_index
.error_1
; printer battery low
ld a, PRINTER_ERROR_1
jr .load_text_index
.error_2
; connection error
ld a, PRINTER_ERROR_2
.load_text_index
ld [wPrinterStatus], a
ret
PlacePrinterStatusString:
; Print nonzero printer status
ld a, [wPrinterStatus]
and a
ret z
push af
xor a
ldh [hBGMapMode], a
hlcoord 0, 5
lb bc, 10, 18
call Textbox
pop af
ld e, a
ld d, 0
ld hl, PrinterStatusStringPointers
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
hlcoord 1, 7
ld a, BANK(GBPrinterStrings)
call PlaceFarString
hlcoord 2, 15
ld de, String_PressBToCancel
call PlaceString
ld a, $1
ldh [hBGMapMode], a
xor a
ld [wPrinterStatus], a
ret
PlacePrinterStatusStringBorderless: ; unreferenced
; Similar to PlacePrinterStatusString, but with different hlcoords
; and ClearBox instead of TextBox.
ld a, [wPrinterStatus]
and a
ret z
push af
xor a
ldh [hBGMapMode], a
hlcoord 2, 4
lb bc, 13, 16
call ClearBox
pop af
ld e, a
ld d, 0
ld hl, PrinterStatusStringPointers
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
hlcoord 4, 7
ld a, BANK(GBPrinterStrings)
call PlaceFarString
hlcoord 4, 15
ld de, String_PressBToCancel
call PlaceString
ld a, $1
ldh [hBGMapMode], a
xor a
ld [wPrinterStatus], a
ret
String_PressBToCancel:
db "Press B to Cancel@"
PrinterStatusStringPointers:
dw GBPrinterString_Null ; @
dw GBPrinterString_CheckingLink ; CHECKING LINK
dw GBPrinterString_Transmitting ; TRANSMITTING
dw GBPrinterString_Printing ; PRINTING
dw GBPrinterString_PrinterError1 ; error 1
dw GBPrinterString_PrinterError2 ; error 2
dw GBPrinterString_PrinterError3 ; error 3
dw GBPrinterString_PrinterError4 ; error 4
PrintPCBox_Page1:
xor a
ld [wWhichBoxMonToPrint], a
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
call ByteFill
call Printer_PlaceEmptyBoxSlotString
hlcoord 0, 0
ld bc, 9 * SCREEN_WIDTH
ld a, " "
call ByteFill
call Printer_PlaceSideBorders
call Printer_PlaceTopBorder
hlcoord 4, 3
ld de, .String_PokemonList
call PlaceString
ld a, [wWhichBoxToPrint]
ld bc, BOX_NAME_LENGTH
ld hl, wBoxNames
call AddNTimes
ld d, h
ld e, l
hlcoord 6, 5
call PlaceString
ld a, 1
call Printer_GetBoxMonSpecies
hlcoord 2, 9
ld c, 3
call Printer_PrintBoxListSegment
ret
.String_PokemonList:
db "#MON LIST@"
PrintPCBox_Page2:
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
call ByteFill
call Printer_PlaceEmptyBoxSlotString
call Printer_PlaceSideBorders
ld a, [wFinishedPrintingBox]
and a
ret nz
ld a, 4
call Printer_GetBoxMonSpecies
hlcoord 2, 0
ld c, 6
call Printer_PrintBoxListSegment
ret
PrintPCBox_Page3:
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
call ByteFill
call Printer_PlaceEmptyBoxSlotString
call Printer_PlaceSideBorders
ld a, [wFinishedPrintingBox]
and a
ret nz
ld a, 10
call Printer_GetBoxMonSpecies
hlcoord 2, 0
ld c, 6
call Printer_PrintBoxListSegment
ret
PrintPCBox_Page4:
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
call ByteFill
call Printer_PlaceEmptyBoxSlotString
hlcoord 1, 15
lb bc, 2, 18
call ClearBox
call Printer_PlaceSideBorders
call Printer_PlaceBottomBorders
ld a, [wFinishedPrintingBox]
and a
ret nz
ld a, 16
call Printer_GetBoxMonSpecies
hlcoord 2, 0
ld c, 5
call Printer_PrintBoxListSegment
ret
Printer_PrintBoxListSegment:
ld a, [wBankOfBoxToPrint]
call OpenSRAM
.loop
ld a, c
and a
jp z, .max_length
dec c
ld a, [de]
cp $ff
jp z, .finish
ld [wNamedObjectIndex], a
ld [wCurPartySpecies], a
push bc
push hl
push de
push hl
ld bc, 16
ld a, " "
call ByteFill
pop hl
push hl
call GetBasePokemonName
pop hl
push hl
call PlaceString
ld a, [wCurPartySpecies]
cp EGG
pop hl
jr z, .ok2
ld bc, MON_NAME_LENGTH
add hl, bc
call Printer_GetMonGender
ld bc, SCREEN_WIDTH - MON_NAME_LENGTH
add hl, bc
ld a, "/"
ld [hli], a
push hl
ld bc, 14
ld a, " "
call ByteFill
pop hl
push hl
ld a, [wAddrOfBoxToPrint]
ld l, a
ld a, [wAddrOfBoxToPrint + 1]
ld h, a
ld bc, sBoxMonNicknames - sBox
add hl, bc
ld bc, MON_NAME_LENGTH
ld a, [wWhichBoxMonToPrint]
call AddNTimes
ld e, l
ld d, h
pop hl
push hl
call PlaceString
pop hl
ld bc, MON_NAME_LENGTH
add hl, bc
push hl
ld a, [wAddrOfBoxToPrint]
ld l, a
ld a, [wAddrOfBoxToPrint + 1]
ld h, a
ld bc, 2 + MONS_PER_BOX + MON_LEVEL
add hl, bc
ld bc, BOXMON_STRUCT_LENGTH
ld a, [wWhichBoxMonToPrint]
call AddNTimes
ld a, [hl]
pop hl
call PrintLevel_Force3Digits
.ok2
ld hl, wWhichBoxMonToPrint
inc [hl]
pop de
pop hl
ld bc, 3 * SCREEN_WIDTH
add hl, bc
pop bc
inc de
jp .loop
.finish
ld a, $1
ld [wFinishedPrintingBox], a
.max_length
call CloseSRAM
ret
Printer_GetMonGender:
push hl
ld a, [wAddrOfBoxToPrint]
ld l, a
ld a, [wAddrOfBoxToPrint + 1]
ld h, a
ld bc, 2 + MONS_PER_BOX + MON_DVS
add hl, bc
ld bc, BOXMON_STRUCT_LENGTH
ld a, [wWhichBoxMonToPrint]
call AddNTimes
ld de, wTempMonDVs
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
ld a, [wWhichBoxMonToPrint]
ld [wCurPartyMon], a
ld a, TEMPMON
ld [wMonType], a
farcall GetGender
ld a, " "
jr c, .got_gender
ld a, "♂"
jr nz, .got_gender
ld a, "♀"
.got_gender
pop hl
ld [hli], a
ret
Printer_GetBoxMonSpecies:
push hl
ld e, a
ld d, 0
ld a, [wAddrOfBoxToPrint]
ld l, a
ld a, [wAddrOfBoxToPrint + 1]
ld h, a
add hl, de
ld e, l
ld d, h
pop hl
ret
Printer_PlaceTopBorder:
hlcoord 0, 0
ld a, "┌"
ld [hli], a
ld a, "─"
ld c, SCREEN_WIDTH - 2
.loop
ld [hli], a
dec c
jr nz, .loop
ld a, "┐"
ld [hl], a
ret
Printer_PlaceSideBorders:
hlcoord 0, 0
ld de, SCREEN_WIDTH - 1
ld c, SCREEN_HEIGHT
.loop
ld a, "│"
ld [hl], a
add hl, de
ld a, "│"
ld [hli], a
dec c
jr nz, .loop
ret
Printer_PlaceBottomBorders:
hlcoord 0, 17
ld a, "└"
ld [hli], a
ld a, "─"
ld c, SCREEN_WIDTH - 2
.loop
ld [hli], a
dec c
jr nz, .loop
ld a, "┘"
ld [hl], a
ret
Printer_PlaceEmptyBoxSlotString:
hlcoord 2, 0
ld c, 6
.loop
push bc
push hl
ld de, .EmptyBoxSlotString
call PlaceString
pop hl
ld bc, 3 * SCREEN_WIDTH
add hl, bc
pop bc
dec c
jr nz, .loop
ret
.EmptyBoxSlotString:
db " ------@"
|