The X68000 games porting experiment

All 680x0 related coding posts in this section please.

Moderators: exxos, simonsunnyboy, Mug UK, Zorro 2, Moderator Team

User avatar
Anima
Atari Super Hero
Atari Super Hero
Posts: 654
Joined: Fri Mar 06, 2009 9:43 am
Contact:

Re: The X68000 games porting experiment

Postby Anima » Mon Nov 26, 2012 12:09 am

EvilFranky wrote:Is the blitter being used in the routines? I'm guessing it wouldn't be as fast as the 030 for these 'small' sprites?


Actually the Blitter is not really helpful in the true color domain. It may be a better choice on the other graphic modes.

Cheers
Sascha

User avatar
Anima
Atari Super Hero
Atari Super Hero
Posts: 654
Joined: Fri Mar 06, 2009 9:43 am
Contact:

Re: The X68000 games porting experiment

Postby Anima » Mon Nov 26, 2012 12:17 am

Ok, another update before I have to go to bed: here's the video of the Galaga 88 gameplay at advanced stages showing the higher sprite count:

http://www.youtube.com/watch?v=7P3WOcDrtKM

And remember: scrolling games are always impressive. :D

Cheers
Sascha

User avatar
CiH
Atari God
Atari God
Posts: 1097
Joined: Wed Feb 11, 2004 4:34 pm
Location: Middle Earth (Npton) UK
Contact:

Re: The X68000 games porting experiment

Postby CiH » Mon Nov 26, 2012 12:29 am

And remember: scrolling games are always impressive. :D


Completely in agreement!
"Where teh feck is teh Hash key on this Mac?!"

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 11990
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: The X68000 games porting experiment

Postby wongck » Mon Nov 26, 2012 12:50 am

CiH wrote:
And remember: scrolling games are always impressive. :D

Completely in agreement!

+ 1
My Stuff: FB/Falcon CT63+CTPCI_ATI_RTL8139 14+512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

EvilFranky
Atari Super Hero
Atari Super Hero
Posts: 846
Joined: Thu Sep 11, 2003 10:49 pm
Location: UK
Contact:

Re: The X68000 games porting experiment

Postby EvilFranky » Mon Nov 26, 2012 1:13 am

Anima wrote:Ok, another update before I have to go to bed: here's the video of the Galaga 88 gameplay at advanced stages showing the higher sprite count:

http://www.youtube.com/watch?v=7P3WOcDrtKM

And remember: scrolling games are always impressive. :D

Cheers
Sascha



Haha! That looks amazing! :mrgreen:

User avatar
Xerus
Moderator
Moderator
Posts: 1176
Joined: Fri Dec 13, 2002 9:31 pm
Location: France

Re: The X68000 games porting experiment

Postby Xerus » Tue Nov 27, 2012 5:03 pm

Anima wrote:
dml wrote:From our conversations about sprites, the code already seem to be quite extensively optimised IMO. Can't think of much useful advice to give! :wink:

