1
Hi,
I start some tests to create a game on NeoGeo CD and before starting the development, I wish to test specific hardware features.

I can play CD audio wav files (in raine emulator) and the graphic part works too.


I wish to load all sprites at the beginning and only load a different .SPR for the background every level.

In the "IPL.TXT" I have a demo.spr (135ko) and demo2.spr (35ko). I wish to put the second file in the start of the bank 3 (name, num bank, start offset of the bank) but the NeoGeoCd doesn't like it and show me an error message DISC I/O error ID = 0000
Without the line demo2.spr,3,0, the game run but with a blank square instead of the sprite (because it didn't load)

DEMO.FIX,0,0 DEMO.Z80,0,0 DEMO.PCM,0,0 DEMO.SPR,0,0 DEMO2.SPR,3,0 TEST.PRG,0,0
I use buildchar file to create demo.spr :
<?xml version="1.0" encoding="UTF-8"?> <chardata> <setup> <starting_tile>256</starting_tile> <charfile>out\char.bin</charfile> <mapfile>out\charMaps.s</mapfile> <palfile>out\charPals.s</palfile> <incfile>out\charInclude.h</incfile> <incprefix>../</incprefix> </setup> <pict id="monstre"> <file>gfx\monstre.png</file> <flips>xyz</flips> </pict> <pict id="bg_001"> <file>gfx\lb2.png</file> </pict> <pict id="girl3"> <file>gfx\girl_3.png</file> <flips>xyz</flips> </pict> </chardata>
and demo2.spr :
<?xml version="1.0" encoding="UTF-8"?> <chardata> <setup> <starting_tile>0</starting_tile> <charfile>out\char2.bin</charfile> <mapfile>out\charMaps2.s</mapfile> <palfile>out\charPals2.s</palfile> <incfile>out\charInclude2.h</incfile> <incprefix>../</incprefix> </setup> <pict id="girl4"> <file>gfx\girl_4.png</file> <flips>xyz</flips> </pict> </chardata>
2
hi,
Never, never ever use RAINE if you develop for the real hardware, this has caused me a lot of problems and headaches. this emulator is only designed for gaming. it didn't respect many limits, timing is different to real hardware and it molds many bugs which can later lead to problems on real hardware! use MAME instead!

i personally recommend this version: mameui-0-202-32-64-bits-no-nag-including-mess (uptodate without any nag-screen)

just copy the files *iso, *cue and *wav into the folder ROMS (incl. NeoGeoCD Bios) and start (*bat) with 'mame64 neocdz -cdrom ROMS/DEMO.cue'.
switch to mame before you look for errors!
3
Error 0000 usually means file not found, make sure it's on your disk
4
Thanks, I'll download it.

I used raine because my old version of mess doesn't play audio wav file with loop. I'll try your version.

I've found my I/O error, it's because I forgot to put the demo2.spr in my iso. boing It's seem to work; I'll test with other assets .
Thanks HPMAN, you saw it before me ;-)

So now, I'll need to find how the BIOS calls BIOSF_LOADFILE ($C00552) "https://wiki.neogeodev.org/index.php?title=Loading_files" to try to load files in game as I'm using C with Datlib.
5
Add this asm snippet to your project

;loadList(char *list) .globl loadList loadList: move.l 4(a7), a0 ;* a0=file list movem.l d2-d7/a2-a6, -(sp) jsr 0xc00552 movem.l (sp)+, d2-d7/a2-a6 rts
Then you can call loadList from C with a correct file list.
6
Thanks,

I tried your asm function but I have error I/O. And this time I checked twice the presence of the file. I don't know how create a correct file list.
I found this example in the wiki :
"STAGE_2.SPR" ;Name 0x02 ;Bank 0x00 ;align 0x00001600 ;Destination
With C :
void loadList(char *list); char *bgspr = "DEMO2.SPR0,$300000"; // $(bank3)(align=0)(adress=0000) if (p1e&JOY_B) { loadList(bgspr); }
With asm only :
.globl loadList loadList: move.l #ListFile, a0 movem.l d2-d7/a2-a6, -(sp) jsr 0xc00552 movem.l (sp)+, d2-d7/a2-a6 rts ListFile: .ascii "DEMO2.SPR" .byte 0x03 .byte 0x00 .long 0x00

@blastar
I tested with mame 0.202 but I have the same error. The music files are only played one time.
I use the HPMAN code to play music file n°2 with loop and leave the CDDA_FLAG to 0

