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 > Requests > Help with coding newschool routines.
2007-01-14 01:44
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....
 
2007-01-14 21:18
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.
2007-01-15 12:31
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
2007-01-15 13:13
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?
2007-01-15 15:41
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
2007-01-15 17:14
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.
2007-01-15 21:01
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.
2007-01-15 21:17
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.
2007-01-17 09:49
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
2007-01-17 10:24
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.
2007-01-17 11:13
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
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
ΛΛdZ
Mike
encore
WVL/Xenon
MWR/Visdom
grennouille
deetsay
rime/Fancy Rats
Peacemaker/CENSOR/Hi..
Mibri/ATL^MSL^PRX
Guests online: 125
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 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (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 Censor Design  (9.3)
5 Triad  (9.3)
Top Fullscreen Graphicians
1 Joe  (9.7)
2 Sulevi  (9.6)
3 The Sarge  (9.6)
4 Veto  (9.6)
5 Facet  (9.6)

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