$1b is 27 for sure but 22 is 3 bitplans sprites, not 2. That's why I suggest Frank to add a three bitplan sprite to its benchmark so we can compare with generated code of existing demos.exxos wrote:22 sprites, coolWorking on my STFM
$1B is 27 sprites
Please be advised that access to Atari Forum this coming Friday will be sporadic whilst the backend operating system and dependency upgrades are carried out.
little Blitter benchmark demo
Moderators: lp, moondog/.tSCc., Moderator Team
-
- Moderator
- Posts: 683
- Joined: Thu May 23, 2002 10:48 pm
Re: little Blitter benchmark demo
Leonard/OXYGENE.
-
- Fuji Shaped Bastard
- Posts: 4933
- Joined: Fri Mar 28, 2003 8:36 pm
- Location: England
Re: little Blitter benchmark demo
ahhh yep, good pointleonard wrote:$1b is 27 for sure but 22 is 3 bitplans sprites, not 2. That's why I suggest Frank to add a three bitplan sprite to its benchmark so we can compare with generated code of existing demos.exxos wrote:22 sprites, coolWorking on my STFM
$1B is 27 sprites

4MB STFM 1.44 FD- VELOCE+ 020 STE - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - various clutter
http://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
http://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.
http://ataristeven.exxoshost.co.uk/Steem.htm Latest Steem Emulator
http://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
http://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.
http://ataristeven.exxoshost.co.uk/Steem.htm Latest Steem Emulator
-
- Fuji Shaped Bastard
- Posts: 2978
- Joined: Mon Feb 20, 2012 4:42 pm
Re: little Blitter benchmark demo
Cookies were introduced with TOS 1.06 - they are there only to inform, not to use for HW access . There is XBIOS call to test blitter presence - at TOS 1.02, since it is first what supports blitter .exxos wrote:...
YepI am using TOS104, Wasn't there some cookies needed to use the blitter on some programs ?
Famous Schrodinger's cat hypothetical experiment says that cat is dead or alive until we open box and see condition of poor animal, which deserved better logic. Cat is always in some certain state - regardless from is observer able or not to see what the state is.
-
- Moderator
- Posts: 683
- Joined: Thu May 23, 2002 10:48 pm
Re: little Blitter benchmark demo
Yes that's the safest way. Anyway I prefer people testing with hardware register and bus error, just because of SainT issuesAtariZoll wrote:There is XBIOS call to test blitter presence

Program testing blitter using TOS won't work on my strange SainT configuration. ( I admit this is not a problem, just to say

Leonard/OXYGENE.
-
- Fuji Shaped Bastard
- Posts: 2978
- Joined: Mon Feb 20, 2012 4:42 pm
Re: little Blitter benchmark demo
I must say that I find this best compatibility with TOS 1.00 little strange. If blitter emulation is OK, it should work well with 1.02, 1.04 at least.leonard wrote:...
Yes that's the safest way. Anyway I prefer people testing with hardware register and bus error, just because of SainT issuesI explain: I always use SainT with old TOS 1.0 just because it's the best compatible TOS with SainT. As SainT supports STE hardware, STE demos are running fine, even with TOS 1.0.
Program testing blitter using TOS won't work on my strange SainT configuration. ( I admit this is not a problem, just to say)
No other HW extra support in TOS 1.02 and 4 . TOS 1.00 is just slow and problematic with 4 MB RAM . Will not continue list of drawbacks

Famous Schrodinger's cat hypothetical experiment says that cat is dead or alive until we open box and see condition of poor animal, which deserved better logic. Cat is always in some certain state - regardless from is observer able or not to see what the state is.
-
- Atari God
- Posts: 1060
- Joined: Wed Jan 04, 2006 1:28 am
- Location: Glasgow
Re: little Blitter benchmark demo
Pepera the demo uses preshifting. The blitter is still substantially faster there. Even using preshifting you can't beat the blitter for a true masking sprite. As for code gen, well are we sure there is not cheating going on there?
How much cheating would I be allowed to do?
Could I
1) limit the window size and clear all bobs in one pass?
2) copy and not mask the first sprite?
3) inline every function call?
4) precalculate all the coordinate tranforms?
5) align all the sprite data on a 64 kb boundary to save setting the high word of the source address?
I've got an older version with 2 and 3 done.. It does 31 bobs a frame but the code is a mess. I've calculated the max throughput for that size of sprite is 35 bobs a frame excluding bus arbitration. Here are the figures for a 3 plane 32*32 sprite excluding bus arbitration.
Source data is 3 words wide 3 planes deep and 32 lines high.
That's 3 columns wide
r/m/w | r/m/w | m/r
3 + 3 + 2 = 8 bus cycles per plane per line for mask.
3 + 3 + 2 = 8 bus cycles per plane per line for sprite data
16 in total for masking
* 3 planes = 16 * 3 cycles per line = 48 bus cycles
* 32 high = 1,536 bus cycles per bob
clear is
3 words wide per plane * 32
w / w / w * 3 * 32 = 288 bus cycles per bob
3 columns * 3 planes * 32 lines
so excluding set up time we have a total cost of
288 + 1536 = 1,824 bus cycles
There are 40 thousand bus cycles per frame
160,000 / 4 = CPU -> bus cycles
40,000 / 1,824 = 21.9 bobs a frame

