; Screen split met 2 VDP 24 scrolls
; (c) 01-05-1993 By Hitsoft Productions of IMPACT

        ORG   9000H

ST:     LD    A,5             ; SCREEN 5
        CALL  5FH

START:  CALL  INIT

CHECK:  CALL  0D8H            ; KIJK OF SPATIE WORDT INGEDRUKT
        CP    0FFH
        JR    NZ,CHECK

QUIT:   JP    STOP

INIT:   LD    HL,0FD9AH       ; ZET OP DE INTERUPT
        LD    DE,HOOKBU
        LD    BC,0AH
        LDIR
        DI
        LD    HL,NEWHOO
        LD    DE,0FD9AH
        LD    BC,0AH
        LDIR
        LD    BC,8013H
        CALL  VDPWRT
        LD    BC,1600H
        CALL  VDPWRT
        EI
        RET

STOP:   DI                    ; RESTORE INTERUPT
        LD    HL,HOOKBU
        LD    DE,0FD9AH
        LD    BC,0AH
        LDIR
        LD    BC,0600H
        CALL  VDPWRT
        EI
        XOR   A
        CALL  5FH
        RET

HOOKBU: DEFB  00H,00H,00H,00H,00H
H_TIMI: DEFB  00H,00H,00H,00H,00H

NEWHOO: JP    LINEIN
        NOP
        NOP
        JP    KIJK
        NOP
        NOP

VDPWRT: LD    A,(07H)
        INC   A
        LD    D,C
        LD    C,A
        LD    A,B
        OUT   (C),A
        LD    A,D
        OR    80H
        OUT   (C),A
        RET

VDPRD:  LD    HL,(06H)
        INC   H
        INC   L
        LD    C,H
        OUT   (C),A
        LD    A,8FH
        OUT   (C),A
        LD    C,L
        IN    A,(C)
        PUSH  AF
        XOR   A
        LD    C,H
        OUT   (C),A
        LD    A,8FH
        OUT   (C),A
        POP   AF
        RET

LINEIN: LD    A,01H
        CALL  VDPRD
        AND   01H
        JR    NZ,LINE_R
        RET

LINE_R: LD    BC,0600H        ; DIT IS HET STILSTANDE GEDEELTE
        CALL  VDPWRT
        LD    BC,3F02H        ;SETPAGE1,1 (3F=1)
        CALL  VDPWRT
        LD    BC,17H
        CALL  VDPWRT
        LD    A,(VTEL2)
        DEC   A
        LD    (VTEL2),A
        LD    B,A
        LD    C,17H
        CALL  VDPWRT
        RET

KIJK:   LD    A,(HOFL)
        CP    0FFH
        JP    Z,NORMI2

NORMIN: XOR   A
        LD    (HOFL),A
        LD    BC,1600H        ; DIT IS HET SCROLLENDE GEDEELTE
        CALL  VDPWRT
        LD    BC,5F02H        ;SETPAGE2,2 (5F=2)
        CALL  VDPWRT
        LD    A,(VTEL)
        INC   A
        LD    (VTEL),A
        CP    97
        JR    Z,NORMI2
        LD    B,A
        LD    C,17H
        CALL  VDPWRT
        LD    A,(INTTEL)
        INC   A
        LD    (INTTEL),A
        LD    B,A
        LD    C,13H
        CALL  VDPWRT
        RET

NORMI2: LD    A,0FFH
        LD    (HOFL),A
        LD    BC,1600H        ; DIT IS HET SCROLLENDE GEDEELTE
        CALL  VDPWRT
        LD    BC,5F02H        ;SETPAGE2,2 (5F=2)
        CALL  VDPWRT
        LD    A,(VTEL)
        DEC   A
        LD    (VTEL),A
        CP    0
        JR    Z,NORMIN
        LD    B,A
        LD    C,17H
        CALL  VDPWRT
        LD    A,(INTTEL)
        DEC   A
        LD    (INTTEL),A
        LD    B,A
        LD    C,13H
        CALL  VDPWRT
        RET

HOFL:   DEFB  0               ; HOOG = 0 LAAG = FF
VTEL:   DEFB  0
VTEL2:  DEFB  0FFH
INTTEL: DEFB  114             ; PLAATS NA SCR SPLIT

PALET1: DEFB  00H,00H,33H,03H,55H,05H,77H,07H
        DEFB  00H,00H,00H,00H,00H,00H,00H,00H
        DEFB  55H,05H,00H,02H,04H,06H,55H,06H
        DEFB  05H,07H,02H,04H,33H,03H,77H,07H








00H,00H,00H,00H
        DEFB  55H,05H,00H,02H,04H,06H,55H,06H
        DEFB  05H,07H,02H,0