1

Hello

Someone know a way to put asm code in NeoDev.

We want read a sprite memory and move in another memory to change the order of Draw list.

We see here : https://wiki.neogeodev.org/index.php?title=VRAM

$8600 $867F Sprite list for even scanlines
$8680 $86FF Sprite list for odd scanlines

If we use SpriteInit , Neodev own his order list of sprite . And we want to change le order in memory, if we have create sprite 1 before sprite 2
we want change in memory by Sprite2 before Sprite 1

Thanks For your help
avatar

2

Thanks to Black_Jack, now we can insert the asm with __asm __ ("move.w ...");

I can write VRAM with 0x3C000X

So I'd like now to change the display order of sprites. I have my first sprite 1 and the second in 2 one above the other. I think (with the docs) the first sprite is in 0x0040 or 64 in decimal and I would swap the two sprites. 0x0040 <-> 0x0080.

Do we must copy via temporary variables every word of 64-128 and how we do it ?

If someone can give us a clue, please, please.

3

sounds interesting but this is not yet documented (only m.a.m.e. source refers to this locations) so I have done some tests (on hardware):

pro:
- this memorylocations are writable
- you can change drawing order of sprites

con:
- this memory is updated/rewritten every scanline(!) by the system itself (so it's just for internal use?)
- manual rewrite/update have to be done every scanline (via irq2)
- update is slow (via VRAM_ADDR/VRAM_RW), only 3 oder 4 sprite changes are possible per scanline

sorry, it seems this idea ist very limited and not practicable. :-(

4

Thanks for your answer and tests.

Can you share the code for "change drawing order of sprites" so I can make some test in my code. smile

If this idea is not praticable, do you use an another way to ordering sprites?

5

be warned, you will see no effect until you set this every scanline. i put this litte code into wait_vblank without doing anything in mainloop.
screenshots are from mame but on real hardware it works and looks the same.

this example shows 1st sprite (0x0040 = $1) vs last sprite (0x5f00 = $17c = #380)

spriteorder.png

6

many many thanks, I'll try that top

7

another way to ordering sprites? it depends how many sprites you use.
the easiest way is to make a sprite for every layer and to "disable" unneeded sprites by moving it out of screen (ypos+240).

8

I wish to try making game like sengoku 3, a side-scrolling beat up game. So my sprite order change often, I don't think I can use multiple sprite on different layers. The sprite moving in a third dimension forcing me to use the scb_even / scb_odd.

I use the .Datlib framework from HPMan and It's already using a Vblank function. I think I need to write my own vblank to change the sprite order.

I success with the sprite order, with a vblank function (I understand, we need to change the 96 lin sprite every blank) but I can't go out my new Vblank function. Infinite loop ?
Vblank2: MOVE.W #0x1,0x3C0004 MOVE.W #0x8600+1,0x3C0000 MOVE.W #0x02,0x3C0002 MOVE.W #0x1,0x3C0002 MOVE.W #0x8680+1,0x3C0000 MOVE.W #0x02,0x3C0002 MOVE.W #0x1,0x3C0002 cmp.w #1, 0x100000 bne Vblank2 clr.w 0x100000 rts



My new vblank function but infinite loop? I use the code from Frog Feast NG
Vblank2: cmp.w #1, 0x100000 bne Vblank2 clr.w 0x100000 rts

Can you help me again ?

9

0x100000 refers to a memorylocation, this location is set to #1 by another internal function (vblank-irq/irq1), wait_vblank waits until this location is #1.
i dont know how Datlib works, maybe another memorylocation, long instead of word (or byte?), waits until #0?
maybe HPMAN can help?

i think you can not use SCB_EVEN/ODD ingame!

10

Unfortunately we no longer sees HPMAN on the net.

You're right, I'll find another way. I just like to understand the hardware and do tests to find the best solution.

11

blastar (./9) :
0x100000 refers to a memorylocation, this location is set to #1 by another internal function (vblank-irq/irq1), wait_vblank waits until this location is #1.
i dont know how Datlib works, maybe another memorylocation, long instead of word (or byte?), waits until #0?
maybe HPMAN can help?
i think you can not use SCB_EVEN/ODD ingame!


There's a flag somewhere, placed by the compiler depending of your application. Not a fixed position.

Don't write to 0x100000, it's 100% sure compiler will have stuff here (SBSS section).

Check compiler output map file for used ram end location (also variable _end in C code), or edit the gcc config file (neocart.x) and reduce ram section for the compiler to use.

12

Good to see you

Thank you, I never checked the output map file. I'll look inside.