Author Topic: Example asm program: rasterline-plasma, step by step  (Read 7016 times)

0 Members and 1 Guest are viewing this topic.

Offline Overflow

  • Supporter
  • CPC664
  • *
  • Posts: 60
  • Country: fr
  • Liked: 175
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

« Last Edit: 16:48, 07 November 16 by Overflow »
Unregistered from CPCwiki forum.

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 10.103
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1967
Re: Example asm program: rasterline-plasma, step by step
« Reply #1 on: 05:55, 08 November 12 »
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

Offline rexbeng

  • CPC6128
  • ****
  • Posts: 192
  • Country: gr
  • Small resolutions, big ideas
    • index.php?action=treasury
  • Liked: 101
Re: Example asm program: rasterline-plasma, step by step
« Reply #2 on: 05:56, 08 November 12 »
Hey, great to see OVF walking amongst us. Where have you been all this time? :P


rb
« Last Edit: 10:46, 08 November 12 by rexbeng »

Offline Overflow

  • Supporter
  • CPC664
  • *
  • Posts: 60
  • Country: fr
  • Liked: 175
Re: Example asm program: rasterline-plasma, step by step
« Reply #3 on: 09:12, 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]
« Last Edit: 09:29, 08 November 12 by Overflow »
Unregistered from CPCwiki forum.

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.140
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 1965
Re: Example asm program: rasterline-plasma, step by step
« Reply #4 on: 11:09, 08 November 12 »
I want to like this thread more than once.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.140
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 1965
Re: Example asm program: rasterline-plasma, step by step
« Reply #5 on: 11:21, 08 November 12 »
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

Online SuTeKH/Epyteor

  • 6128 Plus
  • ******
  • Posts: 1.161
  • Country: 00
  • Liked: 1015
Re: Example asm program: rasterline-plasma, step by step
« Reply #6 on: 11:38, 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!

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 14.137
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 2343
Re: Example asm program: rasterline-plasma, step by step
« Reply #7 on: 13:55, 08 November 12 »
Quote from: arnoldemu
I want to like this thread more than once.
You can.

Also, great read for lunch time :)

Offline Overflow

  • Supporter
  • CPC664
  • *
  • Posts: 60
  • Country: fr
  • Liked: 175
Re: Example asm program: rasterline-plasma, step by step
« Reply #8 on: 20:21, 08 November 12 »
(...) source code here is tiny (...)
Well, I didn't mean as tiny as 256 bytes.  :o

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.

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.140
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 1965
Re: Example asm program: rasterline-plasma, step by step
« Reply #9 on: 20:47, 08 November 12 »
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