Login
Back to forumReply to this topicGo to last reply

Posted By

Hendriks
on 2025-09-28
05:12:05
 Vertical smooth scrolling (up/down) and split screen (help needed please)

Hi all, I am working on a game with horizontal and vertical smooth scrolling of a map. This has been implemented and works well. Now I want to use a split screen (using raster). I want to use the lower 5 (or so) lines to display scores and other things. I want these lines to stay perfectly still and not move with the map when smooth scrolling.

I got it to work for horizontal (left/right) smooth scrolling, but I can't get it to work for vertical (up/down) smooth scrolling. The text in the bottom five lines keeps going up/down with the map above.

My interrupt code for the raster is below. Am I doing something wrong, or is it not possible to do what I want?
Thanks for your help!

irqMain
PHA ; remember the registers
TXA
PHA
TYA
PHA
ASL $FF09 ; acknowledge interrupt
LDA $FF0B ; see which raster line we have
CMP #$C8
BCC RASTERLINE_0

RASTERLINE_1
; set next raster IRQ
LDA #POS_RASTERLINE_0
STA $FF0B
; main loop, sets $FF06 and $FF07
JSR display
JMP EXIT_IRQ

RASTERLINE_0
; reset vertical smooth scroll
LDA $FF06
AND #%11111000
STA $FF06
; reset horizontal smooth scroll
LDA $FF07
AND #%11111000
STA $FF07
; set next raster IRQ
LDA #POS_RASTERLINE_1
STA $FF0B

EXIT_IRQ
PLA ; restore the registers
TAY
PLA
TAX
PLA
RTI
Posted By

Verona
on 2025-09-28
06:15:46
 Re: Vertical smooth scrolling (up/down) and split screen (help needed please)

LDA $FF0B ; see which raster line we have

No, you can read FF1D for that line's low byte, and FF1C if you want to know the high byte.

FF0A and FF0B is for set up when you want a raster IRQ, FF1C and FF1d is for the actual rasterline.

And when you set next IRQ, you must set FF0A to 2

lda #next_raster_line_low_byte
sta $FF0B
lda #2
sta $FF0A

Example from mine:

php
pha
txa
pha
tya
pha


lda $FF09
and #$02
bne title_raszter_irq
jmp title_not_raszter

title_raszter_irq:
lsr $FF09
lda $FF1C
and #1
beq title_not_hi_bit
jmp title_hi_bit_on

title_not_hi_bit:
lda $FF0A
and #252
ora #2
sta $FF0A

title_rrirq:
lda $FF1D
cmp #22
bcc title_first_irq

...


title_first_irq:

title_rrirq_2_store:
lda #50
sta $FF0B
lda #2
sta $FF0A


title_first_irq_end:
jmp title_not_raszter

...

title_hi_bit_on:
ldx #$00 //#$FF
stx $FF0B
lda #2
sta $FF0A


title_not_raszter:
pla
tay
pla
tax
pla
plp
rti
Posted By

Hendriks
on 2025-09-28
06:15:27
 Re: Vertical smooth scrolling (up/down) and split screen (help needed please)

Thanks, I made those changes and the code runs exactly like it ran before. Let me try it on some real hardware, just to make sure it's not the emulator (yape).
Posted By

Verona
on 2025-09-28
06:24:01
 Re: Vertical smooth scrolling (up/down) and split screen (help needed please)

I am pasted an example up here in my previous post.

Posted By

BSZ
on 2025-09-28
06:22:19
 Re: Vertical smooth scrolling (up/down) and split screen (help needed please)

@Hendriks: This task is far from as trivial as it seems. I haven't looked through your program, but I just remembered that I did something like this for Carrion last time. (In 2018... grin ). In this screen, the top 20 character lines can be moved, followed by 8 empty raster lines, and then 4 character lines at the bottom of the screen in a fixed position for the text.

If you're interested, here's the program along with the source code.
(The program now starts at $2000, and you can move the content with the 12345678 and QWERTYUI keys.)
Posted By

Hendriks
on 2025-09-28
07:16:59
 Re: Vertical smooth scrolling (up/down) and split screen (help needed please)

Thanks to both of you! I will see if I can get it working using your examples and will post here when done.
Posted By

Crazy
on 2025-09-28
07:54:19
 Re: Vertical smooth scrolling (up/down) and split screen (help needed please)

The Pit by Doug Turner is similar by design. Maybe his code can help.
Posted By

Verona
on 2025-09-28
09:32:49
 Re: Vertical smooth scrolling (up/down) and split screen (help needed please)

@Crazy: Where is the source code for The Pit?
By the way, that game has no smooth scrolling, it "scrolls" the playfield by one char row at a time.
Posted By

gerliczer
on 2025-09-28
10:21:32
 Re: Vertical smooth scrolling (up/down) and split screen (help needed please)

@Verona: You made me curious, so I tried it in Play online. I think you are wrong. I'm quite confident that I saw the scroll stop at partial character row positions.
Posted By

Verona
on 2025-09-28
14:18:43
 Re: Vertical smooth scrolling (up/down) and split screen (help needed please)

@gerliczer That's not true.
Test that in emulator at very low (10%) speed and you will see.
My new game-in-progress, Retrogods is similar. I use char-level scroll, but because the 2x2 tile system, you see a smoother scroll. Optic illusion.
Posted By

Crazy
on 2025-09-29
05:34:38
 Re: Vertical smooth scrolling (up/down) and split screen (help needed please)

Sadly Doug Turner past away 5 years ago not long after finishing The Pitt. sad
Posted By

Luca
on 2025-09-29
06:08:20
 Re: Vertical smooth scrolling (up/down) and split screen (help needed please)

...and it still hurts. It has been a pleasure to work with him about the tunes and the sfx, he was always friendly and passionate sad

The Pit is an incredible game which results to be literally the ULTIMATE Boulderdash clone, filled up with astounding novelties at any new screen.

He's also been the coder who fixed the Knaecketraecker's driver, which gave obscure problems to anyone, when a restart of the music was needed (and now you know why e.g. Pets Rescue, has to reload once a life is lost: it reloads the music only!).


Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2025. Support Plus/4 World on Patreon