Ieri sera mi è venuto lo sfizio di provare a giocare un po' più seriamente coi raster e... stasera ho completato quello che avevo iniziato ieri.
Quella che ho allegato qua é una routine calibrata esattamente sul numero di cicli disponibili in ogni raster (63 per le macchine PAL), nella quale, oltre ad eliminare i bordi superiore ed inferiore, utilizzo il VIC col bit DEN disabilitato.
Disabilitando il bit DEN il VIC non crea bad lines e non va a leggere i dati grafici nella charmap; l'unico accesso che viene fatto é all'ultimo byte indirizzabile dal chip grafico: $3fff (ipotizzando di lavorare col VIC direzionato al primo quarto di memoria). Tale byte viene riprodotto graficamente come una serie di 40*8 pixel ripetuti in ogni linea.
La routine che ho scritto cambia il valore di questo byte una volta per linea, creando un simpatico effetto di scrolling.
NB: cambiando di valore il byte $0445 potete aggiustare la velocità dello scroll.
Il source code:
(non fate troppo caso alla parte di inizializzazione, é brutta, disordinata e... schifida :D)
*=$0326
.word intro
.word $F6ED
intro
sei
ldx #$00
fix lda testo,x
beq exfx
asl
asl
asl
sta testo,x
inx
bne fix
exfx
lda #$7f
sta $dc0d
sta $dd0d
lda #$23
sta $01
lda #$90
sta $fc
ldx #$00
TTT lda $d000,x
eor #$ff
sta $9000,x
cmp #$80
rol
sta $9100,x
cmp #$80
rol
sta $9200,x
cmp #$80
rol
sta $9300,x
cmp #$80
rol
sta $9400,x
cmp #$80
rol
sta $9500,x
cmp #$80
rol
sta $9600,x
cmp #$80
rol
sta $9700,x
inx
bne TTT
lda #$ff
ldx #$00
PPP sta $9000,x
sta $9100,x
sta $9200,x
sta $9300,x
sta $9400,x
sta $9500,x
sta $9600,x
sta $9700,x
inx
cpx #$07
bne PPP
lda #$27
sta $01
lda #$05
sta $d021
lda #$00
sta $ff
sta $d020
tax
tay
sta $fb
WT1 bit $d011
bpl WT1
WT2 bit $d011
bmi WT2
jmp GO
*=$0400
;*****************************
;* Fine gestione hyperscreen *
;*****************************
CP3 lda $ff ; 3 +
sta $d011 ; 4 +
; *******************
; * Inizio ciclo 13 *
; *******************
Main lda sinus ; 4
sta $fc ; 3
iny ; 2
cpy #$08 ; 2
bne Wait ; 2/3 - [13]
; ********************************
; * routine di aggiornamento - 11*
; ********************************
inx ; 2
lda testo,x ; 4
sta $fb ; 3 - 7
ldy #$00 ; 2 - 2 - [11]
; ******************************
; *Routine principale: 17 cicli*
; ******************************
NL lda ($fb),y ; 5
GO sta $3fff ; 4
NL1 lda $d012 ; 4
sta Main+1 ; 4 Salva posizione per effetto sinusoide
; ************************
; *Da qua in poi 22 cicli*
; ************************
; A seguire: (4+5+3+10)=22 diverso da 31 e F9
; (5+7+10)=22 uguale a 31
; (5+4+3+10)=22 uguale a F9
ST bit $d011 ; 4 * - +
bmi CP1 ; 2/3 * - +
cmp #$35 ; 2 * - +
beq CP2 ; 2/3 * - +
cmp #$FA ; 2 * +
beq CP3 ; 2/3 * +
lda $fe ; 3 *
nop ; 2 *
jmp Main ; 3 * OK (22)
CP2 lda #$08 ; 2 -
sta $d011 ; 4 -
nop ; 2 -
jmp Main ; 3 - OK (22)
CP1 cmp #$37 ; 2
bne END1 ; 2/3
lda $fd ; 3
adc #$20 ; 2
sta $fd ; 3
lda $fe ; 3
adc #$00 ; 2
sta $fe ; 3
tax ; 2
lda $fd ; 3
lsr ; 2
lsr ; 2
lsr ; 2
lsr ; 2
lsr ; 2
tay ; 2
nop ; 2
nop ; 2
sta $ffff ; 4
jmp NL1 ; 3 OK (55)
END1 sta $ffff ; 4
lda $fe ; 3
jmp Main ; 3 OK
; ***************************
; * routine sostitutiva - 11*
; ***************************
Wait
lda $ffff ; 4
lda $fe ; 3
jmp NL ; 3 - [10]+1
*=$0500
testo
.byte "IL TESTO CHE STATE LEGGENDO VIENE VISUALIZZATO UTILIZZANDO LA MODALITA IDLE DEL VIC ANCHE CAMBIANDO UN SOLO BYTE DELLA MEMORIA VIDEO SI POSSONO COMUNQUE CREARE SCHERMATE COME QUESTA";
*=$0600
sinus
.byte $94,$93,$93,$93,$93,$93,$92,$92,$92,$92,$92,$91,$91,$91,$91,$91
.byte $91,$91,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90
.byte $90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$91
.byte $91,$91,$91,$91,$91,$91,$92,$92,$92,$92,$92,$93,$93,$93,$93,$93
.byte $94,$94,$94,$94,$94,$95,$95,$95,$95,$95,$95,$96,$96,$96,$96,$96
.byte $96,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97
.byte $97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$96
.byte $96,$96,$96,$96,$96,$95,$95,$95,$95,$95,$95,$94,$94,$94,$94,$94
.byte $93,$93,$93,$93,$93,$92,$92,$92,$92,$92,$92,$91,$91,$91,$91,$91
.byte $91,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90
.byte $90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$91
.byte $91,$91,$91,$91,$91,$92,$92,$92,$92,$92,$92,$93,$93,$93,$93,$93
.byte $94,$94,$94,$94,$94,$95,$95,$95,$95,$95,$96,$96,$96,$96,$96,$96
.byte $96,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97
.byte $97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$97,$96,$96
.byte $96,$96,$96,$96,$96,$95,$95,$95,$95,$95,$94,$94,$94,$94,$94,$94