(I'll be interested to see what difference TT/FastRAM makes on an otherwise stock 16MHz 030 Falcon, just out of curiosity)


But... but I need another 50% speedup! :roll:

No, just kidding. Your help is really appreciated and most probably I'll come back to you with another issue. ;)

Cheers
Sascha

How many pixels per vbl can you move with your sprites routine?

Otherwise, the idea of ​​adapting the X68000 code is excellent and the implementation is good, bravo :thumbs:

User avatar
Anima
Atari Super Hero
Atari Super Hero
Posts: 654
Joined: Fri Mar 06, 2009 9:43 am
Contact:

Re: The X68000 games porting experiment

Postby Anima » Tue Nov 27, 2012 6:18 pm

Xerus wrote:How many pixels per vbl can you move with your sprites routine?


Actually the code for drawing each 16 x 16 pixel sprite looks like this:

Code: Select all

adda.w  #<offset_to_first_pixel>,a6
move.w  d0,(a6)+
move.w  d1,(a6)+
move.w  d6,(a6)+
move.w  a0,(a6)+
move.l  a3,(a6)+
move.l  a2,(a6)+
move.w  a2,(a6)+
adda.w  #<offset_to_next_pixel>,a6
move.l  a2,(a6)+
move.w  a2,(a6)+
adda.w  #<offset_to_next_pixel>,a6
...
rts


So there is a different routine for each sprite. I know that using "move.l" on non aligned addresses is bad so probably I need to have two different routines for these cases. Obviously the instruction cache doesn't help much either when the sprites are different and too big to fit in 256 bytes (except for the bullets).

Sadly I also need to clear the sprites as well and it looks like this for each sprite:

Code: Select all

adda.w  #<offset_to_first_pixel>,a0
adda.w  #<offset_to_first_pixel>,a1
move.l  (a0)+,(a1)+
move.l  (a0)+,(a1)+
move.l  (a0)+,(a1)+
move.l  (a0)+,(a1)+
move.w  (a0)+,(a1)+
adda.w  #<offset_to_next_pixel>,a0
adda.w  #<offset_to_next_pixel>,a1
move.l  (a0)+,(a1)+
move.w  (a0)+,(a1)+
adda.w  #<offset_to_next_pixel>,a0
adda.w  #<offset_to_next_pixel>,a1
...
rts


As you can see, the clear routine is even slower than the sprite drawing itself. For this code we have also the same cache and addressing issues mentioned above.

Well, it would be nice to speed up things by a factor of two since there are stages with a lot of more sprites compared to the attract mode. Probably I need to limit the sprite drawing per frame and have to implement a frame skipping function. The gameplay speed is very important for this game to get the best experience.

Cheers
Sascha

User avatar
MiggyMog
Atari Super Hero
Atari Super Hero
Posts: 802
Joined: Sun Oct 30, 2005 4:43 pm
Location: Scotland

Re: The X68000 games porting experiment

Postby MiggyMog » Tue Nov 27, 2012 11:58 pm

M coder released source used in TOKI & demos a few years back, may be useful as he had some tips for optimisations for sprites.

I think this is the correct site:-
http://euler.free.fr/AtariST/

P.S. Amazing work on the coversions!
('< o o o o |''| STM,2xSTFM,2xSTE+HD,C-Lab Falcon MK2+HD,Satandisk,Ultrasatandisk,Ethernat.

User avatar
Xerus
Moderator
Moderator
Posts: 1176
Joined: Fri Dec 13, 2002 9:31 pm
Location: France

Re: The X68000 games porting experiment

Postby Xerus » Wed Nov 28, 2012 1:38 am

You should consider this library (for mac), it seems very interesting :)
http://blitpixie.sourceforge.net/
C or 68k asm optimized, several graphics modes including 16-bit (as our near true color), etc..
Source code is available in the archive.

User avatar
sh3-rg
Captain Atari
Captain Atari
Posts: 435
Joined: Thu May 08, 2003 1:33 pm
Location: bolton - england
Contact:

Re: The X68000 games porting experiment

Postby sh3-rg » Wed Nov 28, 2012 2:16 pm

This looks better every time I look, great work, Sascha!
fxXxings to disco mobile
Image

User avatar
CiH
Atari God
Atari God
Posts: 1097
Joined: Wed Feb 11, 2004 4:34 pm
Location: Middle Earth (Npton) UK
Contact:

Re: The X68000 games porting experiment

Postby CiH » Mon Dec 10, 2012 8:17 pm

Time for a bump on this one! :mrgreen:

Any news, or has real life held things up a bit. No pressure either way...
"Where teh feck is teh Hash key on this Mac?!"

User avatar
Anima
Atari Super Hero
Atari Super Hero
Posts: 654
Joined: Fri Mar 06, 2009 9:43 am
Contact:

Re: The X68000 games porting experiment

Postby Anima » Tue Dec 11, 2012 10:05 am

CiH wrote:Any news, or has real life held things up a bit. No pressure either way...


The text layer works but it's not finished yet. I had to find a good display strategy first and this wasn't easy just because of the fact that the game has scrolling stages. So for now the characters are treated as sprites. Obviously and sadly the text layer costs even more performance and I am still not happy with the sprite engine performance in general. In fact, I have an idea for speeding it up but I think this is something for a later release. The reason for this is that I desperately want to have this game running completely at full speed on a stock Falcon. :twisted:

Of course work and RL also has taken its time but I hope to have something ready to release at (or just before) Xmas. :D

Latest screenshots:
ImageImageImage

Cheers
Sascha


User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 11990
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: The X68000 games porting experiment

Postby wongck » Tue Dec 11, 2012 12:28 pm

dml wrote:Looks fantastic.

hear hear.
My Stuff: FB/Falcon CT63+CTPCI_ATI_RTL8139 14+512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

User avatar
CiH
Atari God
Atari God
Posts: 1097
Joined: Wed Feb 11, 2004 4:34 pm
Location: Middle Earth (Npton) UK
Contact:

Re: The X68000 games porting experiment

Postby CiH » Tue Dec 11, 2012 6:51 pm

Thanks for posting back Anima.

As for the screenshots...

Drooool! :mrgreen:
"Where teh feck is teh Hash key on this Mac?!"

seedy1812
Atari User
Atari User
Posts: 33
Joined: Tue May 18, 2010 2:04 pm

Re: The X68000 games porting experiment

Postby seedy1812 » Tue Dec 11, 2012 7:19 pm

For the drawing of the sprites , why not run length them and then use one tight bit of code to draw the areas. You are having to create the code to draw each sprite so creation wise it should not be any different and the same for reading the memory. You just gain a super duper instruction cache increase and no self modifying code.

User avatar
Anima
Atari Super Hero
Atari Super Hero
Posts: 654
Joined: Fri Mar 06, 2009 9:43 am
Contact:

Re: The X68000 games porting experiment

Postby Anima » Thu Dec 13, 2012 12:46 pm

seedy1812 wrote:For the drawing of the sprites , why not run length them and then use one tight bit of code to draw the areas. You are having to create the code to draw each sprite so creation wise it should not be any different and the same for reading the memory. You just gain a super duper instruction cache increase and no self modifying code.


Thanks for your suggestion. Doug also gave me a similar advice and tried it but unfortunately there's actually no speed advantage on a real Falcon. :(

The current sprite clear routine for the 16 x 16 pixel sprites looks like this:

Code: Select all

sprite_engine2_loop2:
   move   (a6)+,d1
   jmi      sprite_engine2_clear_end

   add.l   d1,a0
   add.l   d1,a1

   move   (a6)+,d1
   jmp      sprite_engine2_clear_start(pc,d1.w)

   movem.l   (a0)+,d3-d7/a3-a5   | 16 pixels.
   movem.l   d3-d7/a3-a5,(a1)
   add.l   d2,a1

   jra      sprite_engine2_loop2

   move.l   (a0)+,(a1)+
   move.l   (a0)+,(a1)+
   move.l   (a0)+,(a1)+
   move.l   (a0)+,(a1)+
   move.l   (a0)+,(a1)+
   move.l   (a0)+,(a1)+
   move.l   (a0)+,(a1)+

   jra      sprite_engine2_loop2

   move.l   (a0)+,(a1)+
   move.l   (a0)+,(a1)+
   move.l   (a0)+,(a1)+
   move.l   (a0)+,(a1)+
   move.l   (a0)+,(a1)+
   move.l   (a0)+,(a1)+
   move.l   (a0)+,(a1)+
   move   (a0)+,(a1)+

sprite_engine2_clear_start:
   jra      sprite_engine2_loop2

sprite_engine2_clear_end:


Cheers
Sascha

User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3472
Joined: Sat Jun 30, 2012 9:33 am

Re: The X68000 games porting experiment

Postby dml » Thu Dec 13, 2012 1:06 pm

Anima wrote:Thanks for your suggestion. Doug also gave me a similar advice and tried it but unfortunately there's actually no speed advantage on a real Falcon. :(


Yep - having seen how the drawing works it's hard to imagine the instruction cache will help - the generated code replaces data fetches with instruction fetches and there is even some compression (move.l dx,...) and zero-cost skipping. There is no practical way to make cached data fetches beat that, and in most cases using the instruction cache means some dependence on the data cache (small generic code).

There *is* a way to make the codegeneration faster - in theory - but it is even more complicated to use and the gain would be highly subject to reuse of what is being drawn.

This would involve finding 'common' pieces of sprites - especially 'repeat drawn' sprites - and encoding only small portions of a few pixels as 'generated' code, instead of the whole sprite. The instruction pattern can then be pre-touched (if necessary) and locked to keep the code in the cache if cache space is slightly exceeded, to prevent circular thrashing. An outer state manager (sprites sorted by id, or sprite 'pieces' sorted by id) then draws one common part at multiple destinations using the pre-touched instruction pattern.

This would mean mainly writes occupy the bus - no instruction or data fetches - for some fraction of drawing activity. Each new pattern will incur instruction fetching, but subsequent clones will be amortized.

This is a horrible thing to implement, and useless if you don't have at least 3 (maybe more!) copies of most patterns reused on the screen. OTOH, if the 'reuse' factor rises as the performance problems rise (lets say the same 10 types of sprite are used but 30 are drawn vs the original 10) then the advantage might be interesting.

It would be a lot of work just to find out that there isn't enough sprite reuse - and I'm fairly sure Anima has a pretty good idea of the level of reuse in the game. He'll know whether it's worth going so much trouble - and given the number of sprite types involved and the fact they rotate etc - it's seems likely to be a dead end.

Chances are it's not going to get very much faster without changing the content of the game, or finding a direct way to omit some of the drawing. But I'll be interested to see what ideas surface on this.

User avatar
Anima
Atari Super Hero
Atari Super Hero
Posts: 654
Joined: Fri Mar 06, 2009 9:43 am
Contact:

Re: The X68000 games porting experiment

Postby Anima » Sun Dec 16, 2012 12:12 pm

Hello guys,

finally here it is: the first working and fully playable release of Galaga 88 for the Atari Falcon030.

Current Hatari screenshot:
Image

Please extract the folder "GALAGA88" to your hard disk and start "G88.TOS".

Some notes:

The good:
- runs on RGB/TV and VGA.
- fully playable.
- runs quite well on a 16 MHz Atari Falcon030.

The bad:
- display glitches.
- it needs a 14 MB config.
- performance problems (flickering instead of hickups, scolling stages text layer display problems).
- keyboard control is buggy.
- no sound.

You can play it on the Hatari emulator as well. It's recommended to set the machine speed to 32 MHz though.

This version should run also on accelerated machines with Fast RAM. Can someone please confirm this? ;)

