Jump to content
IGNORED

Experimenting with colors changing every HBL


Nop90

Recommended Posts

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
Link to comment
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
Link to comment
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?

Link to comment
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.

 

Link to comment
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.

Link to comment
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
Link to comment
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.

 

Link to comment
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)

 

 

 

 

 

 

Link to comment
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.

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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...