Could I
1) limit the window size and clear all bobs in one pass?
2) copy and not mask the first sprite?
3) inline every function call?
4) precalculate all the coordinate tranforms?
5) align all the sprite data on a 64 kb boundary to save setting the high word of the source address?
I've got an older version with 2 and 3 done.. It does 31 bobs a frame but the code is a mess. I've calculated the max throughput for that size of sprite is 35 bobs a frame excluding bus arbitration. Here are the figures for a 3 plane 32*32 sprite excluding bus arbitration.
Source data is 3 words wide 3 planes deep and 32 lines high.
That's 3 columns wide
r/m/w | r/m/w | m/r
3 + 3 + 2 = 8 bus cycles per plane per line for mask.
3 + 3 + 2 = 8 bus cycles per plane per line for sprite data
16 in total for masking
* 3 planes = 16 * 3 cycles per line = 48 bus cycles
* 32 high = 1,536 bus cycles per bob
clear is
3 words wide per plane * 32
w / w / w * 3 * 32 = 288 bus cycles per bob
3 columns * 3 planes * 32 lines
so excluding set up time we have a total cost of
288 + 1536 = 1,824 bus cycles
There are 40 thousand bus cycles per frame
160,000 / 4 = CPU -> bus cycles
40,000 / 1,824 = 21.9 bobs a frame
Last edited by Frank B on Fri Aug 28, 2015 3:44 pm, edited 3 times in total.
-
- Atari God
- Posts: 1060
- Joined: Wed Jan 04, 2006 1:28 am
- Location: Glasgow
Re: little Blitter benchmark demo
I tested on Hatari in stfm config using tos 2x. There is no specific check for the blitter yet. It is more likely I've missed an ste register
I will look later when less jet lagged. edit: It works on that config in hatari but not on the real hw. More testing/bugfixing when I'm not jet lagged 


Last edited by Frank B on Fri Aug 28, 2015 3:55 pm, edited 1 time in total.
-
- Atari God
- Posts: 1060
- Joined: Wed Jan 04, 2006 1:28 am
- Location: Glasgow
Re: little Blitter benchmark demo
If the sprite is 32*31 in three planes the max theoretical through put will be slightly higher.
3 columns wide sprite
r/m/w | r/m/w | m/r
3 + 3 + 2 = 8 bus cycles per plane per line for mask.
3 + 3 + 2 = 8 bus cycles per plane per line for sprite data
16 in total for masking
* 3 planes = 16 * 3 cycles per line = 48 bus cycles
* 31 high = 1,488 bus cycles per bob
clear is
3 words wide per plane * 31
w / w / w * 3 * 32 = 279 bus cycles per bob
3 columns * 3 planes * 31 lines
so excluding set up time we have a total cost of
279 + 1488 = 1,767 bus cycles
There are 40 thousand bus cycles per frame
160,000 / 4 = CPU -> bus cycles
40,000 / 1,767 =22.6 bobs a frame
Now let's look at the clear routine. It is clearing each sprite individually at 279 bus cycles a bob. That's 22 * 279 == 6,138 bus cycles (words cleared).
There's 32000 bytes in a screen which is 8000 bytes per plane or 4000 words. If I limited the bob movement to half the screen I'd only need to clear 4000 words. That would allow for more bobs. Some of these optimisations are a bit silly though. I'd prefer general purpose code which could be used in a game.
3 columns wide sprite
r/m/w | r/m/w | m/r
3 + 3 + 2 = 8 bus cycles per plane per line for mask.
3 + 3 + 2 = 8 bus cycles per plane per line for sprite data
16 in total for masking
* 3 planes = 16 * 3 cycles per line = 48 bus cycles
* 31 high = 1,488 bus cycles per bob
clear is
3 words wide per plane * 31
w / w / w * 3 * 32 = 279 bus cycles per bob
3 columns * 3 planes * 31 lines
so excluding set up time we have a total cost of
279 + 1488 = 1,767 bus cycles
There are 40 thousand bus cycles per frame
160,000 / 4 = CPU -> bus cycles
40,000 / 1,767 =22.6 bobs a frame

