1
0
mirror of https://github.com/cc65/cc65.git synced 2024-09-27 04:54:54 +00:00

Replaced magic numbers with symbolic constants.

This commit is contained in:
Stephan Mühlstrasser 2015-03-01 20:53:57 +01:00
parent 1d6aa84d9a
commit 981ab10fac

View File

@ -12,6 +12,10 @@
.include "osic1p.inc" .include "osic1p.inc"
.include "extzp.inc" .include "extzp.inc"
FIRSTVISC = $85 ; Offset of first visible character in video RAM
LINEDIST = $20 ; Offset in video RAM between two lines
BLOCKSIZE = $100 ; Size of block to scroll
_cputcxy: _cputcxy:
pha ; Save C pha ; Save C
jsr popa ; Get Y jsr popa ; Get Y
@ -37,7 +41,7 @@ cputdirect:
advance: advance:
cpy #(SCR_WIDTH - 1) cpy #(SCR_WIDTH - 1)
bne L3 bne L3
jsr newline ; new line jsr newline ; New line
ldy #$FF ; + cr ldy #$FF ; + cr
L3: iny L3: iny
sty CURS_X sty CURS_X
@ -46,22 +50,22 @@ L3: iny
newline: newline:
inc CURS_Y inc CURS_Y
lda CURS_Y lda CURS_Y
cmp #SCR_HEIGHT ; screen height cmp #SCR_HEIGHT ; Screen height
bne plot bne plot
dec CURS_Y ; bottom of screen reached, scroll dec CURS_Y ; Bottom of screen reached, scroll
ldx #0 ldx #0
scroll: lda SCRNBASE+$00A5,x scroll:
sta SCRNBASE+$0085,x .repeat 3, I ; Scroll screen in three blocks of size
lda SCRNBASE+$01A5,x ; BLOCKSIZE
sta SCRNBASE+$0185,x lda SCRNBASE+(I*BLOCKSIZE)+FIRSTVISC+LINEDIST,x
lda SCRNBASE+$02A5,x sta SCRNBASE+(I*BLOCKSIZE)+FIRSTVISC,x
sta SCRNBASE+$0285,x .endrepeat
inx inx
bne scroll bne scroll
lda #' ' ; Clear bottom line of screen lda #' ' ; Clear bottom line of screen
bottom: bottom:
sta SCRNBASE+$0385,x sta SCRNBASE+(3*BLOCKSIZE)+FIRSTVISC,x
inx inx
cpx #SCR_WIDTH cpx #SCR_WIDTH
bne bottom bne bottom