English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 26 February 2019, 23:35   #1
TEG
Registered User

 
Join Date: Apr 2017
Location: France
Posts: 36
Basic question about ligthning a pixel and the associatd cost

My memory of Amiga assembly programming is a bit far and I searched the web but not found a clear explanation.

Let's assume black is colour 0 of the palette and white is colour 15 of the palette.
If I want to light pixel 0,0 from black to white on a 4 bitplanes 300x200 screen, I must make 4 moves of the byte (in binary) 10000000, each byte separated by 320*200=64000 bits. Right?

Last edited by TEG; 27 February 2019 at 00:23.
TEG is offline  
Old 27 February 2019, 01:13   #2
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,538
Quote:
Originally Posted by TEG View Post
If I want to light pixel 0,0 from black to white on a 4 bitplanes 300x200 screen, I must make 4 moves of the byte
Assuming you have 4 bitplanes, which are sufficient for 16 colours, you have to set the pixel in each of the 4 planes, yes.

Quote:
(in binary) 10000000,
Correct. The MSB is the leftmost pixel in the plane's first byte.

Quote:
each byte separated by 320*200=64000 bits. Right?
Only if your bitplanes have a modulo of 0 and are following directly attached to each other in memory. Then the offset to the next plane would be 40*200 = 8000 bytes or 64000 bits.

But it is your choice to allocate bitplanes whereever you want in the Chip RAM. Or you might decide to use interleaved bitplanes, which speeds up blitter operations (then the bitplane-modulo would be 3*40=120 and offset to the next plane would become 40 bytes).
phx is offline  
Old 27 February 2019, 21:53   #3
TEG
Registered User

 
Join Date: Apr 2017
Location: France
Posts: 36
Thanks Phx. All tutorial wrote back in time I read, explain the bitplanes concept and then give the listing of a copperlist to explain how to display something. So you have to decode what the copperlist do and it's confusing and of course nobody state that the same can be achieve with the cpu or the blitter.

Thanks for the modulo hint I had forgot about, but I don't get your 3*40. Isn't it 4*40 (4 bitplans in my example) ?

Another question: on an Amiga with a 16 bits bus, is writing a byte or a word in the memory, have the same cost in term of cpu cycles and bus availability ?
TEG is offline  
Old 27 February 2019, 23:07   #4
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,538
Quote:
Originally Posted by TEG View Post
Thanks for the modulo hint I had forgot about, but I don't get your 3*40. Isn't it 4*40 (4 bitplans in my example) ?
The modulo defines the number of bytes to skip in a plane, after each line. Usually the next line follows directly in memory (modulo=0), but with interleaved bitplanes you have to skip the lines of three other bitplanes to find the next line of your current plane.

Quote:
Another question: on an Amiga with a 16 bits bus, is writing a byte or a word in the memory, have the same cost in term of cpu cycles and bus availability ?
Yes. That's why it is called 16-bit bus.
phx is offline  
Old 28 February 2019, 00:10   #5
TEG
Registered User

 
Join Date: Apr 2017
Location: France
Posts: 36
Quote:
Originally Posted by phx View Post
The modulo defines the number of bytes to skip in a plane, after each line. Usually the next line follows directly in memory (modulo=0), but with interleaved bitplanes you have to skip the lines of three other bitplanes to find the next line of your current plane.

I got it, we must count "after the end of our own line".


Quote:
Originally Posted by phx View Post
Yes. That's why it is called 16-bit bus.
Well, I asked in case special magic would allow to simultaneously use 8 lines for the cpu and the other 8 for, let's say, the blitter.


I was thinking about the blitter and modulo and I guess the blitter have to do multiple operations to wrote to the different addresses the data for each plane and I wonder if it use less cycles than the cpu to do the same. I find a thread about blitter timing here, so I will try to find the answer.
TEG is offline  
Old 09 March 2019, 03:51   #6
Photon
Moderator

Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 4,799
I think the question is answered by PHX, but wanted to say that yes, this is the way of performant graphics for all uses for computers in the MHz range. Bitplanes was the only way to avoid slow framerates. Most computers used strange schemes, which was even worse.

For a single pixel, the CPU will be faster but for anything larger than say 8x8 even for just 1 bitplane, the Blitter which was made to process bitplanes can go faster, since you have to OR or BSET the pixel in place. For clearing you can track your pixels if they're few and use MOVE to clear.

If you intend sequential scanline algorithm plotting, shift into one register per bitplane and write them to (An)+ when full.

And I did phone up Amiga to try to convince them to let us write a byte for a pixel. This was 3 years before Akiko, which was not ideal either. "Just give us a mode!!"

So to make things faster you use these tricks, or to "get the mode!!" you get a graphics card (which also takes its toll on performance).
Photon is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Alien Breed II title pixel by pixel logo removal dex project.Sprites 15 18 August 2015 12:06
CLI basic question: wildcards r0ber7 support.Other 2 18 February 2011 20:18
Elite 2 very basic question need answered dword support.Games 3 19 July 2008 02:41
Basic Question about AmigaOS 3.1 Tbird support.Apps 18 24 January 2003 00:31
Very basic connection question. Muzkat New to Emulation or Amiga scene 2 23 February 2002 13:06

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:22.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.06717 seconds with 13 queries