Example asm program: rasterline-plasma, step by step

Started by Overflow, 22:40, 07 November 12

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Overflow

October 2010: a friend (guess who!) asked for explanation about single-line-splitting.
He wanted to be able to perform his own fx tests based on this hardware trick.
Here's the full archive, some of you may find it useful.
opti.zip

It contains a dsk with binaries, and then their z80 sources.
Step by step, some new lines are added into the original source code:
it starts with interruptions only to show synchro checkpoints,
then it evolves from simple splitscreen up to single-line-splitting.
Last, 64 static lines are used to perform a plasma fx.
clic to display

RUN"-INIT
save a snapshot: it loads some initialization files
then here we go, always run after -INIT has been runned or restored from sna:
RUN"-1 --> nothing but shows 2 synchros
RUN"-2 --> 2 split-screen by using these synchro
RUN"-3 --> 1st part of screen has now as split: 1 char-line (8 pixels height)
RUN"-4 --> 1st part of screen has now as split: 1 scan-line
RUN"-5 --> 156 (=160-2-2) splitlines in unrolled loop
RUN"-6 --> splitlines now get their vram base changed
RUN"-7 --> switch to 64 lines, screen width fixed
RUN"-8 --> 1 indexed table to read every requested line number
RUN"-9 --> very 1st dynamic splitting (adding 3 indexed-tables)
RUN"-A --> nice colors, curve, and sin-tables
RUN"-B --> switch to larger screen and some... fixes
clic to display

I agree this might be hard to understand since it's not commented.
Could be used as a basis for live discussion?
Well, don't know, but anyway here it is!

Also attached an extract from a own doc, in French only,
which shows (or tries to) how the (C64) plasma runs.

plasma.pdf

Unregistered from CPCwiki forum.

TFM

My French is... not worth to be mentioned...
So, does it precalculate the GFX and then switch to other VRAM addresses during the scan line?
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

rexbeng

Hey, great to see OVF walking amongst us. Where have you been all this time? :P


rb

Overflow

Quote from: TFM/FS on 05:55, 08 November 12
So, does it precalculate the GFX and then switch to other VRAM addresses during the scan line?

Yes. "-7SCR.BAS" precalculates screen "OPTI7.SCR" from which a 64-lines-height sprite is taken.
RUN"-8 displays those lines, ordered, cycling: 0 to 63 then 0 to 63 again, etc.
RUN"-9 displays them not ordered but indexed(?): # of line to display = (some sinus) + (some sinus) modulo 64
Let's see: 0 1 2 3 3 4 4 4 5 5 5 5 5 4 4 4 3 3 2 1 0 ==> this would generate symetry = somes "eyes" on the screen.

Not so offtopic? source code here is tiny, it just requires some knowledge about how to get single-line splitting.
"Yap!" has some other features, the most interesting one answers the question: but the gfx evolves in time?
Yes it does. Let's watch the beginning: it slowly changes from a flat gfx to a gfx like the one in this thread.
Slowly means: at each frame, changing only very few one-byte-witdh columns in the gfx,
each changed column is only shifted one pixel up or down.


[Edited several times: not easy to (try to) give clear explanations]
Unregistered from CPCwiki forum.

arnoldemu

I want to like this thread more than once.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

arnoldemu

If it's R4=1, R9=7 then crtc type 2 should run it fine. :)
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

tastefulmrship

Quote from: arnoldemu on 11:09, 08 November 12
I want to like this thread more than once.
Indeed! It's always fascinating for me to learn how people manipulate the CPC hardware to produce such spectacular effects... and at such high speed, too!


A simple thanks is really not enough, Overflow! When there are words in the English language to express our gratitude for this thread, then rest assured a lot of us will be using them!

Gryzor

Quote from: arnoldemuI want to like this thread more than once.
You can.

Also, great read for lunch time :)

Overflow

Quote from: Overflow on 09:12, 08 November 12
(...) source code here is tiny (...)
Well, I didn't mean as tiny as 256 bytes.  :o

Quote from: arnoldemu on 11:21, 08 November 12
If it's R4=1, R9=7 then crtc type 2 should run it fine. :)
Actually it's R4=R9=0 since opti4.z80
Yap! has R4=0 but R9=1 so yes it is crtc2 compatible.
The nice thing is for crtc1: R12&13 are changed each rasterline,
but only crtc1 acknowledges change for the 2nd rasterline within character line.
Check on winape also: Y resolution is 1 pixel on crtc1,
whereas it is 2 pixels on other emulated crtcs.
Hmmm... Whoever understands what I mean is prepared to code a good fx.  8)

Unregistered from CPCwiki forum.

arnoldemu

Yes I understand you. :)

I prefer to write games more than demos.


My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

TFM

Quote from: Overflow on 09:12, 08 November 12
[Edited several times: not easy to (try to) give clear explanations]
Thanks' a lot for explaining :)  That was easy to understand :)  Gotta go and watch YAP! again  ;) ;) ;)  Happy Friday!
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

MacDeath

#11
Quotesource code here is tiny
Obviously, as the "Demo" you recently released features a sweet chiptune and even some text+effect in the endcredit...
Basically, isn't the plasma even just a 256bytes effect ? perhaps 512bytes at best...
(provided not endcredit, no chiptune nor rasters and palettes changes as you did).


QuoteWhen there are words in the English language to express our gratitude for this thread, then rest assured a lot of us will be using them!
QuoteFeck! Arse! Girls! Drink!
hahahaha.. ;)

Powered by SMFPacks Menu Editor Mod