;GET VDP REGISTER VALUE

func_getvdp:

LD A,H
AND A
JR Z,func_getvdp_1 ;072C0H
LD A,(6)
LD C,A
INC C
XOR A
SUB L
DI
CALL func_getvdp_2 ;$6FE0
IN L,(C)
XOR A
CALL func_getvdp_2 ;$6FE0
EI
LD H,0
RET

func_getvdp_1:

LD DE,$F3DF
LD A,L
CP 9
JR C,func_getvdp_3 ;072CBH
LD DE,$FFDE

func_getvdp_3:
ADD HL,DE
LD L,(HL)
LD H,0
RET

func_getvdp_2:
OUT (C),A
LD A,$8F
OUT (C),A
RET