Now let's look at the clear routine. It is clearing each sprite individually at 279 bus cycles a bob. That's 22 * 279 == 6,138 bus cycles (words cleared).
There's 32000 bytes in a screen which is 8000 bytes per plane or 4000 words. If I limited the bob movement to half the screen I'd only need to clear 4000 words. That would allow for more bobs. Some of these optimisations are a bit silly though. I'd prefer general purpose code which could be used in a game.
Last edited by Frank B on Fri Aug 28, 2015 4:06 pm, edited 1 time in total.
-
- Fuji Shaped Bastard
- Posts: 4933
- Joined: Fri Mar 28, 2003 8:36 pm
- Location: England
Re: little Blitter benchmark demo
Try TOS104Frank B wrote:I tested on Hatari in stfm config using tos 2x. There is no specific check for the blitter yet. It is more likely I've missed an ste registerI will look later when less jet lagged. edit: It works on that config in hatari but not on the real hw. More testing/bugfixing when I'm not jet lagged


4MB STFM 1.44 FD- VELOCE+ 020 STE - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - various clutter
http://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
http://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.
http://ataristeven.exxoshost.co.uk/Steem.htm Latest Steem Emulator
http://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
http://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.
http://ataristeven.exxoshost.co.uk/Steem.htm Latest Steem Emulator
-
- Atari God
- Posts: 1060
- Joined: Wed Jan 04, 2006 1:28 am
- Location: Glasgow
Re: little Blitter benchmark demo
I didexxos wrote:Try TOS104Frank B wrote:I tested on Hatari in stfm config using tos 2x. There is no specific check for the blitter yet. It is more likely I've missed an ste registerI will look later when less jet lagged. edit: It works on that config in hatari but not on the real hw. More testing/bugfixing when I'm not jet lagged
Actually I would have thought checking for the blitter or not was not a huge thing, as it would just crash without a blitter or something, though the blitter is there in my STFM, and working with that other demo. So can't be much wrong


Last edited by Frank B on Fri Aug 28, 2015 4:10 pm, edited 1 time in total.
-
- Fuji Shaped Bastard
- Posts: 4933
- Joined: Fri Mar 28, 2003 8:36 pm
- Location: England
Re: little Blitter benchmark demo
My STFM has 4MBFrank B wrote:
I didIt is likely a bug on my side which doesn't show up in the emulator. How much RAM do you have?

