Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Movable sprites over chunky FLI
2019-11-10 16:01
Digger

Registered: Mar 2005
Posts: 437
Movable sprites over chunky FLI

I need to have a freely moving block (2x2, 3x3 or 4x4) of sprites positioned above chunky FLI routine (badline triggered every 4 lines).

Could you suggest on how to approach it?

There's a part by Xbow with sprite block freely flying over FLI:
https://youtu.be/Y0O7zmD7MDE?t=209

Cheers!
2019-11-10 16:38
Digger

Registered: Mar 2005
Posts: 437
I looked at it with C64 Debugger and I saw a “moving window” technique where on each frame the FLI routine is started from a different place in the code, so sprites’ Y pos and pointers are executed at the right place. Pretty smart.

Looking into combining this with a timer routine that triggers every 4 lines but I see this uber complicated...
2019-11-10 17:35
ChristopherJam

Registered: Aug 2004
Posts: 1409
I suspect the simplest approach would be to have blank sprites above and below the block, so the sprite DMA cycles are the same every line regardless of the block position.
2019-11-10 20:22
Oswald

Registered: Apr 2002
Posts: 5094
https://youtu.be/_Z9rlP7XMuk?t=646

I am doing it here. :-)

yes its a complicated solution. spaceship is 4x2 sprites, so there are 2 kind of fli nmi routines: 4 sprites over or not.

then I have code to find out which nmi should be 4 sprites over and which normal, and there is a table of nmi's generated, which the nmi's read up to decide what kind of nmi will be next.
2019-11-10 20:31
Oswald

Registered: Apr 2002
Posts: 5094
;helper tables to determine which char lines are covered by sprites

; each table represents a consecutive char row
; row1-2-3 relative to sprite y coord
; to be looked up by y/8

; so if sprite y = 0 then char rows 0,1,2 have sprite over them
; ff = not covered by sprite

helper1 .byte $00,$01,$01,$01,$01,$01,$01,$01
helper2 .byte $01,$02,$02,$02,$02,$02,$02,$02
helper3 .byte $02,$ff,$ff,$ff,$03,$03,$03,$03

setnmivectors tax
lsr
lsr
lsr
sta zp ;/8

txa
and #$07
tay

lda helper1,y
clc
adc zp
tax
lda #<nmispr
sta nmilo+0,x
lda #>nmispr
sta nmihi+0,x

lda helper2,y
clc
adc zp
tax
lda #<nmispr
sta nmilo+0,x
lda #>nmispr
sta nmihi+0,x

lda helper3,y
bmi skip ;in some cases only 2 char rows are covered no need for 3rd
clc
adc zp
tax
lda #<nmispr
sta nmilo+0,x
lda #>nmispr
sta nmihi+0,x
skip
rts

lda falconsinus,x
clc
falconyoffset adc #180 ;88
sta falcony
sec
sbc #4
pha
jsr setnmivectors ;setup nmi vector table
pla
clc
adc #21
jsr setnmivectors
2019-11-10 20:34
Oswald

Registered: Apr 2002
Posts: 5094
note that the nmi vector table is reset to "no sprites present" before calling setnmivectors which will change them to sprites are present routines where needed based on the caller A ( = y coo of a sprite )
2019-11-10 20:41
Digger

Registered: Mar 2005
Posts: 437
Thx Oswald, but that's beyond my comprehension, will probably try a more regular chunky FLI with IRQs and what CJam suggested. Seems I've got enough rastertime left to burn some extra cycles.
btw. How do you calculate that comanche/voxel flight?
2019-11-10 20:43
Copyfault

Registered: Dec 2001
Posts: 478
Hmm, should be possible with the usual 4x4-FLI-IRQs (mind: two consequtive 4x4-FLI-lines set in one irq) that are triggered on a non-sprite-cycle...

@Digger: will send a pm/mail;)
2019-11-10 21:14
Oswald

Registered: Apr 2002
Posts: 5094
Quote: Hmm, should be possible with the usual 4x4-FLI-IRQs (mind: two consequtive 4x4-FLI-lines set in one irq) that are triggered on a non-sprite-cycle...

@Digger: will send a pm/mail;)


I dont get this, but made me think, with if code would check via CIA timers if sprites are present (timer would run more cycles if sprites steal cycles), and pick 4x4 routine automagically based on that ? as sprite dma starts 1 line earlier could work, but only if not all sprites are present.

by clever setup timer value could be used directly to set nmi routine addrss. so just lda timer sta nmivector.

voila done :)

@digger, its complicated, dont wanna rail off the topic :) basicly works like any voxel engine, but the heightmap is an on the fly calculated plasma.
2019-11-10 22:02
HCL

Registered: Feb 2003
Posts: 728
I think The Wild Bunch is what you're looking for. There is a 4x4-effect towards the end of the demo, but don't rush it, the rest of the demo is worth watching also :)
2019-11-10 22:26
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: I think The Wild Bunch is what you're looking for. There is a 4x4-effect towards the end of the demo, but don't rush it, the rest of the demo is worth watching also :)

Exactly. What I did there was to let the multiplexer fill in a table of delay values so that I could compensate properly.

The main problem is that even though timer magic let you do the FLI-$d011 properly, random sprite DMA fucks that up. The $d011-write has to be done 1 cycle after sprite fetches, so you really can't auto-stabalize it.

Since all my sprites are at least in pairs of two, not many combinations of timing could exists (4! = 24). So the multiplexer knows - per raster line - exactly how many sprites are active, and fills a table properly.
 
... 1 post hidden. Click here to view all posts....
 
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Holy Moses/Role
EALL/HT
Beast/Crescent
DnP
JonEgg
Guests online: 90
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Logo Graphicians
1 t0m3000  (10)
2 Sander  (9.8)
3 Mermaid  (9.5)
4 Facet  (9.4)
5 Shine  (9.4)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.045 sec.