| |
Conrad
Registered: Nov 2006 Posts: 849 |
Help with coding newschool routines.
Hi there.
Recently I have joined the c64 scene and I would like to start to learn how these new type of routines work.
As a coder, I can only manage to do old school routines such as raster bars, side border, FLD and various others. As for new routines like 3D, checkerboards, plasmas, etc... I am completely baffled with how they work, but am very eager to learn how they work.
I have in the past read various articles about demo coding, but they don't really provide the info I need.
Any volunteers to help me will be much appreciated!
Thanks, CRD.
|
|
... 19 posts hidden. Click here to view all posts.... |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
radiantx, anyone who can do a piece of working 3d code on c64 out of that, without any serious previous knowledge in math and coding should be awarded with a nobel prize. |
| |
Cruzer
Registered: Dec 2001 Posts: 1048 |
I think the major difference between oldskool and newskool effects is that with oldskool fx you basically just need to understand how the C64 works, and with newskool fx you also have to understand an underlying algorithm.
E.g. FLD vs RotoZoom. For FLD the algorithm is pretty simple: Move gfx up/down. Nothing to understand there, so you just need to understand how the computer (i.e. CPU and gfx chip) works.
For RotoZoom you also have to understand the algorithm of rotozooming, i.e. that you have a texture source that you look up in based on traversing some vectors, before you can start coding it. And to make a good looking rotozoomer on C64, it's also necessary to know something about some optimization techniques like loop unrolling, look-up tables etc.
So to summarize, you should learn something about:
1. How the C64 works
2. The algorithms of newskool fx
3. Optimization tricks
|
| |
Conrad
Registered: Nov 2006 Posts: 849 |
Apart from "real-time" routines, are newschool effects usually done outside the IRQ? In other words, i mean....
Set up the IRQ first...
sei
lda #$<irq
ldx #$irq>
sta $0315
stx $0314
lda #$01
sta $d01a
lda #$7f
sta $dc0d
lda #$30
sta $d012
lda #$1b
sta $d011
cli
... Then from this point location, do a loop for a typical newschool routine (e.g. 3D effect) instead of a JMP to itself? |
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
@CRD: That's a bit generalized. :D But yes, some effects are like that for sure. To get the most performance out of a so called new school routine you really want to interleave your math code with your raster code and thus avoid IRQs and the overhead completly etc...
Use interrupts wisely, not because everyone else uses it. For example use timers where appropriate, use raster interruptes where appropritate and use busy waits where appropriate. See all the HW-goodies as your toolbox and use each and every tool where it fits best. Many people for example uses raster IRQs to do a simple scroll + logo + music which really complicates matters IMO. In those cases for the beginner it's much easier to just busy wait for the correct raster positions and do whatever you need to do.
I.e wait for the logo line and set $d011+$d018+$dd00+$d016 appropriate. Then wait for the scroll line and set $d011+$d018+$dd00+$d016 correct and then wait some more and call the music routine + do the scrolling etc..
Yeah well, you'll see what I mean once you start experiment and stop hanging on the forums (hint hint!).. :D
|
| |
Graham Account closed
Registered: Dec 2002 Posts: 990 |
@Cruzer: What algorithms are you talking about? 90% of all newschool effects are simple movelists which are less algorithm than moving a rasterbar over a rasterbar background. |
| |
Cruzer
Registered: Dec 2001 Posts: 1048 |
@Graham: By algorithm I mean how the effect works. Yes, lots of effects can be implemented with simple stuff like lda lut,x / sta screen, but there is still some underlying math and stuff needed for generating the LUT's and the routine.
Also for stuff that's not necessarily very hardcore mathematical, like plasma, it takes a little understanding of the nuts'n'bolts of the routine before you're able to make a nice looking plasma on the C64. I guess the best way for a newbie to get this kind of understanding is to play around with some of these effects in a high level language on a modern machine. |
| |
Scout
Registered: Dec 2002 Posts: 1570 |
Quote:I guess the best way for a newbie to get this kind of understanding is to play around with some of these effects in a high level language on a modern machine.
True dat.
I learned that stuff back in the days on the pc coding it in Pascal and C.
(A cpu with MUL's and DIV's in the assembler opcodeset also helped a lot ;-P)
Also a lot of the magic in (newskool) effects happens in precalced tables. |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
Quote: I think the major difference between oldskool and newskool effects is that with oldskool fx you basically just need to understand how the C64 works, and with newskool fx you also have to understand an underlying algorithm.
E.g. FLD vs RotoZoom. For FLD the algorithm is pretty simple: Move gfx up/down. Nothing to understand there, so you just need to understand how the computer (i.e. CPU and gfx chip) works.
For RotoZoom you also have to understand the algorithm of rotozooming, i.e. that you have a texture source that you look up in based on traversing some vectors, before you can start coding it. And to make a good looking rotozoomer on C64, it's also necessary to know something about some optimization techniques like loop unrolling, look-up tables etc.
So to summarize, you should learn something about:
1. How the C64 works
2. The algorithms of newskool fx
3. Optimization tricks
the philosophical difference between oldskool and newskool, is that oldskool aims to show stuff that looks hardware wise impossible, while newskool is wannabee pc/amiga copies :D |
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
@CRD: I must appologize... I have misread your question all the time. I though you asked how to code OLDSCHOOL routines, not new school. :D We can ofcourse help you with coding new school routines aswell. But the definitions of new school and old school varies from person to person so it would be more simple if you simply tell us what particular routine you do not understand and then we simply help you by explaing how that particular routine works. |
| |
Conrad
Registered: Nov 2006 Posts: 849 |
Quote: @CRD: I must appologize... I have misread your question all the time. I though you asked how to code OLDSCHOOL routines, not new school. :D We can ofcourse help you with coding new school routines aswell. But the definitions of new school and old school varies from person to person so it would be more simple if you simply tell us what particular routine you do not understand and then we simply help you by explaing how that particular routine works.
@Jackasser: No harm done :-)
Well, if you insist of helping a bit, I was wondering how bitmap stretchers/zoomers and colour effects such as raster-benders would work.
BTW, if you don't like discussing raw code or algorithms on the forum, I'll go on IRC instead, as mentioned. |
Previous - 1 | 2 | 3 - Next |