60

Hi all,
time to rewrite some C function to ASM 68K in NEOPHOENIX for speed up the game smile

I'm a total newbie in asm 68K so forgive me for any stupid questions, here's the first one:
//C code: unsigned short code,A; int x,y,yBg,k; yBg=(A&0x1F)+k *VRAM_OFFSET = 0x0800 + (x<<6) + (yBg<<1); *VRAM_VIDEO = 512+code; *VRAM_VIDEO = ((code >> 5)| 0x00 ) << 3; //ASM code: __asm__( "move.w #0x0800, %%d1 \n" // "movw %0, %%d0 \n" // load x from C "lsl.w #0x6, %%d0 \n" //-- x<<6 "add.w %%d0, %%d1 \n" // 0x0800+(x<<6) "movw %1, %%d0 \n" // load y=A & 0x1F from C "andi.w #0x001f, %%d0 \n" // y=(A&0x1F) "movw %2, %%d2 \n" //-- Load k from C in d2 "add.w %%d2, %%d0 \n" // yBg=y+k "lsl.w #0x1, %%d0 \n" // yBg<<1 "add.w %%d0, %%d1 \n" // 0x0800+(x<<6)+(yBg<<1) "move.w %%d1, (0x3C0000) \n" // write data to VRAM_OFFSET "move.w %3, %%d0 \n" // load code from C "move.w %%d0, %%d1 \n" // Backup code into d1 "add.w #0x200, %%d0 \n" // 512+code "move.w %%d0, (0x3C0002) \n" // VRAM_VIDEO in a0 *VRAM_VIDEO = 512+code "and.w #0xffe0, %%d1 \n" "lsl.w #0x3, %%d1 \n" "move.w %%d1, (0x3C0002) \n" // *VRAM_VIDEO VRAM_VIDEO in a0 ((code >> 5) | 0x00 ) << 8 : :"a"(x), "a"(A), "a"(k), "a" (code) :"d0" ,"d1", "d2" );
This code work fine.
The question is: How can I optimize the ASM code? It's possible?

Thanks
Ciao
BEY
RetroIsTheOnlyFuture!

61

NeoPhoenix Rel.0.10 W.I.P.
More functions from C to ASM 68K, this is the first result...



Grazie
Ciao
BEY
RetroIsTheOnlyFuture!

62

BEY (./60) :

The question is: How can I optimize the ASM code? It's possible?
Your code not think we can more optimized.
But you can put faster instruction for example:
"and.w #0xffe0, %%d1 \n" ==> andi.w #0xffe0, %%d1 \n
"add.w #0x200, %%d0 \n" ==>"addi.w #0x200, %%d0 \n"

I find asm inline not very nice (or so it's asm gnu I don't like :P).


it is you who made the graphics? (Yes I find it strange to the 8-bit game on neo geowink ).
I'm curious to see the final result smile

63

Kannagi (./62) :
BEY (./60) :

The question is: How can I optimize the ASM code? It's possible?
Your code not think we can more optimized.
But you can put faster instruction for example:
"and.w #0xffe0, %%d1 \n" ==> andi.w #0xffe0, %%d1 \n
"add.w #0x200, %%d0 \n" ==>"addi.w #0x200, %%d0 \n"

I find asm inline not very nice (or so it's asm gnu I don't like :P).


it is you who made the graphics? (Yes I find it strange to the 8-bit game on neo geowink ).
I'm curious to see the final result smile

Thanks Kannagi,
the graphics are ripped from the Phoenix's ROM.
The real objective of this little project is a working Z80 emulator for NeoGeo hardware with some '80 Arcade Classics to play smile
RetroIsTheOnlyFuture!

64

BEY, I'm curious, how much is emulated and how much is recreated? Do you patched some z80-code?

65

blastar (./64) :
BEY, I'm curious, how much is emulated and how much is recreated? Do you patched some z80-code?

Hi Blastar,
in NEOPHOENIX (or NGCDSGA concept) it's impossible rendering gfx "on the fly" like in MAME because 12Mhz isn't enough, so the tricks are:

RECREATED STUFF
1.Estract GFX and palette from game.rom to C-array
2.Load tile from C-array to NG RAM
3.Convert sample game sound WAV to APDCM-A and fit files into M1, V1 NG music/sound file
4.Clear Screen routine (not in Phoenix.rom) for background GFX scroll (eagles, starfield, boss ship)

EMULATED STUFF
1.All Phoenix rom game but no starfield scroll (Phoenix arcade PCB use hardware chip scroll and actually I do not know how emulate it because double buffering into 12Mhz CPU can't run like MAME+PC)
2.GFX aren't emulated on the fly but tile/palette from NG RAM to video
3.Sound aren't emulated on the fly but sample play

Z80 PATCHED CODE - PHOENIX.ROM GAME ONLY
1.Bypass main Vblank routine
2. Bypass starfield scroll routine (for now, I'm working on it)
3.W.I.P.: Bypass some sound wave generator routine because samples (Phoenix PCB use analog audio circuitry)
RetroIsTheOnlyFuture!

66

that's alot of work and not flexible, are there any other games for this hardware?

67

looks like various bootlegs of Phoenix, as well as two other games called "Pleiads" and "Survival", according to MAME
avatar

68

blastar (./66) :
that's alot of work and not flexible, are there any other games for this hardware?

Yes, that's a lot of work and not flexible but it's only for funny, learn, no commercial purpose and see what NeoGeo HW can do in different directions so far tested.
I like this kind of experiments on underrated hardware despite my almost nonexistent spare time. I know so little about NG hardware and ASM dev, I need to learn still a lot.
Like freem says there are Pleiades and most obscure Survival (by Rock-Ola Mfg. Corp. 1982) , these games can be tested under the actual NG Z80 emu after gfx rip operation (not still standalone tool exists, I have to automate this process for general ripping).
I want to test another Arcade that I loved so much in 1982 EYES EYES ( Digitrex Techstar 1982), I think this task has minor problems to solve because no scroll....I hope..we'll see
i1.gif
RetroIsTheOnlyFuture!

69

Ripping Pleiades ROM GFX into NeoGeo CD memory....Hope it work like Phoenix grin
27_37c55669-87cf-4ec8-85f6-b7269d4ef6b2.jpg
RetroIsTheOnlyFuture!

70

Little improvement in the emulator, now starfield can scroll, more ASM functions and no more eagles sprite flickering....



But still a lot of work to do.... crash

ciao
BEY
RetroIsTheOnlyFuture!

71

Nice !
But the music doesn't sound very Galaga-like tongue
avatar
Zeroblog

« Tout homme porte sur l'épaule gauche un singe et, sur l'épaule droite, un perroquet. » — Jean Cocteau
« Moi je cherche plus de logique non plus. C'est surement pour cela que j'apprécie les Ataris, ils sont aussi logiques que moi ! » — GT Turbo

72

But the music doesn't sound very Galaga-like tongue

Hahhaha Yes it's "only" Deep Purple Royal Philarmonic Orchestra 1969 intro (my favorite live performances ever) #angel# cool
RetroIsTheOnlyFuture!