InitDisplay:
push AF
push BC
push HL
ld HL,System_set_cmd
call InitSeqDisp
ld HL,Scroll_cmd
call InitSeqDisp
ld HL,HDot_scr_cmd
call InitSeqDisp
ld HL,Overlay_cmd
call InitSeqDisp
ld HL,CursorForm_cmd
call InitSeqDisp
call ClearDisplay
ld HL,Display_ON_cmd
call InitSeqDisp
ld A,(CopyRegCommands)
and A,0f6h
or A,0ah ; ‚Є«о票Ґ Ї®¤бўҐвЄЁ Ё а бва .
out (RegCommands),A
ld (CopyRegCommands),A
xor A
ld (X),A
ld (Y),A
pop HL
pop BC
pop AF
ret
InitSeqDisp:
ld A,(HL)
out (ConRegDisp),A
inc HL
ld B,(HL)
inc HL
InitSeqDisp_1:
ld A,(HL)
out (DatRegDisp),A
inc HL
djnz InitSeqDisp_1
ret
System_set_cmd db 40h ; SYSTEM SET.
db 08h ; Љ®«ЁзҐбвў® Ї а ¬Ґва®ў.
db 30h ; P1
db 87h ; P2
db 07h ; P3
db 27h ; P4
db 2bh ; P5
db 0efh ; P6
db 28h ; P7
db 00h ; P8
Scroll_cmd db 44h ; SCROLL.
db 03h ; Љ®«ЁзҐбвў® Ї а ¬Ґва®ў.
db 00h ; P1
db 00h ; P2
db 0f0h ; P3
HDot_scr_cmd db 5ah ; HDOT SCR.
db 01h ; Љ®«ЁзҐбвў® Ї а ¬Ґва®ў.
db 00h ; P1
Overlay_cmd db 5bh ; OVLAY.
db 01h ; Љ®«ЁзҐбвў® Ї а ¬Ґва®ў.
db 04h ; P1
CursorForm_cmd db 5dh ; CSRFORM.
db 02h ; Љ®«ЁзҐбвў® Ї а ¬Ґва®ў.
db 07h ; P1
db 87h ; P2
Display_ON_cmd db 59h ; DISP ON
db 01h ; Љ®«ЁзҐбвў® Ї а ¬Ґва®ў.
db 04h ; P1
ClearDisplay:
push AF
push BC
push HL
ld HL,CursorWGr_cmd
call InitSeqDisp
ld A,4ch
out (ConRegDisp),A
ld A,42h
out (ConRegDisp),A
ld C,240
xor A
ClearDisplay_1:
ld B,40
ClearDisplay_2:
out (DatRegDisp),A
djnz ClearDisplay_2
dec C
jr nz,ClearDisplay_1
pop HL
pop BC
pop AF
ret
CursorWGr_cmd db 46h
db 02h
db 00h
db 00h
PrintChar:
push AF
push BC
push DE
push HL
ld C,A
ld A,(X)
cp 28h
jr nc,PrintChar_2
ld A,(Y)
cp 0fh
jr nc,PrintChar_2
ld L,A ; HL=Y*640.
ld H,00h
sla L
sla L
sla L
sla L
sla L
rl H
sla L
rl H
sla L
rl H
push HL
sla L
rl H
sla L
rl H
pop DE
add HL,DE
ld A,(X) ; HL=HL+X
ld E,A
ld D,00h
add HL,DE
ld A,46h ; “бв ®ўЁ¬ Ї®§ЁжЁо Єгаб®а .
out (ConRegDisp),A
ld A,L
out (DatRegDisp),A
ld A,H
out (DatRegDisp),A
ld A,4fh ; “бв ®ўЁ¬ Їа ў«ҐЁҐ Єгаб®а ўЁ§.
out (ConRegDisp),A
ld A,42h
out (ConRegDisp),A
ld B,00h
sla C
rl B
sla C
rl B
sla C
rl B
sla C
rl B
ld HL,charset_8x16
add HL,BC
ld B,10h
PrintChar_1:
ld A,(HL)
out (DatRegDisp),A
inc HL
djnz PrintChar_1
ld A,(X)
inc A
ld (X),A
PrintChar_2:
pop HL
pop DE
pop BC
pop AF
ret
PrintString:
push AF
push HL
PrintString_1:
ld A,(HL)
and A
jr z,PrintString_5
cp 0ah
jr nz,PrintString_2
ld A,(Y)
cp 0fh
jr nc,PrintString_5
inc A
ld (Y),A
cp 0fh
jr nc,PrintString_5
jr PrintString_4
PrintString_2:
cp 0dh
jr nz,PrintString_3
xor A
ld (X),A
jr PrintString_4
PrintString_3:
call PrintChar
PrintString_4:
inc HL
jr PrintString_1
PrintString_5:
pop HL
pop AF
ret