Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Computer Arcana » Commodore » Commodore 8-bit » Rasterinterrupts...
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Rasterinterrupts... [message #86996] Mon, 04 August 2003 04:30 Go to next message
David Mueller is currently offline  David Mueller
Messages: 89
Registered: July 2003
Karma: 0
Member
Hi...

Sorry to bother you again, but right now I'm trying to program some
Rasterbars just for the good old times sake. My problem is, i can't
really remember how to turn off the flickering (it's a PAL-Machine) that
occurs... I think I can remember something aubout some NOPs to do the
timing (or a short loop), but i just can't get it really nice working.
Are there some tutorials about this stuff on the net (all i found are the
Coders World and Scibax Diskmag which do a bad job explaining thoroughly
the working of rasterbars/interrupts and stuff).

Thanks a lot,

David
Re: Rasterinterrupts... [message #87010 is a reply to message #86996] Mon, 04 August 2003 11:29 Go to previous messageGo to next message
hannibal is currently offline  hannibal
Messages: 20
Registered: July 2003
Karma: 0
Junior Member
Hy

You will find everything you want here

The biggest C64 Ml tutorial collection ever, in case you
didn't got it until now:

Grab it from here:

ftp://ftp.padua.org/pub/c64/Docs/ml-tutorial.zip
http://bj.spline.de/stuff/ml-tutorial.zip


Later,
Mihai
Re: Rasterinterrupts... [message #87015 is a reply to message #86996] Mon, 04 August 2003 12:26 Go to previous messageGo to next message
MagerValp is currently offline  MagerValp
Messages: 847
Registered: April 2012
Karma: 0
Senior Member
>>>> > "CK" == Cameron Kaiser <ckaiser@floodgap.com> writes:


DM> Sorry to bother you again, but right now I'm trying to program
DM> some Rasterbars just for the good old times sake.

CK> Horizontal or vertical?

Diagonal.

--
___ . . . . . + . . o
_|___|_ + . + . + . Per Olofsson, arkadspelare
o-o . . . o + MagerValp@cling.gu.se
- + + . http://www.cling.gu.se/~cl3polof/
Re: Rasterinterrupts... [message #87017 is a reply to message #86996] Mon, 04 August 2003 12:38 Go to previous messageGo to next message
reza_beha is currently offline  reza_beha
Messages: 1
Registered: August 2003
Karma: 0
Junior Member
David Mueller <david.mueller@post.rwth-aachen.de> wrote in message news:<MPG.1994f566ac2ebdca989684@news.rwth-aachen.de>...
> Hi...

>

> Sorry to bother you again, but right now I'm trying to program some

> Rasterbars just for the good old times sake. My problem is, i can't

> really remember how to turn off the flickering (it's a PAL-Machine) that

> occurs... I think I can remember something aubout some NOPs to do the

> timing (or a short loop), but i just can't get it really nice working.

> Are there some tutorials about this stuff on the net (all i found are the

> Coders World and Scibax Diskmag which do a bad job explaining thoroughly

> the working of rasterbars/interrupts and stuff).

>

> Thanks a lot,

>

> David


The idea behind the NOPs is to delay the color change until the raster
beam
has gone off screen where you can't see it. If you see the flicker in
the center of your screen, add a few NOPs to edge it over to the right
until it's gone. If you have a bar with many colors, it makes sense
to use a loop that pulls delay info from a small table with as many
values as there will be rows or colors in your bar.

Making clean raster bars is easy when you have a Super Snapshot
cartridge or some other way to break into your code while it's
running, make some timing changes and jump back out to see what
happened.
Re: Rasterinterrupts... [message #87021 is a reply to message #86996] Mon, 04 August 2003 14:14 Go to previous messageGo to next message
David Mueller is currently offline  David Mueller
Messages: 89
Registered: July 2003
Karma: 0
Member
Hi...

On 4 Aug 2003 08:42:21 -0500, ckaiser@floodgap.com said...

>> Sorry to bother you again, but right now I'm trying to program some

>> Rasterbars just for the good old times sake.

>

> Horizontal or vertical?


You can do _vertical_ Rasterbars? I always thought, the c64 was too slow
to do so... But first I'm just interested in getting horizontal ones
without flickering...

David
Re: Rasterinterrupts... [message #87049 is a reply to message #87015] Mon, 04 August 2003 21:55 Go to previous messageGo to next message
Cameron Kaiser is currently offline  Cameron Kaiser
Messages: 1622
Registered: December 2011
Karma: 0
Senior Member
MagerValp <MagerValp@cling.gu.se> writes:

>>> Sorry to bother you again, but right now I'm trying to program

>>> some Rasterbars just for the good old times sake.


>> Horizontal or vertical?


> Diagonal.


I'm out. :-)

--
Cameron Kaiser * ckaiser@floodgap.com * posting with a Commodore 128
personal page: http://www.armory.com/%7Espectre/
** Computer Workshops: games, productivity software and more for C64/128! **
** http://www.armory.com/%7Espectre/cwi/ **
Re: Rasterinterrupts... [message #87050 is a reply to message #87021] Mon, 04 August 2003 22:01 Go to previous messageGo to next message
Cameron Kaiser is currently offline  Cameron Kaiser
Messages: 1622
Registered: December 2011
Karma: 0
Senior Member
David Mueller <david.mueller@post.rwth-aachen.de> writes:

>>> Sorry to bother you again, but right now I'm trying to program some

>>> Rasterbars just for the good old times sake.


>> Horizontal or vertical?


> You can do _vertical_ Rasterbars? I always thought, the c64 was too slow

> to do so... But first I'm just interested in getting horizontal ones

> without flickering...


Yes, there are several demos that have done this. I'm long on theory but
short on example for it, however.

The most direct way to do flicker-free horizontal bars is to lock onto the
raster and don't let it go -- grab control of the system, wait out the
right number of processor cycles per line, and make the switch at the right
place. However, this will make your program video-standard-specific and of
course you don't have IRQ services unless you call $ea31 every now and then.

The way I've typically done flicker-free bars is by cheating -- I use sprites
set to the background colour to mask the flickering lines, and an ordinary
VIC-II triggered raster IRQ in multiple places, moving the masking sprites
down to each "border" of the bar(s). This works on PAL and NTSC, and makes
nice code, although it requires a bit of set up and obviously ties up
sprites (I use seven with X-expand on to cover the entire screen width,
leaving the eighth free for manipulation).

--
Cameron Kaiser * ckaiser@floodgap.com * posting with a Commodore 128
personal page: http://www.armory.com/%7Espectre/
** Computer Workshops: games, productivity software and more for C64/128! **
** http://www.armory.com/%7Espectre/cwi/ **
Re: Rasterinterrupts... [message #87054 is a reply to message #87021] Mon, 04 August 2003 23:43 Go to previous messageGo to next message
White Flame \(aka Dav is currently offline  White Flame \(aka Dav
Messages: 246
Registered: July 2003
Karma: 0
Senior Member
"David Mueller" <david.mueller@post.rwth-aachen.de> wrote in message
news:MPG.199892fd894718eb989686@news.rwth-aachen.de...
> You can do _vertical_ Rasterbars? I always thought, the c64 was too slow

> to do so...


Surely you've seen the C64 can open up the sideborders, which is virtually
the same thing as doing a vertical rasterbar.

> But first I'm just interested in getting horizontal ones

> without flickering...


The easy way out would be to stuff in some NOPs so that the raster is
outside of the background/border and change the opposite color register
then.

--
White Flame (aka David Holz)
http://www.white-flame.com/
(spamblock in effect)
Re: Rasterinterrupts... [message #87123 is a reply to message #87021] Wed, 06 August 2003 12:24 Go to previous messageGo to next message
MagerValp is currently offline  MagerValp
Messages: 847
Registered: April 2012
Karma: 0
Senior Member
>>>> > "DM" == David Mueller <david.mueller@post.rwth-aachen.de> writes:


DM> You can do _vertical_ Rasterbars? I always thought, the c64 was
DM> too slow to do so... But first I'm just interested in getting
DM> horizontal ones without flickering...

Well they aren't technically the same effect as horizontal rasterbars,
but it looks the same. You either use sprites that you mux down the
screen, or render the bars to 40 chars and line double with $d011,
just like you do with kefrens bars.

--
___ . . . . . + . . o
_|___|_ + . + . + . Per Olofsson, arkadspelare
o-o . . . o + MagerValp@cling.gu.se
- + + . http://www.cling.gu.se/~cl3polof/
Re: Rasterinterrupts... [message #87145 is a reply to message #86996] Wed, 06 August 2003 22:55 Go to previous messageGo to next message
The Doctor is currently offline  The Doctor
Messages: 71
Registered: July 2003
Karma: 0
Member
On 4 Aug 2003 08:42:21 -0500, Cameron Kaiser <ckaiser@floodgap.com>
wrote:

> Horizontal or vertical?


Herringbone :)
Re: Rasterinterrupts... [message #88476 is a reply to message #86996] Sun, 24 August 2003 00:07 Go to previous messageGo to next message
Anton Treuenfels is currently offline  Anton Treuenfels
Messages: 105
Registered: December 2011
Karma: 0
Senior Member
IIRC, with a simple split screen (just two hires areas, a fixed one above
and a scrolling one below), I traced most of the flickering to the keyboard.

The normal IRQ routine runs asynchronously with the raster interrupt. Again
if IIRC, what I did was get rid of it entirely and call the heartbeat
routines (keyscan, etc) during the raster interrupt instead (actually every
other interrupt, when the raster was below the visible screen).

More subtle was reading the keyboard input buffer. The normal Kernel routine
actually blocks interrupts (SEI) while removing characters from the buffer,
so it can interfere with the raster interrupt. I think I wrote my own
keybuffer routines to treat the buffer as a FIFO queue (instead of a LIFO
queue) that didn't need to block interrupts to work correctly (the final
routines were then more like the Kernel RS-232 routines, and were probably
modeled on them).

After that the raster split was rock solid. I've never really understood how
to use timing loops or sprites to make the splits look clean, but apparently
a lot of people do.

"David Mueller" <david.mueller@post.rwth-aachen.de> wrote in message
news:MPG.1994f566ac2ebdca989684@news.rwth-aachen.de...
> Hi...

>

> Sorry to bother you again, but right now I'm trying to program some

> Rasterbars just for the good old times sake. My problem is, i can't

> really remember how to turn off the flickering (it's a PAL-Machine) that

> occurs... I think I can remember something aubout some NOPs to do the

> timing (or a short loop), but i just can't get it really nice working.

> Are there some tutorials about this stuff on the net (all i found are the

> Coders World and Scibax Diskmag which do a bad job explaining thoroughly

> the working of rasterbars/interrupts and stuff).

>

> Thanks a lot,

>

> David
Re: Rasterinterrupts... [message #88498 is a reply to message #88476] Sun, 24 August 2003 23:07 Go to previous message
marc is currently offline  marc
Messages: 48
Registered: May 2013
Karma: 0
Member
"Anton Treuenfels" <teamtempest@yahoo.com> wrote in message news:<xSW1b.5480$8i2.2542@newsread2.news.atl.earthlink.net>...
> IIRC, with a simple split screen (just two hires areas, a fixed one above

> and a scrolling one below), I traced most of the flickering to the keyboard.


This is the keyboard IRQ interrupting once every frame and has nothing
to do with your interrupt routine's timing, as you have discovered.

From memory, they way I do it is:
Within the setup code do:
lda #$7f ; CIA
sta $dc0d
lda $dc0d
to kill the keyboard interrupt.

At the end of your interrupt routine you may call the keyboard service
routine via the kernal. There are 2 calls required, the first to place
a value in the keybuffer, the sencond to transfer the oldest (LIFO)
character into the Accumulator. I dont have my PRG handy, but IIRC
it's
JSR $FF9F
JSR $FFC3
SEI (IIRC the SEI is required to turn off interrupts that FF9F
reenabled to allow your service routine to complete)
JMP $EA81

> After that the raster split was rock solid. I've never really understood how

> to use timing loops or sprites to make the splits look clean, but apparently

> a lot of people do.


See the code below for some ideas. It's a split-screen vertical
scroller.
You could modify the basic routine to give steady $d021 splits by
padding the service routine out to the far right edge and doing LDA
$d012 then a compare with the expected value. Since the "jitter" is 2
cycles, if the raster value is the next line then a jump "past" a
single cycle is required to shave off that unwanted cycle (beware page
boundaries!).

The text and code below is pasted from one of my earlier posts:

Apart from the space formatting for this post, the code is compilable
with
Pro-Line's PAL Assembler. Also, my coding style is conservative (no
shortcuts) so please don't bother with comments like how to make it
shorter
by plugging absolute values into the registers rather than "LDA reg,
logical op, STA reg" :-)

;PAL Assembler format sourcecode
;split screen verticle scroll

RIV0 = 46
RIV1 = 49+(12*8)
BD = $D020
SCR = 1024

start =*
lda $d011
and #247
sta $d011
jsr RINIT
:
lda #0
MRL beq MRL ; loop to give max 2-char jitter
cli
brk
:
YP ldy #13 ;timing pause
YPL dey
bpl YPL
rts
:
YP1 ldy #7 ;timing pause
YP1L dey
bpl YP1L
rts
:
RINIT sei ; setup raster interrupt
lda #1
sta $d01a
sta $d019
lda $d011
and #$7f
sta $d011
ldx #<RI0 ; new IRQ vector
ldy #>RI0
lda #RIV0
JSR RIVSET0
lda #$7f ; CIA
sta $dc0d
lda $dc0d
cli
rts
:
RIVSET0 stx $0314 ; set IRQ values
sty $0315
sta $d012
rts
:
RIEXIT lda #1 ; exit IRQ
sta $d019
cli
jmp $ea81
:
RESR1 lda #RIV1
sec
sbc $fc
sta $fd
rts
:
RI0 sei
ldx #<RI1
ldy #>RI1
jsr RESR1
lda #RIV1 - 5
jsr RIVSET0
lda $d011
and #248
ora $fc
sta $d011
lda $dc01 ; check keyboard
cmp #$ef ; spacebar?
bne RX0 ; branch if no
lda #$ea ; else clear the NOPs
sta MRL
lda #$ea
sta MRL + 1
:
RX0 jmp RIEXIT
:
RI1 sei
ldx #<RI0
ldy #>RI0
lda #RIV0
jsr RIVSET0
lda $d011
and #248
ora #7
ldx #RIV1 - 3 ; force default Y-FINE
ldy #30 ; to see the glitch change the 30 to a 21
RLL cpx $d012
bne RLL
sty 53272 ;set "blank" charset for the 8-pixel split-band
inx
inx
inx
RL cpx $d012
bne RL
jsr YP
sta $d011
ldx #RIV1 + 5
RL0 cpx $d012
bne RL0
jsr YP1
lda #21
sta $d018 ;normal charset
jsr INCER
jmp RIEXIT
:
JOYER lda $dc00 ; JOY#2, FIRE to scroll
and #16 ; fire?
bne JRET ; branch if no
dec $fc
lda $fc
and #7
sta $fc
cmp #7
bne JRET
jsr SHUP ; hardscroll char data
:
JRET rts
:
TIM .byt 0
:
INCER dec TIM
bpl INCRET
lda #0
sta TIM
jmp JOYER
:
INCRET rts
:
COL ldx #0 ; set charset and put up some screen data to
scroll
CL lda #0
sta $3a00,x
sta $3b00,x
sta $3c00,x
sta $3d00,x
sta $3e00,x
sta $3f00,x
txa
sta $0400,x
dex
bne CL
stx $3fff
rts
:
SHUP inc BD ; hardscroll screen data and show processor load
ldx #39
SHUPL lda SCR,x
pha
lda SCR+40,x
sta SCR,x
lda SCR+80,x
sta SCR+40,x
lda SCR+120,x
sta SCR+80,x
lda SCR+160,x
sta SCR+120,x
lda SCR+200,x
sta SCR+160,x
pla
sta SCR+200,x
dex
bpl SHUPL
dec BD
rts


Marc Walters
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Connection to my PC
Next Topic: Another AmiWest 2003 report (fwd)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Mar 28 12:15:49 EDT 2024

Total time taken to generate the page: 0.18472 seconds