4MB STFM 1.44 FD- VELOCE+ 020 STE - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - various clutter
http://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
http://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.
http://ataristeven.exxoshost.co.uk/Steem.htm Latest Steem Emulator
http://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
http://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.
http://ataristeven.exxoshost.co.uk/Steem.htm Latest Steem Emulator
-
- Moderator
- Posts: 683
- Joined: Thu May 23, 2002 10:48 pm
Re: little Blitter benchmark demo
I agree with all your calculation, but 22.6 is theorical speed, without blitter setup. For a 32*31 sprite, blitter setup time per sprite is not small, so you can remove maybe one or two sprites if you take setup in account. More than that: your calculation is sprite clear and draw only ! In the MCoder demo you don't count the curve calculation and the 4 pixels 1 plan scroller. (you can forget the music because it's pre-rendered).Frank B wrote:40,000 / 1,767 =22.6 bobs a frame
Honestly I think it will be really hard to beat MCoder sprite demo using blitter on STE.
Leonard/OXYGENE.
-
- Atari God
- Posts: 1060
- Joined: Wed Jan 04, 2006 1:28 am
- Location: Glasgow
Re: little Blitter benchmark demo
Possibly but we're comparing general purpose code against demo codeleonard wrote:I agree with all your calculation, but 22.6 is theorical speed, without blitter setup. For a 32*31 sprite, blitter setup time per sprite is not small, so you can remove maybe one or two sprites if you take setup in account. More than that: your calculation is sprite clear and draw only ! In the MCoder demo you don't count the curve calculation and the 4 pixels 1 plan scroller. (you can forget the music because it's pre-rendered).Frank B wrote:40,000 / 1,767 =22.6 bobs a frame
Honestly I think it will be really hard to beat MCoder sprite demo using blitter on STE.


It would be trivial for me to animate each bob for instance. I suspect his is hard coded

See my point about limiting the screen area too. I believe his demo does this so I could claw back some time there.
There's a comment on the thread saying the sprite is mostly 2 planes with a tiny bit in the third plane.. probably the eyes

Can I cheat like that too and limit the size of the 3rd plane?

Last edited by Frank B on Fri Aug 28, 2015 5:04 pm, edited 3 times in total.
-
- Atari God
- Posts: 1060
- Joined: Wed Jan 04, 2006 1:28 am
- Location: Glasgow
Re: little Blitter benchmark demo
exxos wrote:Try TOS104Frank B wrote:I tested on Hatari in stfm config using tos 2x. There is no specific check for the blitter yet. It is more likely I've missed an ste registerI will look later when less jet lagged. edit: It works on that config in hatari but not on the real hw. More testing/bugfixing when I'm not jet lagged
Actually I would have thought checking for the blitter or not was not a huge thing, as it would just crash without a blitter or something, though the blitter is there in my STFM, and working with that other demo. So can't be much wrong
Adding a specific test for the blitter is on the todo list. edit: I'll add a bus error handler access for those using saint

-
- Moderator
- Posts: 683
- Joined: Thu May 23, 2002 10:48 pm
Re: little Blitter benchmark demo
I totally agree with you. My bad for those TOS incompatibility in SainT. The main problem is that I never really investigate to fix TOS emulation problems I'm focused on making demos more compatible. I know the many TOS incompatibility and lack of HDD support make people prefer other emulators.AtariZoll wrote:I must say that I find this best compatibility with TOS 1.00 little strange. Will not continue list of drawbacks
Anyway I personnaly use SainT to see old demos just because of the CRT video emulation and gamma correction. Looking at an old demo with floppy sound and CRT emulation is priceless

Leonard/OXYGENE.
-
- Fuji Shaped Bastard
- Posts: 2978
- Joined: Mon Feb 20, 2012 4:42 pm
Re: little Blitter benchmark demo
Well, I will not go here in some calculations, but will do some test proggie little different:
Low res, with typical 4bpp, masked sprite of 32x32 px . I did already some code for drawing with CPU, so need only blitter code.
Will use some picture as background - then saving background in detail before draw is mandatory .
Or maybe just 16x32 px sprites - that would match better 32x32 in medium res.
Low res, with typical 4bpp, masked sprite of 32x32 px . I did already some code for drawing with CPU, so need only blitter code.
Will use some picture as background - then saving background in detail before draw is mandatory .
Or maybe just 16x32 px sprites - that would match better 32x32 in medium res.
Famous Schrodinger's cat hypothetical experiment says that cat is dead or alive until we open box and see condition of poor animal, which deserved better logic. Cat is always in some certain state - regardless from is observer able or not to see what the state is.
-
- Atari God
- Posts: 1060
- Joined: Wed Jan 04, 2006 1:28 am
- Location: Glasgow
Re: little Blitter benchmark demo
Well if you're confident you can match the blitter with preshifting I can spec the function for you to write. We can plug it in and compare.AtariZoll wrote:Well, I will not go here in some calculations, but will do some test proggie little different:
Low res, with typical 4bpp, masked sprite of 32x32 px . I did already some code for drawing with CPU, so need only blitter code.
Will use some picture as background - then saving background in detail before draw is mandatory .
Or maybe just 16x32 px sprites - that would match better 32x32 in medium res.
I'm pretty confident my preshift function is fast and the blitter is much quicker. You can test this with 3 and 4 keys in the intro.
$19 hex vs $13 for the CPU preshifter. That's nowhere near as fast as the blitter

-
- Fuji Shaped Bastard
- Posts: 3998
- Joined: Sun Jul 31, 2011 1:11 pm
Re: little Blitter benchmark demo
Sounds like bug in Hatari. Which version you're using? Can you give more details on what worked in Hatari, but not on real HW?Frank B wrote:It is likely a bug on my side which doesn't show up in the emulator.
-
- Atari God
- Posts: 1060
- Joined: Wed Jan 04, 2006 1:28 am
- Location: Glasgow
Re: little Blitter benchmark demo
Hi. I don't know the details yet as I haven't reproduced the issue on real hardware yet. Will let you know as soon as I've fixed it.
-
- Fuji Shaped Bastard
- Posts: 4933
- Joined: Fri Mar 28, 2003 8:36 pm
- Location: England
Re: little Blitter benchmark demo
Right, so the V7 one I confirm is working on TOS104 STFM. For some reason the program was quitting during loading, despite I still had previous versions on my floppy and despite re-copying it form the zip to floppy.. strange.. but magically started working again
Anyway, No bugs other than when it goes over to 2VBL the screen starts juddering, I can't see anything else wrong at first glance

Anyway, No bugs other than when it goes over to 2VBL the screen starts juddering, I can't see anything else wrong at first glance

4MB STFM 1.44 FD- VELOCE+ 020 STE - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - various clutter
http://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
http://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.
http://ataristeven.exxoshost.co.uk/Steem.htm Latest Steem Emulator
http://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
http://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.
http://ataristeven.exxoshost.co.uk/Steem.htm Latest Steem Emulator
-
- Atari God
- Posts: 1148
- Joined: Tue May 15, 2012 9:15 am
- Location: Barcelona
Re: little Blitter benchmark demo
V.7 on a:
STe 1.62 SP TOS: VBL $01 Bob count: $19 and BLITTER renderer active
MSTe 2.06 UK TOS: VBL $01 Bob count: $19 and BLITTER renderer active: Same
If needed I can test it later on a Mega ST 1.04 TOS...is it?
STe 1.62 SP TOS: VBL $01 Bob count: $19 and BLITTER renderer active
MSTe 2.06 UK TOS: VBL $01 Bob count: $19 and BLITTER renderer active: Same
If needed I can test it later on a Mega ST 1.04 TOS...is it?
Learning...
-
- Atari God
- Posts: 1060
- Joined: Wed Jan 04, 2006 1:28 am
- Location: Glasgow
Re: little Blitter benchmark demo
Coolexxos wrote:Right, so the V7 one I confirm is working on TOS104 STFM. For some reason the program was quitting during loading, despite I still had previous versions on my floppy and despite re-copying it form the zip to floppy.. strange.. but magically started working again![]()
Anyway, No bugs other than when it goes over to 2VBL the screen starts juddering, I can't see anything else wrong at first glance

By juddering do you just mean a lowered framerate or is there some corruption?

-
- Atari God
- Posts: 1060
- Joined: Wed Jan 04, 2006 1:28 am
- Location: Glasgow
Re: little Blitter benchmark demo
Thanksqq1975b wrote:V.7 on a:
STe 1.62 SP TOS: VBL $01 Bob count: $19 and BLITTER renderer active
MSTe 2.06 UK TOS: VBL $01 Bob count: $19 and BLITTER renderer active: Same
If needed I can test it later on a Mega ST 1.04 TOS...is it?

So the next step after this is adding an 030 renderer, a greetings update

-
- Fuji Shaped Bastard
- Posts: 4933
- Joined: Fri Mar 28, 2003 8:36 pm
- Location: England
Re: little Blitter benchmark demo
Frank B wrote:
By juddering do you just mean a lowered framerate or is there some corruption?
I mean the entire screen seems to jump upwards and then back down again when it gets on 2VBL.. I can try and take a video...
http://exxoshost.co.uk/temp/DSCN2371.avi (156MB)
Its odd, as if you watch the speed of the bobs from about 1:10, then about 1:20 they actually speed up for a couple seconds, then go back to normal speed again... odd..
4MB STFM 1.44 FD- VELOCE+ 020 STE - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - various clutter
http://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
http://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.
http://ataristeven.exxoshost.co.uk/Steem.htm Latest Steem Emulator
http://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
http://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.
http://ataristeven.exxoshost.co.uk/Steem.htm Latest Steem Emulator
-
- Atari God
- Posts: 1060
- Joined: Wed Jan 04, 2006 1:28 am
- Location: Glasgow
Re: little Blitter benchmark demo
Oh that's odd. It looks like the text is jumping from frame to frame!exxos wrote:Frank B wrote:
By juddering do you just mean a lowered framerate or is there some corruption?
I mean the entire screen seems to jump upwards and then back down again when it gets on 2VBL.. I can try and take a video...
http://exxoshost.co.uk/temp/DSCN2371.avi (156MB)
Its odd, as if you watch the speed of the bobs from about 1:10, then about 1:20 they actually speed up for a couple seconds, then go back to normal speed again... odd..
Anyone else seeing this? Perhaps the vbl is being delayed and the video base registers aren't being updated in time. If it happens even if one bob is active it might be the alignment is wrong on one screen. More bugs to fix I think

The speed up is just because the teletype is paused and not printing chars just before the fade

