; Raster-Split-Hires - True 160 * 200 pixels
; only for PAL-VIC 20
; Video-Ram Top: 4096-4351 = 240 double height chars
; Char-Ram  Top: 4352-8191 = 3840 Byte = 30720 pixels(standard 160*192 res)
; Video-Ram Bottom: 240-259 = 20 Byte 
; Char-Ram Bottom: 864-1023 = Char: 108 - 127 (160*8 res)
; ZP-Save-Area for 240-259: 834-863

*=$2000
	sei		; Set Interrupt Flag
	ldy	#$10
	ldx	#$00
	txa
clear1	sta	$1000,x
	inx
	bne	clear1
	inc	clear1+2
	dey
	bne	clear1
	lda	#$10
	sta	clear1+2
	ldy	#$04
	lda	#$00
clear2	sta	$9700,x
	inx
	bne	clear2
	dec	clear2+2
	dey
	bne	clear2
	lda	#$97
	sta	clear2+2
	lda	#$00
	ldx	#$60
clear3	sta	$0300,x
	inx
	bne	clear3

charmap
	ldx	#$10
loop1	txa
	sta	$0ff0,x
	inx
	bne	loop1
show
	lda	#$0e
	sta	$9000
	lda	#$22
	sta	$9001
	lda	#$14
	sta	$9002

grandloop
; Save Area from 240-259 to 844-863
	ldx	#$14
loop3 	byte	$bd	; lda	$00ef,x
	byte	$ef
	byte	$00
	sta	$034b,x
	dex
	bne	loop3
; create Charmap for Video Ram from 240 to 259
	ldx	#$6c
loop2	txa
	byte	$9d ; sta $0084,x (since x = $6c from $00f0)
	byte	$84
	byte	$00
	inx
	cpx	#$80
	bne	loop2
; switch graphics from 160 * 192 and extra line
	ldx	#$1b
	stx	$9003
	ldy	#$cc
	sty	$9005
	ldx	#$32
	ldy	#$88
	lda	#$82
raster	cmp	$9004
	bne	raster
	stx	$9003
	sty	$9005
	lda	#$86
raster2	cmp	$9004
	bne	raster2
; restore Area from 844-863 to 240-259 
	ldx	#$14
loop4	lda	$034b,x
	byte	$9d	; sta	$00ef,x
	byte	$ef
	byte	$00
	dex
	bne	loop4
	beq	grandloop
	