Posté le 09/12/2013 à 14:17 Membre depuis le 02/01/2003, 1646 messages
salut tlm, effectivement j ai fait une pause mais je suis de retour, je traine sur l irc #neogeodev.
Posté le 09/12/2013 à 18:07 Membre depuis le 11/03/2013, 88 messages
New Rel.005 ISO DOWNLOAD -> http://www.iocero.com/eventdetail.aspx?idEvent=27312

Ciao
BEY
Posté le 23/12/2013 à 15:09Edité par FRONT le 04/01/2014 à 17:25 Membre depuis le 10/12/2010, 192 messages
Hi BEY !

A question for you concerning the sound! what do you think to do for sound FX and BGM in Galaga, or Phoenix ?
creat simply ADPCM-A sound FX? ...


recently, I found on the Net, some tech. Notes concerning the Namco Waveform Sound Generator (WSG) (used in Games like Galaga, Pacman...)

http://www.walkofmind.com/programming/pie/wsg3.htm

My question: is it compatible with other 3-channel Sound Generator, like the Neo's SSG ...

fred/FRONT


REL 0.06 iso (pour Kuk) : Score point bug FIXED!! Download ISO -> http://www.2shared.com/file/Iq2gilDX/NGPhoenix_006.html
Posté le 01/01/2014 à 20:48 Membre depuis le 11/03/2013, 88 messages
Sounds will be the final part of project. I think to play game sound with ADPCM-A sound FX takes from original game and send to NeoGeo audio chip with something like this:

if ( addr >= 0x6000 && addr <= 0x63ff && sound!=null) {
if ( RAM[addr]!=newByte ) {
RAM[addr] = newByte;
if ( newByte==143 ) Play(explosion);
if ( (newByte>101)&&(newByte<107) ) Play(laser);
if ( newByte==80 ) Play(blow);
}
}

if ( addr >= 0x6800 && addr <= 0x6bff && sound!=null ) {
if ( RAM[addr]!=newByte) {
RAM[addr] = newByte;
if ( newByte==12 ) Play(shield);
if ( newByte==2 ) Play(hitSFX);
}
}

I have to learn how to trasform .wav into ADPCM NEOGEO format and write Play() function.

Now I'm working with original Z80's Phoenix code for hack WAIT_VBLANK() and gain several ms for speed up the emulator. It's hard work, hope to find somebody who can help me....
Posté le 04/01/2014 à 15:04 Membre depuis le 06/09/2002, 18630 messages
so i will burn your next version XD
avatarLa Neo Geo CD à son site (en tout cas elle essaye...): http://neogeocdworld.info/
Le forum de la Neo Geo sur Yaronet: forums/264

Un petit site sur l'Atari Falcon avec plein de trucs bon pour votre poussin: http://falcon.ti-fr.com/
Posté le 04/01/2014 à 17:43Edité par FRONT le 06/01/2014 à 11:14 Membre depuis le 10/12/2010, 192 messages
Hi BEY

this link, can Help You Man !

http://www.powerstrike.net/Phoenix/wav.html A collection of sounds from the game Phoenix! smile

ORIGINAL SOUND !!
1. The Emperor's Spaceship Sound. click here for *.wav file (93 Kb)
2. The Emperor's Spaceship Sound***. click here for *.wav file (90 Kb)
3. Eagle Sound 1. click here for *.wav file (16 Kb)
4. Eagle Sound 2. click here for *.wav file (16 Kb)
5. Eagle Flying Sound. click here for *.wav file (62 Kb)
6. Eagle Flying Sound***. click here for *.wav file (92 Kb)
7. Eagle Dying Sound. click here for *.wav file (31 Kb)
8. Small Bird Sound 1. click here for *.wav file (88 Kb)
9. Small Bird Dying Sound 1. click here for *.wav file (27 Kb)
10. Small Bird Dying Sound 2. click here for *.wav file (29 Kb)
11. Red Spaceship Destruction Sound. click here for *.wav file (25 Kb)
12. Red Spaceship Shield Sound. click here for *.wav file (46 Kb)
13. Red Spaceship Shot Sound. click here for *.wav file (7 Kb)
14. Intro Theme 1. click here for *.wav file (472 Kb)
15. Intro Theme 2. click here for *.wav file (225 Kb)
16. Intro Themes 1 & 2 in *.xm format. click here for *.zip file (12 Kb!)