Have fun
Sascha
Last edited by Anima on Sun Dec 16, 2012 12:15 pm, edited 1 time in total.

User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3472
Joined: Sat Jun 30, 2012 9:33 am

Re: The X68000 games porting experiment

Postby dml » Sun Dec 16, 2012 12:15 pm

Anima wrote:Helly guys,
finally here it is: the first working and fully playable release of Galaga 88 for the Atari Falcon030.


W00t. Just in time for the holidays :) nice work.

Anima wrote:This version should run also on accelerated machines. Can someone please confirm this? ;)


I have a couple of speedy Falcons here, still trying to set them up for testing - will give it a try and report back!

User avatar
Anima
Atari Super Hero
Atari Super Hero
Posts: 654
Joined: Fri Mar 06, 2009 9:43 am
Contact:

Re: The X68000 games porting experiment

Postby Anima » Sun Dec 16, 2012 12:19 pm

dml wrote:W00t. Just in time for the holidays :) nice work.


Thanks. :)

dml wrote:I have a couple of speedy Falcons here, still trying to set them up for testing - will give it a try and report back!


This would be really nice. Looking forward to hear about it. :)

Cheers
Sascha

User avatar
simonsunnyboy
Moderator
Moderator
Posts: 4858
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: The X68000 games porting experiment

