; 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-250 and 255-259: 848-863 LINES = 312 CYCLES_PER_LINE = 71 TIMER_VALUE = 22150 ; LINES * CYCLES_PER_LINE - 2 *=$2000 ; creategraphics 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 charmap2 ldx #$77 stx $fb inx stx $fc inx stx $fd inx stx $fe show lda #$0e sta $9000 lda #$22 sta $9001 lda #$14 sta $9002 start lda #$7f sta $912e ; disable and acknowledge interrupts sta $912d ; sta $911e ; disable NMIs (Restore key) ;synchronize with the screen sync ldx #$77 ; wait for this raster line (times 2) raster1 cpx $9004 bne raster1 ldy #9 bit $24 raster2 ldx $9004 txa bit $24 ldx #24 back dex bne back ; first spend some time (so that the whole cmp $9004 ; loop will be 2 raster lines) bcs forward ; save one cycle if $9004 changed too late forward dey bne raster2 ; now it is fully synchronized ; 6 cycles have passed since last $9004 change ; and we are on line 2*($71+9)=244 ; initialize the timers timers lda #$40 ; enable Timer A free run of both VIAs sta $912b lda #TIMER_VALUE sta $9126 stx $9125 ; start the IRQ timer A pointers lda #irq sta $315 lda #$c0 sta $912e ; enable Timer A underflow interrupts rts ; return irq ; Save Area from 240-250 and 255-259 to 848-863 lda $f0 sta $0350 lda $f1 sta $0351 lda $f2 sta $0352 lda $f3 sta $0353 lda $f4 sta $0354 lda $f5 sta $0355 lda $f6 sta $0356 lda $f7 sta $0357 lda $f8 sta $0358 lda $f9 sta $0359 lda $fa sta $035a lda $ff sta $035b lda $100 sta $035c lda $101 sta $035d lda $102 sta $035e lda $103 sta $035f ; create Charmap for Video Ram from 240 to 259 ldx #$6c stx $f0 inx stx $f1 inx stx $f2 inx stx $f3 inx stx $f4 inx stx $f5 inx stx $f6 inx stx $f7 inx stx $f8 inx stx $f9 inx stx $fa ldx #$7b stx $ff inx stx $100 inx stx $101 inx stx $102 inx stx $103 ; wait a little so change graphic mode change is outside visible area nop nop nop nop nop nop ; switch graphics extra line below 192 ldx #$32 stx $9003 ldy #$88 sty $9005 lda #$86 raster3 cmp $9004 bne raster3 ; restore Area from 848-863 to 240-250 and 255-259 lda $0350 sta $f0 lda $0351 sta $f1 lda $0352 sta $f2 lda $0353 sta $f3 lda $0354 sta $f4 lda $0355 sta $f5 lda $0356 sta $f6 lda $0357 sta $f7 lda $0358 sta $f8 lda $0359 sta $f9 lda $035a sta $fa lda $035b sta $ff lda $035c sta $100 lda $035d sta $101 lda $035e sta $102 lda $035f sta $103 ; switch to normal 160 * 192 ldx #$1b stx $9003 ldy #$cc sty $9005 jmp $eabf ; return to normal IRQ