and some other goodies concerning Phoenix in the Homepage of course !

Fred


PS: pour Aider BEY, si quelqu'un peu lui encoder tous ces SFX et BGM, apres les avoir passé en Mono, 18.5 Hz, je pense qu' il apprécierait beaucoup ! merci pour lui ...
Posté le 04/01/2014 à 19:37 Membre depuis le 11/03/2013, 88 messages
Thanks FRONT! I hope somebody help me with Wav2NeoGeo sounds conversion.

Little News: Original Phoenix's source code hack phase is started smile
27_NGDSGA%20(NEOGEO%20CD%20SINGLE%20GAME%20ARCADE)%20Work%20In%20Progress_iocero_2014_01_03_18_03_11_NeoPhoenixDev.jpg
Posté le 07/01/2014 à 00:00 Membre depuis le 10/12/2010, 192 messages
Hi

This is my proposition concerning a Play() function. I must precise that I'm not a programmer, so you will find may be some codes error ...

I find also this Emulator ; with the audio that you use in your own code
https://github.com/mangini/phoenix-dart Phoenix Arcade Emulator for Dart => Download ZIP : audio in '.ogg' format

for example the routine to translate Original sound code to an other one is very similar

----------------------------------------------------------------------
ligne 242 to 262...
if ( addr >= 0x6000 && addr <= 0x63ff) {
if ( peekb(addr)!=newByte ) {
mem[addr] = newByte;
// sound.updateControlA((byte)newByte);
if (!isMute()) {
if ( newByte==143 ) explosionSFX.play ();
if ( (newByte>101)&&(newByte<107) ) play(laserSFX);
if ( newByte==80 ) blowSFX.play ();
}
// canvasGraphics.setFocus(true);
}
}
if ( addr >= 0x6800 && addr <= 0x6bff) {
if ( peekb(addr)!=newByte ) {
mem[ addr ] = newByte;
// sound.updateControlB((byte) newByte);
if (!isMute()){
if ( newByte==12 ) shieldSFX.play ();
if ( newByte==2 ) hitSFX.play ();
}
}

---------------------------------------------------------------


tromb Fichier joint : Play() function.h

FRONT!
Posté le 24/01/2014 à 12:14 Membre depuis le 11/03/2013, 88 messages
Fortunately there aren't a deadline for homebrew coding smile

Meanwhile I have made some upgrade for speed up the emulator with rom hack (I think I'll skip stars bg routine for gain microseconds) and some other emu changes.

The new Y+scroll_reg offset works on the eagles level (yBg=y+((32-(scroll_reg>>3))%32) but I miss some of boss ship yellow tile (I don't know why, maybe wrong new vram offset), I'm still working on a fix.

I have still video clear performance routine problems for eagle level, the original game don't clear old XY BG offset sprites ( like FG sprites) before scroll_reg changes because Phoenix HW uses no software up/down eagles movements but hardware with scroll_reg so I have to clean dirty pixel but code is slow and eagles going to flickering.

//Video Bg Clean before new eagles XY offset by scroll_reg hardware register
if(ScrolRefresh )
{
// write to hardware NG video 320x224 pixel 28x40 tiles
//erase_sprites 1280/32 = 40 tiles -> 2560
i=2560;
*VRAM_OFFSET=0x0800; //256=32*8
while(i--){ *VRAM_VIDEO= 0x00;}
ScrolRefresh=0;
}
Posté le 24/01/2014 à 16:11 Membre depuis le 28/01/2003, 147 messages
I don't really get your offset and size calculation but fastest way to clear a sprite is to set it offscreen with a 0 tile size.

To fast clear set addr (0x8200 + sprite #) to 0x8800

That will unstick sprite, move it offscreen (line 224) and set a 0 tile size.
Posté le 05/02/2014 à 11:54 Membre depuis le 11/03/2013, 88 messages
Thanks HPMAN, I will try.
Posté le 18/04/2014 à 18:25 Membre depuis le 11/03/2013, 88 messages
Too Much Work and No Time in real life but fortunately I have found some time for working into sound engine.

Please don't care about poor quality of sound, this is my first try...

Link Download:

http://www.megafileupload.com/en/file/520612/NGPhoenix-005-nrg.html

Really Thanks to Jeff Kurtz, I thank him for helping me!
Posté le 22/04/2014 à 16:37 Membre depuis le 10/12/2010, 192 messages
Hi Cristiano !

So, your sound engine work now ! ... it's a good news ... with the Jeff Kurtz 's help ... So You have received his 'Neo Sound Builder' tool
You are a lucky Guy smile
-> could you please ask him to share it with the Community Neo-Geo ? (for example on The NG dev wiki ?)
Bye !
frederic
Posté le 23/04/2014 à 11:57 Membre depuis le 11/03/2013, 88 messages
Better Sample, now the sounds are ok! NEOGEOCD ISO LINK DOWNLOAD Rel.006 ->http://www.megafileupload.com/en/file/522278/NGPhoenix-006-nrg.html

@FRONT: You have a Msg !
Posté le 09/06/2014 à 17:52 Membre depuis le 11/03/2013, 88 messages
Finally the scroll_reg hardware register is now emulated.
Now the eagles and Boss Ship are rightly placed in their own position like the original.

The ClearBgLayer code work but is still slow...I have to work on that..
for(ii=0;ii<31;ii++)
{
	i=31;
	while(i){*VRAM_OFFSET = 0x0800+0x40*ii+0x02*i; *VRAM_VIDEO= 0xFF; i--;
}


I can't find the Byte Code related with Eagles and Boss Ship sound effect...
Posté le 11/06/2014 à 10:30 Membre depuis le 11/03/2013, 88 messages
For who interested to argument and want a code template, I have found two solutions for ClearBgLayer routine optimization:

First, like a memcpy:
i=0x0968;
while(++i<0x103E){*VRAM_OFFSET = i; *VRAM_VIDEO= 0x00;}



Second more fast but more code, you can reuse it for other effect on screen:
 for(ii=6;ii<32 ;ii++)
{
	//i=31;
	//while(--i){*VRAM_OFFSET = 0x0800+0x40*ii+0x02*i; *VRAM_VIDEO= 0xFF;}
	//0x0800+off+2=0x0968 off=6
	//0x0800+off+62=0x103E off=31
	off=0x40*ii;
	*VRAM_OFFSET = 0x0800+off+2; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+4; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+6; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+8; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+10; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+12; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+14; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+16; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+18; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+20; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+22; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+24; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+26; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+28; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+30; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+32; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+34; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+36; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+38; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+40; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+42; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+44; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+46; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+48; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+50; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+52; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+54; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+56; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+58; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+60; *VRAM_VIDEO= 0xFF;
	*VRAM_OFFSET = 0x0800+off+62; *VRAM_VIDEO= 0xFF;
}
Posté le 12/06/2014 à 04:57 Membre depuis le 28/01/2003, 147 messages

*VRAM_MODULO = 2;
for(ii=6;ii<32 ;ii++)
{
	*VRAM_OFFSET = 0x0802+(0x40*ii);
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
	*VRAM_VIDEO= 0xFF;
}


Compiler probably going to optimize as a single statement tho, so you should add volatile.

This should be done in asm really.
Posté le 13/06/2014 à 14:32 Membre depuis le 11/03/2013, 88 messages
THX! HPMAN! top
Posté le 14/06/2014 à 03:56 Membre depuis le 28/01/2003, 147 messages
__asm__ (
	"	move.l #0x3C0002, %%a0 \n"
	"	move.w #0x2, 2(%%a0) \n"	//vram modulo
	"	move.w #25, %%d0 \n"		//do 26 times (6-31)
	"	move.w #0x0982, %%d1 \n"	//0x0802 + 0x40*6
	"0: \n"
	"	move.w %%d1, -2(%%a0) \n"	//sets addr
	"	add.w #0x40, %%d1 \n"		//add 0x40 for next
	".rept 31 \n"
	"	move.w #0xff, (%%a0) \n"	//write data
//	"	nop \n"				//uncomment if writing is too fast for LSPC
	".endr \n"

	"	dbra %%d0, 0b \n"		//loop
	:::"d0","d1","a0"
 );


This should do your thing (untested).

Could squeeze out more speed by unrolling the loop. (about 260 cycles)
Posté le 18/06/2014 à 14:55 Membre depuis le 11/03/2013, 88 messages
ASM routine work fine!

Just a little fix with vram moduo set 1 after run:
__asm__ 
(
	"	move.l #0x3C0002, %%a0 \n"
	"	move.w #0x2, 2(%%a0) \n"	//vram modulo
	"	move.w #25, %%d0 \n"	 //do 26 times (6-31)
	"	move.w #0x0982, %%d1 \n"	//0x0802 + 0x40*6
	"0: \n"
	"	move.w %%d1, -2(%%a0) \n"	//sets addr
	"	add.w #0x40, %%d1 \n"	 //add 0x40 for next
	".rept 31 \n"
	"	move.w #0xff, (%%a0) \n"	//write data
	//	"	nop \n"	 //uncomment if writing is too fast for LSPC
	".endr \n"
	"	dbra %%d0, 0b \n"	 //loop
	"	move.l #0x3C0002, %%a0 \n"
	"	move.w #0x1, 2(%%a0) \n"	//vram modulo
	:::"d0","d1","a0"
);


THX !!!! top
Posté le 19/06/2014 à 13:02 Membre depuis le 11/03/2013, 88 messages
Just a little update release, test it with NGCD or Emulator:

27_f97c93aa-9ad5-435b-aca4-e51f1cbaeafa.jpg
NEOPHOENIX Rel. 007 NEOGEO-CD ISO, download here: http://www.iocero.com/fotodetail.aspx?idpost=18057

Back to work tongue
Ciao!
BEY
Posté le 25/06/2014 à 17:45 Membre depuis le 11/03/2013, 88 messages
I don't know why but NeoPhoenix has been compiled successfully in ROM format for MVS/AES (classic puzzledp.zip) but MAME run only NeoGeo test mode. Any suggestions?

27_50711c5e-d852-4767-b7d4-19cf65788938.jpg
Posté le 25/06/2014 à 17:57 Membre depuis le 06/06/2014, 51 messages
If you have a way to run it on AES with the Development/Debug BIOS (typically via MESS, UME, FBA, or whatnot), it might bring up an error message. (Granted, you'd want to have a listing file that shows where all the code is assembled to, in order to figure out where the actual problem is; I'm not sure how you'd do that with the NeoDev kit, though.)
avatar
Posté le 25/07/2014 à 18:48 Membre depuis le 11/03/2013, 88 messages
Thx freem, I'll work on it.

Take some time to enjoy with NeoPhoenix code today:

Some bugfix, adding missing sound effects into eagle level (shoot and hit) and rewrite an macro of Z80 Emu with a little speedup. tongue

Download NEOGEO CD ISO HERE: http://www.megafileupload.com/en/file/553098/NGPhoenix-008-nrg.html


Ciao
BEY
Posté le 26/07/2014 à 21:25 Membre depuis le 06/09/2002, 18630 messages
Hello

So i test it on my neo geo CD front
so i think it's more faster than you other version but i could be more...

so i see a lot of sprite bug
some animation not be present (may be it's too slow)
but at the 3 and 4 level the same bird was present in lot of part of the screen

in the introduction i have two music who begin in some different time

the start botton was probably echanged with the select botton
avatarLa Neo Geo CD à son site (en tout cas elle essaye...): http://neogeocdworld.info/
Le forum de la Neo Geo sur Yaronet: forums/264

Un petit site sur l'Atari Falcon avec plein de trucs bon pour votre poussin: http://falcon.ti-fr.com/
Posté le 27/07/2014 à 20:09 Membre depuis le 11/03/2013, 88 messages
Thanks for your tests and bugs report on real machine KuK
Posté le 22/08/2014 à 10:11 Membre depuis le 21/03/2014, 182 messages
Today, I burned your latest CD and played the game on my top-loader NGCD + Sony PVM CRT. The game runs quite slow but it is playable and I had fun paying it for a whilewink
I have seen some sprite glitches when an enemy explodes (first level) and when a "bird" enemy is moving (third level).

Is there any kind of cheat available for a level selection or god-mode?

How did you made the "Insert Coin" functionality? I would like to add it to my game too - would you maybe provide the code of it?
Posté le 22/08/2014 à 11:28 Membre depuis le 11/03/2013, 88 messages
Hi NeoHomeBrew,
thanks for your playing test on real machine, I'm glad that you enjoyed with this last version.
Still have a lot of work and bugfix to do on NeoPhoenix.
I hope to find some spare time on bug fixed Rel.009 in the future.
It's very funny work on this little project for me oui

There aren't any cheat or god-mode.
After you complete wave 5, it cycles again back to wave 1.
The only difference is in some of the scores and the enemies get faster.
Phoenix FAQ: http://www.gamefaqs.com/arcade/564009-phoenix/faqs/26630


The "Insert Coin" functionality it's very simple, I read the NeoGeo ram button mapping with poll_joystick() and send the result code through hexdata var into Phoenix's hardware emulated ram and the Z80 emu do the rest.
Here's the code:
DWORD input;

// z80 emulator functions
// Reading from buttons 
unsigned Z80_RDMEM (dword A)
{
 hexdata = 0xff;	

	
	// $0000-$3FFF ROM
	if (A < 0x4000)
		return PHOENIX_ROM[A]; 
	else
	// $4000-$4FFF RAM/VRAM
	if (A < 0x5000)
		return (RAM[A-0x4000]);
	else
	if (A < 0x7000)			
		return (0xFF);
	else
	// $7000-$73FF Buttons
	if (A < 0x7400)
	{
		// Reading from buttons port
		input = poll_joystick(PORT1, READ_BIOS);
		if (input & JOY_LEFT ) {
	   //exdata &= ~(1<<6);
	    hexdata &=~0x40;
		}
		if (input & JOY_RIGHT ) {
	    //hexdata &= ~(1<<5);
	    hexdata &=~0x20;
		}
		if (input & JOY_A ) {
	   //hexdata &= ~(1<<4); //  fire
	   hexdata &=~0x10;
		}
		if (input & JOY_B ) {
	    //hexdata &= ~(1<<7); //  shield
	    hexdata &=~0x80;
		}
		if (input & JOY_START){
	   //hexdata &= ~(1<<1);  // 1p start
	   hexdata &=~0x02; 
		}
		if (input & JOY_SELECT){
	   // hexdata &= ~(1<<0);  //  coin 1
	   hexdata &=~0x01;
		}
		return (hexdata);
	}
	else
	if (A < 0x7800)
		return (0xFF);
       else
  // unmapped
	return (0xFF);
}


Grazie!
Ciao
BEY
Posté le 22/08/2014 à 17:30 Membre depuis le 21/03/2014, 182 messages
Hi BEY,

thanks for your answer and the code. Then I have to fight through the 5 levels to see the boss wink

Unfortunately, I can't use the code for my project but it explains a lot. I think I need something in ASM for a real
"coin insert detection" which will work on a real MVS arcade machine. When I have found something
I will post it in my thread.
Posté le 22/08/2014 à 17:55 Membre depuis le 28/01/2003, 147 messages
I didn't play along with it but coinage is handled mostly by the bios on itself, with a few functions related to it available.
See the official doc.
Posté le 02/02/2016 à 17:59 Membre depuis le 11/03/2013, 88 messages
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