Jump to content
Nop90

Experimenting with colors changing every HBL

Recommended Posts

39 minutes ago, Cyprian_K said:

nice routine

faster would be unroling the LDA/STA code

Don't think. But try if you want and let me know if you can make it faster.

Share this post


Link to post
Share on other sites

I used a different approach which I think is as fast as it gets.

For each color the code is:

&label1=*+1
    lda #00
    sta $fda0
&label2=*+1
    lda #00
    sta $fdb0

...

Then in the same rasterline after setting up the colors, the values for the next line are set via selfmod-code:

lda luchs_pal+0*102,y
sta label1
lda luchs_pal+1*102,y
sta label2

...

 

Y is the current line and simply increased (as I dont even use HBL but you could take the current line from the register as well).

The data is interleaved such that this works out nicely (you can easily have scrolling images as well as I uploaded once somewhere here).

So there is no need to add 32 or anything each line.

 

Edit:

with this interleave you can store the colors from the table directly

lda table,y
sta $fda0 ...

but lda $1234,Y is slower than lda $1234.

This routine was maxed out for speed.

Edited by enthusi
  • Thanks 1

Share this post


Link to post
Share on other sites
13 hours ago, Nop90 said:

I don't know how may cycles last the scanline

According to my experiments and measurements in 60 Hz display there are 449 CPU cycles in scanline.

 

EDIT: Correction - 453 cycles.

Edited by laoo

Share this post


Link to post
Share on other sites

This technique could be great for splitting screen stuff. Perhaps like Fire and ice!

Run header and footer as hi-colour. Keep the middle as normal 16 colour area.

fireandice.jpg.8ec7773cd176b5df6b35c443e8bc07f5.jpg

Share this post


Link to post
Share on other sites

It could be tricky to run Suzy only after processing header and before processing footer.

Share this post


Link to post
Share on other sites
51 minutes ago, laoo said:

It could be tricky to run Suzy only after processing header and before processing footer.

Why would I need Suzy? The middle area pixels are already in the display page. Suzy would be busy processing the next frame and accessing the draw page.

 

Did I miss something?

Share this post


Link to post
Share on other sites
17 minutes ago, karri said:

Suzy would be busy processing the next frame and accessing the draw page.

Obviously we can't utilize Suzy and alter color registers at the same time. For simpler approach we could use HBL that would do something useful only in header and footer and Mikey is fast enough to burn some cycles in empty HBL handler without much harm. Although I was thinking about something akin enthusi's idea without using HBL and we need a way either to wake up CPU only before drawing header and footer or to use Suzy only when CPU isn't busy - and I was referring to this approach, but I think now it is not practical as we could always use other timer with some lower resolution if we don't want to use HBL.

 

Share this post


Link to post
Share on other sites

How is the moving text on top of hi-colour backdrop created? Without Suzy?

Share this post


Link to post
Share on other sites
11 hours ago, laoo said:

It could be tricky to run Suzy only after processing header and before processing footer.

Why? Suzy is drawing the new frame. Only remember to restart Suzy after HBL did interrupt her.

Share this post


Link to post
Share on other sites
1 hour ago, 42bs said:

Why? Suzy is drawing the new frame. Only remember to restart Suzy after HBL did interrupt her.

As I said the whole thing is trivial when using HBL. I was just thinking about the method without any interrupts but as it's good for whole frame still images, it's essentially useless when Suzy is involved.

Share this post


Link to post
Share on other sites
7 minutes ago, laoo said:

As I said the whole thing is trivial when using HBL. I was just thinking about the method without any interrupts but as it's good for whole frame still images, it's essentially useless when Suzy is involved.

If you want only a parts of the screen (upper/lower) with high-color mode w/o HBL interrupt:

 WAIT_FOR_VBL
 SWITCH_BUF
 FOR TOP_HEIGHT DO
   WAIT_FOR_HBL
   CHANGE_COLOR
 DONE
 Draw next frame
 WAIT_FOR_LOWER_BOUNDERY
 FOR LOW_HEIGHT DO
   WAIT_FOR_HBL
   CHANGE_COLOR
 DONE

 

Edited by 42bs
  • Thanks 1

Share this post


Link to post
Share on other sites

Having a static palette that changes midway could be a cool effect when moving from one leve to the next. During the move you would have up to 32 colours on the screen.

Share this post


Link to post
Share on other sites
9 minutes ago, karri said:

Having a static palette that changes midway could be a cool effect when moving from one leve to the next. During the move you would have up to 32 colours on the screen.

Vertical move should be easy. Horizontal will be tricky and not that exact.

 

Share this post


Link to post
Share on other sites

I really have to try my artistic skills to see what I could get out of this effect.

 

If time permits I could still have a go on the rebel storyline in On Duty. I just got some extra RAM to use :) 

  • Like 1

Share this post


Link to post
Share on other sites
On 2/19/2020 at 10:20 AM, 42bs said:

If you want only a parts of the screen (upper/lower) with high-color mode w/o HBL interrupt:

 WAIT_FOR_VBL
 SWITCH_BUF
 FOR TOP_HEIGHT DO
   WAIT_FOR_HBL
   CHANGE_COLOR
 DONE
 Draw next frame
 WAIT_FOR_LOWER_BOUNDERY
 FOR LOW_HEIGHT DO
   WAIT_FOR_HBL
   CHANGE_COLOR
 DONE

 

and how the whole game/logic/draw sprites/etc is incorporated here? 

I dont get it (unless its for a static image)

 

 

 

 

 

 

Share this post


Link to post
Share on other sites
6 hours ago, solo/ng said:

and how the whole game/logic/draw sprites/etc is incorporated here? 

I dont get it (unless its for a static image)

 

In "Draw next frame"

 

But I noticed (see cpu cycle thread) that "WAIT_FOR_HBL" w/o interrupts is tricky.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...