Je, te me has adelantado, te estaba escribiendo esto:
Te he aislado el programa solo con la parte que concierne al scroll para clarificar mejor.
Las rutinas importantes son las Bigmap, que escriben la pantalla entera en $4400 o $6400 (trabajo con el banco 1) después del scroll por hardware y a la de color.
Con el JOY 2 te mueves izq y der.
En $a000 esta en mapa de 4 pantallas de chars creado con el charpad y en $b000 el mapa de color, en $7000 los chars.
; 10 SYS (2064)
*=$0801
BYTE $0E, $08, $0A, $00, $9E, $20, $28, $32, $30, $36, $34, $29, $00, $00, $00
*=$0810
zp=$f9
zs=$fb
screen=$4400
screen2=$6400
maptab=$a000
zpc=$f7
zc=$fd
colortab=$b000
color=$d800
screen_control_register1 = $d011
screen_control_register2 = $d016
lda 1 ;quita el basic
and #%11111110
sta 1
jsr PANCHAR
jsr pantalla
jsr int
init jsr bigmap1
jsr bigmap2
LDA $D018
AND #15
ORA #144 ;POSICIÓN PANTALLA DENTRO DEL BANCO1 $6400
STA $D018
LDA screen_control_register2
AND #$F7 ;38 columnas
STA screen_control_register2
lg jsr raster_wait ;Loop game
jsr PlayerControl
jmp lg
PlayerControl
lda #4 ;Read LEFT on joystick port 2
bit $dc00
bne NotDENLeft
jsr right ;muevecajai
NotDENLeft
lda #8 ;Read RIGHT on joystick port 2
bit $dc00
bne NotDENRight
jsr left ;muevecajad
NotDENRight
rts
bigmap1
lda #<maptab
sta zp
lda #>maptab
sta zp+1
lda #<colortab
sta zpc
lda #>colortab
sta zpc+1
fixcol lda cornrx
clc
adc zp
sta zp
lda #0
adc zp+1
sta zp+1
lda cornrx
clc
adc zpc
sta zpc
lda #0
adc zpc+1
sta zpc+1
lda #<screen
sta zs
lda #>screen
sta zs+1
lda #<color
sta zc
lda #>color
sta zc+1
lda lines
sta countr
storlp ldy cols
inloop lda (zp),y
sta (zs),y
lda (zpc),y
sta (zc),y
dey
bpl inloop
clc
lda zp
adc width
sta zp
lda #0
adc zp+1
sta zp+1
clc
lda zs
adc #40
sta zs
clc
lda zpc
adc width
sta zpc
lda #0
adc zpc+1
sta zpc+1
clc
lda zc
adc #40
sta zc
bcc fdg
inc zs+1
inc zc+1
fdg dec countr
bpl storlp
rts
bigmap2
lda #<maptab
sta zp
lda #>maptab
sta zp+1
lda #<colortab
sta zpc
lda #>colortab
sta zpc+1
fixcol2 lda cornrx
clc
adc zp
sta zp
lda #0
adc zp+1
sta zp+1
lda cornrx
clc
adc zpc
sta zpc
lda #0
adc zpc+1
sta zpc+1
lda #<screen2
sta zs
lda #>screen2
sta zs+1
lda #<color
sta zc
lda #>color
sta zc+1
lda lines
sta countr
storlp2 ldy cols
inloop2 lda (zp),y
sta (zs),y
lda (zpc),y
sta (zc),y
dey
bpl inloop2
clc
lda zp
adc width
sta zp
lda #0
adc zp+1
sta zp+1
clc
lda zs
adc #40
sta zs
clc
lda zpc
adc width
sta zpc
lda #0
adc zpc+1
sta zpc+1
clc
lda zc
adc #40
sta zc
bcc fdg2
inc zs+1
inc zc+1
fdg2 dec countr
bpl storlp2
sale2 rts
left
ldx cornrx
cpx maxx
beq sale2
LDX screen_offset
DEX
STX screen_offset
CPX #$FF
BEQ continue
JMP end
continue
LDX #$07
STX screen_offset
jsr move_rows_left
end
LDA screen_control_register2
AND #$F8
ORA screen_offset
STA screen_control_register2
rts
move_rows_left
inc cornrx
jsr swap_bigmap
jsr swap_video
sale3 rts
screen_offset byte $07
right
ldx cornrx
beq sale3
LDX screen_offset_r
inx
STX screen_offset_r
CPX #8
Beq continuer
JMP endr
continuer
LDX #$00
STX screen_offset_r
jsr move_rows_right
endr
LDA screen_control_register2
AND #$F8
ORA screen_offset_r
STA screen_control_register2
@sal rts
move_rows_right
dec cornrx
jsr swap_bigmap
jsr swap_video
rts
screen_offset_r byte $00
swap_video
lda cp
beq pantalla1
bne pantalla2
rts
pantalla1
LDA $D018
AND #15
ORA #16 ;POSICIÓN PANTALLA DENTRO DEL BANCO1 $4400
STA $D018
lda #1
sta cp
rts
pantalla2
LDA $D018
AND #15
ORA #144 ;POSICIÓN PANTALLA DENTRO DEL BANCO1 $6400
STA $D018
lda #0
sta cp
rts
cp byte 0
swap_bigmap
lda bm
beq bm1
bne bm2
rts
bm1
jsr bigmap1
lda #1
sta bm
rts
bm2
jsr bigmap2
lda #0
sta bm
rts
bm byte 0
raster_wait ;espera línea raster
l LDA #$ff
CMP $D012
BNE l
BIT $d011
BMI l
rts
PANCHAR LDA 56578
ORA #3 ;PREPARAMOS PARA SELECCIONAR EL @@@
STA 56578
LDA 56576
AND #252
ORA #2 ; @@@ BANCO DE VIDEO 1 (16384)
STA 56576
; COMO MEMORIA PANTALLA SE QUEDA EN SU POSICIÓN POR DEFECTO, NO LA CAMBIAMOS
; LDA $D018
; AND #15
; ORA #16 ;POSICIÓN PANTALLA DENTRO DEL BANCO
; STA $D018
; SI QUISIERAMOS EL CURSOR
; LDA #68 ;CURSOR PANTALLA EN BANCO 1
; STA 648
LDA $D018
AND #240 ;ESTABLECEMOS EL MODO CARACTER
ORA #12 ;BUSCA CARACTERES A PARTIR DE 12288 + DIR BANCO 1
STA $D018
; LDA $D016
; ORA #16 ;MODO CARACTER MULTICOLOR
; STA $D016
RTS
pantalla
lda #11
sta $d020
sta $d021
lda #8
sta $d022
lda #10
sta $d023
rts
INT sei
lda #<n1
sta $0314
lda #>n1
sta $0315
; lda #$00
; jsr $1000 ;Initialize music
lda #$7f
sta $dc0d
sta $dd0d
lda #$01 ;IRQ speeder
sta $d01a
cli
RTS
N1 asl $d019 ; IRQ speeder again
lda $dc0d
sta $dd0d ; Stabilize CIA
; jsr $1003;Play the music
jmp $ea31 ;7e
width byte 160
height byte 22 ;25 normal total lineas pantalla vertical
lines byte 21;22-1
cols byte 39 ;40-1
cornrx byte 0
cornry byte 0
maxx byte 120 ;160-40 total mapa x menos pantalla (40 carac)
maxy byte 0 ;25-25 total mapa y menos pantalla (25 carac)
countr byte 0
countr2 byte 0
*=$7000 ;28672 ;CARACTERES EN BANCO 1 (12288 + 16384)
incbin "chars2.bin"
*=$a000
incbin"map.bin"
*=$b000
incbin"colormap.bin"