Postby simonsunnyboy » Sun Dec 16, 2012 1:09 pm

Great effort, seems to work okay over here. I have to boot my Falcon into TOS to make it run, it does not run from FreeMinT.

Otherwise looks great and main gameplay is smooth most of the time.

i would also suggest to support jagpads for input as well and maybe add sound effects in future. Plain repla of sampled effects shouldn't hurt performance much.

But all in all great for making this port work that far :cheers:
Simon Sunnyboy/Paradize - http://paradize.atari.org/ - STOT: http://www.npoi.de/stot/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee

Jabber: simonsunnyboy@atari-jabber.org

User avatar
sh3-rg
Captain Atari
Captain Atari
Posts: 435
Joined: Thu May 08, 2003 1:33 pm
Location: bolton - england
Contact:

Re: The X68000 games porting experiment

Postby sh3-rg » Sun Dec 16, 2012 1:46 pm

going to try this out later, thanks for the release!

ps FreeMint? lol
fxXxings to disco mobile
Image

User avatar
CiH
Atari God
Atari God
Posts: 1097
Joined: Wed Feb 11, 2004 4:34 pm
Location: Middle Earth (Npton) UK
Contact:

Re: The X68000 games porting experiment

Postby CiH » Sun Dec 16, 2012 4:33 pm

* Punches the air in delight! *

One to try when I get back to a proper computer and not a smartphone.

I suspect Hatari will get a major working over during the Xmas break. (Not going to be at home with my Atari collection then, but never mind.)

Nice work getting this far Anima :-)
"Where teh feck is teh Hash key on this Mac?!"

User avatar
Anima
Atari Super Hero
Atari Super Hero
Posts: 654
Joined: Fri Mar 06, 2009 9:43 am
Contact:

Re: The X68000 games porting experiment

Postby Anima » Sun Dec 16, 2012 7:14 pm

simonsunnyboy wrote:Great effort, seems to work okay over here. I have to boot my Falcon into TOS to make it run, it does not run from FreeMinT.


What actually happens when you start it under Mint?

Cheers
Sascha


Social Media

     

Return to “680x0”

Who is online

Users browsing this forum: No registered users and 1 guest