C64 Assembly lesson 8 and 9: Hard and Smooth scrolling

preview_player
Показать описание
Today in #C64 #assembly we are going to implement hardware based smooth scrolling

The X scrolling is done by the lowest 3 bits of the $d016 which is Control register 2
Y scrolling is done by the lowers 3 bits of the $d011 which is Control register 1

Рекомендации по теме
Комментарии
Автор

LEL I remember this from back in the day in jch's assembler (chordian). Drake of Dominators taught me these things... I do alot today in css3 and html5 retro wise using sids.

UndaAttack
Автор

I just tried to explain the crazy code in the circular scroll also just characters - see if you can find that somewhere on csdb. This is the most fascinating imho.
So the characters sine scroll AND it wraps i self AROUND the sinus line ... it was crazy.!

UndaAttack
Автор

This was way easier than I thought it was going to be. Thanks again for another great video. I begin to understand why C64 games scrolled so much better than Amstrad versions. Would sprite positions also be affected by this type of scroll or are they in a separate 'layer' (probably not the correct term!)?

taddy
Автор

What a nice face!! Thanks for you tutorial!

FD-zexg
Автор

Hi, great Tutorial! Could I ask you where Can I find more infos about " .text" in KickAssembler?

MrANavarra
Автор

I will have to look at your version. Mine seems to have a slight periodic hiccup and occasional glitching as if everything is being rendered out of position for a frame, though it's only partly rendered, just bits of characters. It's 99% OK, just a couple of issues.

gavinw
Автор

38 years too late. Hah. Just joking. Nice video. The direct write to $d016 is not what I would do. Same for the hardscroll loop. But however it is a basic example.

v-for-victory
Автор

Same stuff, only done with a 1x1 characterset, variable speed and the option to "speedcode" the pull-loop (change it to "true" to test):

.const SpeedCode = false
.const ScreenMemory = $0400
.const ScrollSpeed = 1
.var x = 0


// BASIC & Initialization
:BasicUpstart2(Init)
Init:
sei
jsr $e544


// Vertical Syncronization
Main:
!: bit $d011
bmi !-
!: bit $d011
bpl !-


// Main Loop
jsr Scroll
jmp Main


// Softscroll Routine
Scroll:
lda SoftScroll: #$07
sec
sbc #ScrollSpeed
bcs !+
adc #$08
clc
!: sta SoftScroll
sta $d016
bcc UpdateText
rts


// Text Update & Pull Routine
TextReset:
sta TextOffset
UpdateText:
ldx TextOffset: #$00
lda Text, x
beq TextReset
sta ScreenMemory + 39
inc TextOffset

.if(SpeedCode) {
.for(x = 0 ; x < 39 ; x++) {
lda ScreenMemory + x + 1
sta ScreenMemory + x
}
} else {
ldx #-39
!: lda ScreenMemory + 1 - [256 - 39], x
sta ScreenMemory - [256 - 39], x
inx
bne !-
}
rts

Text:
.text "blabla @"

Notice that there is no CMP/CPX/CPY isued in the scroller routine. You could also get away with aligning the scrolltext to a page and skip the offset indexing and just SMC increase the text pointer and restore it accordingly.

tww