;LAST UPDATE: 16.08.2015 savelij
include ../../macros.a80
include ../../global_vars.a80
COLOR1 EQU 0X0B
COLOR2 EQU 0X22
ORG 0
TEST_TXTMODE DI
LD SP,0X6000
LD BC,0XFF77
LD A,0XA3 ;SPECTRUM SCREEN
OUT (C),A
XOR A
CALL SET_7FFD
LD HL,0X4000
LD DE,0X4001
LD BC,0X1800
LD (HL),L
LDIR
LD D,H
LD E,L
INC DE
LD BC,0X300
LD (HL),0X39
LDIR
LD A,1
OUT (0XFE),A
LD DE,0X4808 ;АДРЕС ПЕЧАТИ НА ЭКРАНЕ
LD HL,TEXT_SPMODE
CALL PRINT
LD DE,0X48E2
LD HL,PRESS_SPACE
CALL PRINT
CALL WAIT_KEYS
LD BC,0XFF77
LD A,0XA6 ;TEXTMODE SCREEN
OUT (C),A
LD A,5
OUT (0XFE),A
LD A,0X27
CALL CLEAR_TXTSCR
LD DE,0X1006
LD HL,TEXT_TXTMODE
LD C,COLOR1
CALL PRTT_MSG
LD DE,0X2010
LD HL,PRESS_SPACE
LD C,COLOR2
CALL PRTT_MSG
CALL WAIT_KEYS
JP TEST_TXTMODE
PRTT_MSG LD A,(HL)
INC HL
AND A
RET Z
;D-X E-Y C-COLOR
PUSH DE
PUSH HL
PUSH AF
LD L,E
LD A,D
LD H,0
LD D,H
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
LD E,A
SRL E
ADD HL,DE
AND 1
RRCA
RRCA
RRCA
OR 0XC1
LD D,A
LD E,0XC0
ADD HL,DE
POP AF
LD (HL),A
LD A,0X0B
CALL SET_7FFD
LD A,H
XOR 0X20
LD H,A
LD A,D
AND 0X20
RLCA
RLCA
RLCA
ADD A,L
LD L,A
LD (HL),C
LD A,0X0F
CALL SET_7FFD
POP HL
POP DE
INC D
JR PRTT_MSG
WAIT_KEYS LD A,0X7F
IN A,(0XFE)
RRA
JR C,WAIT_KEYS
WAIT_KEY1 XOR A
IN A,(0XFE)
CPL
AND 0X1F
JR NZ,WAIT_KEY1
RET
PRINT LD A,(HL)
INC HL
AND A
RET Z
PUSH HL
PUSH DE
PUSH DE
LD L,A
LD H,0
LD DE,CHARS-0X100
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,DE
POP DE
REPT 8
LD A,(HL)
LD (DE),A
INC HL
INC D
ENDM
POP DE
POP HL
INC E
JR PRINT
CLEAR_TXTSCR PUSH AF
LD A,0X0F
CALL SET_7FFD
LD HL,0XC1C0
LD A," "
CALL CLS_TXTSCR
LD HL,0XE1C0
CALL CLS_TXTSCR
LD A,0X0B
CALL SET_7FFD
LD HL,0XC1C0
POP AF
CALL CLS_TXTSCR
LD HL,0XE1C0
CALL CLS_TXTSCR
LD A,0X0F
SET_7FFD PUSH BC
LD BC,0X7FFD
OUT (C),A
POP BC
RET
CLS_TXTSCR LD D,H
LD E,L
LD BC,0X63F
LD (HL),A
INC DE
LDIR
RET
TEXT_SPMODE DB "SPECTRUM SCREEN MODE",0
TEXT_TXTMODE DB "TEXT SCREEN MODE",0
PRESS_SPACE DB "PRESS SPACE FOR CONTINUE",0
CHARS binclude ../../page3/source/shr_3d00.bin
TXT_CHARS binclude ../../page5/source/8x8_ar.fnt
; Fill rest of rom with 0XFF
DUPL 0X3D2F-$,0XFF
DB 0X00,0XC9
; Fill rest of rom with 0XFF
DUPL 0X4000-$,0XFF