Super VDP
Moderator: BigEvilCorporation
It IS actually very clever !
1 byte per line, containing 8 bits, 1 bit per pixel, 0 = transparent, 1 = not transparent.
Then a Lookup Table.
(Note for myself : beware, the mask may be interlaced or unpacked. The jump table has to be set this way).
I have more than 128kB for tiles, so, room for more than 3000 tiles ! Shoudl be enough ;)
Thank you !
1 byte per line, containing 8 bits, 1 bit per pixel, 0 = transparent, 1 = not transparent.
Then a Lookup Table.
(Note for myself : beware, the mask may be interlaced or unpacked. The jump table has to be set this way).
I have more than 128kB for tiles, so, room for more than 3000 tiles ! Shoudl be enough ;)
Thank you !
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
-
- Interested
- Posts: 38
- Joined: Sun Jun 01, 2008 1:12 pm
- Location: Lyon, France
- Contact:
-
- Interested
- Posts: 38
- Joined: Sun Jun 01, 2008 1:12 pm
- Location: Lyon, France
- Contact:
Sure.
Let r1 = 40516273
Well, I lied. 6 cycles.
Toto©
Let r1 = 40516273
Code: Select all
mov.l UNPACK_MASK,r0
mov r1,r2 ; r2 = 40516273
and r0,r1 r ; r1 = -0-1-2-3
shlr2 r2
shlr2 r2 ; r2 = -4051627
and r0,r2 ; r2 = -4-5-6-7
UNPACK_MASK: dc.l $0F0F0F0F
Well, I lied. 6 cycles.
Toto©
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
-
- Interested
- Posts: 38
- Joined: Sun Jun 01, 2008 1:12 pm
- Location: Lyon, France
- Contact:
-
- Interested
- Posts: 38
- Joined: Sun Jun 01, 2008 1:12 pm
- Location: Lyon, France
- Contact:
Have you read again our previous emails about scrolling, dma, ...ob1 wrote:It IS actually very clever !
1 byte per line, containing 8 bits, 1 bit per pixel, 0 = transparent, 1 = not transparent. Then a Lookup Table.
If fact, I'm not sure using O/W was the best way to speed up the display.
In fact, no worry about that, because you can reload tiles memory for what you need...ob1 wrote:I have more than 128kB for tiles, so, room for more than 3000 tiles ! Shoudl be enough
So you may use :
Banks may allow to use 1 Byte for tile indexing and an efficient reloading management.PPPPXYBBTTTTTTTT
P : palettes (16)
X : real time x flipping
Y : precalculated y flipping
B : banks (4)
T : tiles (256)
2048 tiles used (Y*B*T)
32bit : 64KB
40bit : 80KB
48bit : 96KB
(1 bank for background, 2 banks for foreground, ...)
Last edited by TotOOntHeMooN on Thu May 14, 2009 12:12 pm, edited 4 times in total.
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
Which is precisely why the bit mask is a good idea. If you either don't use OW, or if the OW won't work (as mention with the palette banks and color 0), you need a mask for transparency. That means you have two choices: make a mask at run-time; or provide a mask as part of the sprite data. As the previous posts showed, deriving the mask from existing data takes a LOT of cycles. Using a bit mask means you only need one look up to change from bits to the mask itself, which is fast.TotOOntHeMooN wrote:Have you read again our previous emails about scrolling, dma, ...ob1 wrote:It IS actually very clever !
1 byte per line, containing 8 bits, 1 bit per pixel, 0 = transparent, 1 = not transparent. Then a Lookup Table.
If fact, I'm not sure using O/W was the best way to speed up the display.
-
- Interested
- Posts: 38
- Joined: Sun Jun 01, 2008 1:12 pm
- Location: Lyon, France
- Contact:
I'm sure that bitmask was a nice solution. I just doubt about the O/W.Chilly Willy wrote: Which is precisely why the bit mask is a good idea [...] Using a bit mask means you only need one look up to change from bits to the mask itself, which is fast.
And I think it was more efficient to writting a part of both planes at the same time (because if you see B you can't see A) in a memory buffer an then blit it to the frame buffer.
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
Overwrite is good if your transparency is all or nothing. Alpha effects are what really slow things down if they aren't in hardware.TotOOntHeMooN wrote:I'm sure that bitmask was a nice solution. I just doubt about the O/W.Chilly Willy wrote: Which is precisely why the bit mask is a good idea [...] Using a bit mask means you only need one look up to change from bits to the mask itself, which is fast.
And I think it was more efficient to writting a part of both planes at the same time (because if you see B you can't see A) in a memory buffer an then blit it to the frame buffer.
-
- Interested
- Posts: 38
- Joined: Sun Jun 01, 2008 1:12 pm
- Location: Lyon, France
- Contact:
Yes. Fortunately, no alpha here.Chilly Willy wrote:Overwrite is good if your transparency is all or nothing. Alpha effects are what really slow things down if they aren't in hardware.
With bitmask, you may use some "entries" for doing the good task without any test. This stuf can be used for the "screen" too ...
0 : screen 320x224
1 : clipping border (8x8)
Code: Select all
write_pixel[Clip][Smask][Bmask][Amask](...);
write_pixel[0][0][0][0] -> skip
write_pixel[0][0][0][1] -> write A plane
write_pixel[0][0][1][X] -> write B plane
write_pixel[0][1][X][X] -> write Sprites
write_pixel[1][X][X][X] -> clipping (skip)
For scrolling, you don't have to compute the starting line and column for tiles before writing part of them near the screen border area. Clipping is performed !
Toke less than 10KB, and can be changed, if you need to refrest only parts of it.111111111111111111111111111111111111111111
100000000000000000000000000000000000000001
100000000000000000000000000000000000000001
100000000000000000000000000000000000000001
100000000000000000000000000000000000000001
100000000000000000000000000000000000000001
100000000000000000000000000000000000000001
100000000000000000000000000000000000000001
100000000000000000000000000000000000000001
100000000000000000000000000000000000000001
100000000000000000000000000000000000000001
100000000000000000000000000000000000000001
100000000000000000000000000000000000000001
100000000000000000000000000000000000000001
100000000000000000000000000000000000000001
111111111111111111111111111111111111111111
Last edited by TotOOntHeMooN on Fri May 15, 2009 1:47 pm, edited 3 times in total.
-
- Interested
- Posts: 38
- Joined: Sun Jun 01, 2008 1:12 pm
- Location: Lyon, France
- Contact:
I need to cold my brain.
Another way for drawing all using bit-mask... Front to back !
Steps :
1- init the screen mask.
2- sprite mask AND screen mask, then draw sprite to the FB [...]
3- tile mask AND screen mask, then draw B-plane tile to the FB [...]
4- draw A-plane tile to the FB [...]
Only unclipped pixels will be written, by watching the screen mask.
In all cases, 70KB will be written to the frame buffer.
Another way for drawing all using bit-mask... Front to back !
Steps :
1- init the screen mask.
2- sprite mask AND screen mask, then draw sprite to the FB [...]
3- tile mask AND screen mask, then draw B-plane tile to the FB [...]
4- draw A-plane tile to the FB [...]
Only unclipped pixels will be written, by watching the screen mask.
In all cases, 70KB will be written to the frame buffer.
Last edited by TotOOntHeMooN on Sat May 16, 2009 9:47 pm, edited 16 times in total.