| |
anix Account closed
Registered: Feb 2004 Posts: 35 |
gonna show you guys how it's done !
well that's what i thought a few days ago !
this, my second go at c64 coding. much more serious this time. about a year ago i gave it a shot and got tangled up in stable rasters and such... i remember chatting with graham on irc trying to learn more about them, but mostly hearing about how i should support c128 2mhz in my routines :)
so this time, i decided to try and duplicate (without monitoring!) one of my favorite routines - xbow's sideborder rasters from demus interruptus endpart.
had it all figured out !
(i thought, you'll quickly see what i missed)
open the borders,
fld to get rid of the badlines,
all 8 sprites stretched across,
y-stretch all 8 sprites so the screen is filled with the same row of the sprite (128 rows anyway)
now on each line, plot the new bar into the sprite.
i even had some (i thought) great ideas - like, all 8 sprites use the same buffer, and i toggled the stretching on each, before the effect, so that each would be using the next sprite-line during the effect... so i have a 24-byte 'linear' area to plot new bars on.
of course, i'd have to unroll the loop to get it to fit in 63 cycles.
and it has to be modified each frame, to plot the right bytes directly where they should go.
so the calculation for each frame takes a long time since it has to modify the unrolled irq.
so i had to unroll that also.
and it still takes too long... so i decided to do some more FLD to free up some time from badlines and use that to clear the sprite buffer before the next frame.
oh my
after all this work, and thinking things were not so tough - stretched multicolor sprites are ugly ! but demus's rasters are thin... so after all my efforts, i have a half-screenwidth of bars, which can be put in the sideborder, and not a whole screen.
depressing, cuz now i don't understand it.
can FLI/FLD be used to repeat the same bitmap row all the way down the screen?
i had a few mistakes that seemed to do this, except the byte that i had on the screen appeared to come from $3fff.
then of course the problem of getting the sprites on there, in the sideborders, with badlines (i guess).
now it appears impossible (haha)
nevermind the other demus bars which are in all borders - where is the time to calculate the movement ??
well anyway,
much respect to all you guys because this stuff is very challenging. fun though
|
|
... 13 posts hidden. Click here to view all posts.... |
| |
anix Account closed
Registered: Feb 2004 Posts: 35 |
stryyker: yeah it works... i was wondering if sprite from zero page would work or not, i have not done much with the zero page yet except store a few things in $fb/fc/fd. it would win many cycles since so much read/write is done to the sprite - but i did get 127 bars in one frame without it. now if i continue, the next challenge is to get the char portion of the screen going. zero page sprite might buy me some more cycles since i'll be adding another half-width-screen of bytes that have to be cleared twice... and the new ones can't be zeropage.
i havn't done much with turning off the basic/kernel. i flipped a few bits in $01 to try using a sprite at $0300 and everything crashed up - so i'll have to learn some more about how to safely use that zp next
|
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
you dont have to "switch off" the basic or the kernal to use mem at $0300, the machine only crashed on you, since you fucked up the irq vectors at $0314-$0315, simply use a sei to avoid that, or turn off the kernal and basic rom by lda #$35 sta $01, and use fffe/ffff for irq vectors. |
| |
CyberBrain Administrator
Posts: 392 |
All this kefrensbars-talk, made me wonder if it could be done in 256b. So a lame 256b version has been made. |
| |
anix Account closed
Registered: Feb 2004 Posts: 35 |
@CyberBrain: it's good ! i like the sinus low 2-bits seperate from the upper part. probably an old idea but i didn't think of that...
i'm trying to make more complex movement now, trying to sum two different sin-tables when recalculating, and it's not going well.
6502 has no arithmetic shift right ?!? how can i >>1 a signed byte... in a reasonable time
|
| |
WVL
Registered: Mar 2002 Posts: 902 |
anix :
do a cmp #$80, then ror.
if the accu was negative, cmp #$80 will set the carry, and a ror will shift the carry into bit 7, so the result is still negative..
this is a common trick.
|
| |
anix Account closed
Registered: Feb 2004 Posts: 35 |
WVL: thanks for the tip, it works fine.
now i took two offset sin() and summed them together, so i can have some neat movement like hcl & xbow... but of course now my calculation is even slower.
it really sucks that all of the opcodes are so slow - you have to get some big gains from a table before they are worth it, since a big table will take your 4/5 cycles to hit... the only way i see to get back to a single frame now, is to put my spritedata in zero page.
anyone ever use S for an extra place to hold a val during IRQ instead of zero page? seems like nothing should be wrong with that... store S into zero page and restore it after the loop is done
|
| |
WVL
Registered: Mar 2002 Posts: 902 |
anix : maybe you should try to use some illegal opcodes.
see this page for a complete list :
http://oxyron.net/graham/opcodes02.html
anyway, while you're at it, please think about using 3 bytes for storing the bars, instead of 2. This will increase the width of the bars from 5 multicolor pixels to 9 multicolor pixels (almost double!), and it's rather cheap in cycles (only lda #$xx sta sprite).
You only need to store the middle byte directly, there's no need for 'and' and 'or'..
|
| |
anix Account closed
Registered: Feb 2004 Posts: 35 |
WVL: i've looked through the illegals, but they don't seem to do much for me. lax #imm could be fun but it says it's unstable. i saved a number of bytes last night be cutting my recalc loop in two... part1 creates a table of the new sinus (sin,x+sin,y) then part2 reads it and sets up the irq loop. this way, i didn't have to store my counters in zero page.
also copied my 4-byte ora/and tables (yours were exactly like mine, so i'm happy i figured that out :) into 256 byte tables, so that the pixel position doesn't have to be and #3 to get the right one.
next step is to dump my sin+sin table, and write those values directly into the second loop as ldx #$xx, but that won't really gain much.
wider bars will need more cycles in my irq loop that i don't have... |
| |
WVL
Registered: Mar 2002 Posts: 902 |
if the sprites are in zeropage, maybe you could use the illegals with &H -> when storing to zeropage, H=$ff so the &H does nothing. (If I'm not mistaking, don't kill me if I'm wrong ;)))
so you could do Store A and X to zeropage for almost free..
well, you figure it out if you want to show us how it's done ;D |
| |
CyberBrain Administrator
Posts: 392 |
Quote: @CyberBrain: it's good ! i like the sinus low 2-bits seperate from the upper part. probably an old idea but i didn't think of that...
i'm trying to make more complex movement now, trying to sum two different sin-tables when recalculating, and it's not going well.
6502 has no arithmetic shift right ?!? how can i >>1 a signed byte... in a reasonable time
anix: yeah, well, i only think that trick is clever when you don't use double sinus - it was just something i made up. I made a better 256byte version with double sinuses today, and i don't use that trick anymore. |
Previous - 1 | 2 | 3 - Next |