__asm__ ( "move.l %0, %%d0 \n" "movem.l %%d2-%%d7/%%a2-%%a6, -(%%a7) \n" "jsr 0xc0056a \n" "movem.l (%%a7)+, %%d2-%%d7/%%a2-%%a6 \n" : :"r"(0x0402) :"d0", "d1", "a0", "a1", "cc" );
7
has this ever been verified on real hardware?
I also blindly trusted the NeoDev-wiki '$04: Read track and loop (confirmed)' and never really tested it. I can NOT reproduce it on the real hardware, neither via the direct BiosCall nor via the Z80... there must be something wrong.
maybe the confirmation is because it works with RAINE but this emulator is not accurate.

no luck with:
TOPLOADER + UNIBIOS 3.3
FRONTLOADER (unmodified)
8
Tonma (./6) :
Thanks,

I tried your asm function but I have error I/O. And this time I checked twice the presence of the file. I don't know how create a correct file list.
I found this example in the wiki :
"STAGE_2.SPR" ;Name 0x02 ;Bank 0x00 ;align 0x00001600 ;Destination
With C :
void loadList(char *list); char *bgspr = "DEMO2.SPR0,$300000"; // $(bank3)(align=0)(adress=0000) if (p1e&JOY_B) { loadList(bgspr); }
With asm only :
.globl loadList loadList: move.l #ListFile, a0 movem.l d2-d7/a2-a6, -(sp) jsr 0xc00552 movem.l (sp)+, d2-d7/a2-a6 rts ListFile: .ascii "DEMO2.SPR" .byte 0x03 .byte 0x00 .long 0x00

Badly constructed file lists.

Asm would be :
.ascii "DEMO2.SPR" .byte 0x00 ;* string end .byte 0x03 ;* bank .byte 0x00 ;* pad byte (possibly replace with .align 2) .long 0x00 ;* address
C would be like:
const char bgspr[]="DEMO2.SPR\x00\x03\x00\x00\x00\x00\x00"; loadList(bgspr);
9
blastar (./7) :
has this ever been verified on real hardware?
I also blindly trusted the NeoDev-wiki '$04: Read track and loop (confirmed)' and never really tested it. I can NOT reproduce it on the real hardware, neither via the direct BiosCall nor via the Z80... there must be something wrong.
maybe the confirmation is because it works with RAINE but this emulator is not accurate.

no luck with:
TOPLOADER + UNIBIOS 3.3
FRONTLOADER (unmodified)

I'll try on my topload unmodified when I'll have CD-R
HPMAN (./8) :
Badly constructed file lists.

Asm would be :
.ascii "DEMO2.SPR" .byte 0x00 ;* string end .byte 0x03 ;* bank .byte 0x00 ;* pad byte (possibly replace with .align 2) .long 0x00 ;* address
C would be like:
const char bgspr[]="DEMO2.SPR\x00\x03\x00\x00\x00\x00\x00"; loadList(bgspr);

Thanks

I'm dumb crash

The full asm doesn't work : I/O error. But I can load the file with the C version, so that's fine :
char bgspr[]="DEMO3.SPR\x00\x03\x00\x00\x00\x00\x00"; void loadList(char *list); loadList(bgspr);
I certainly did something wrong because yesterday I could load the bank 3.
I do not know if my tiles are loading in the right place. I load with IPL the file demo3.spr in bank 3. Nothing on the screen. I load a new file with loadList () in my code to bank 0 and it works. My sprite draws on the screen. If I change the starting tile my file grow in size.

In my chardata file :
<starting_tile>0</starting_tile> <charfile>out\char3.bin</charfile>In IPL : doesn't work
DEMO3.SPR,3,0In IPL : work
DEMO3.SPR,0,0
So it's seems the file is not loading when I want bank > 0.
Compiler might be doing some alignment with the ascii string when compiling (adding a pad byte), leading to bad format. Check out the output binary data.

Tilemaps must match the location where you load the tile data!
Bank 3 starts at (3*1048576)/128= tile #24576

<starting_tile fillmode="none">24576</starting_tile>
Note the fillmode attibute to indicate you don't want the padding tiles.

This will generate the correct tilemap for loading the data @ 0x300000
Thanks again, you save me. It's works now with the C version. I tried with bank 2 and 3.

For the asm version, the ouptu binary seems ok. I'll investigate later.

neogeo10.png