gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Space Invaders Emulator

#45143 - doublec - Tue Jun 07, 2005 11:27 pm

I took a break from working on tutorials. A first cut at an emulator of Space Invaders is at:

http://www.double.co.nz/nintendo_ds/space_invaders/index.html

I haven't implemented screen scaling yet so to fit things as best I could I've set it up so you have to rotate the DS to play. The width of the DS screen is the same height as the arcade machine. Unfortunately you lose 30 pixels of width so I definitely need to scale things. It's still playable though and is quite fun.

Includes sound. It switches the screens off and pauses when the lid is closed.

Source will be released in the next update. Hopefully I'll have worked out how best to fit the arcade screen into the DS's more limited screen space. Any thoughts on that? Use both screens for full height? Or just scale? I don't suppose there's any hardware scaling in framebuffer mode...

#45163 - FourScience - Wed Jun 08, 2005 4:57 am

Sounds cool and looks good. I am not much of an arcade buff, but I would recommend arranging the screens in whatever way is most playable. I only played Space Invaders on the TI-99 system (off a cartridge), and it was a good kick I'd like to spend time with again, on the DS. Fyi, there's actually a very commercial release of Space Invaders for the DS, but the reviews I read said it was lackluster.

As for holding the DS sideways, I am trying that myself. I'm doing a Pong clone, based, quite appreciatively, on your demo code. It's held sideways for 2-players to use UP/DOWN and X/B for controls. I read your tutorials 1-3 and jumped straight in and after 3 hours I have everything but collision detection on the paddles (for the ball). It's all pixel for pixel drawing, as I'm not much for mocking up my own sprites. I wouldn't be so (relatively) far if it wasn't for your help.

I figure I'll make it work sideways, then I'll convert the project to use both screens for the action for single-player mode. Shouldn't be too hard to try both, for pong or Space Invaders. Depending on how you are drawing the aliens though it might take a little more reworking for yours. I'm going to try to have both options though, in the end.
_________________
Work in progress: Dual-Soft.com

#45166 - doublec - Wed Jun 08, 2005 5:21 am

Thanks for the pointer to the commercial game, I wasn't aware of that. I think I made a mistake making the ROM part of the download. In the next release I'll remove the ROM and give instructions on how to create the GBFS file to build the ROM and final nds and leave it up to people to supply the ROM.

#45177 - FluBBa - Wed Jun 08, 2005 8:52 am

I use HBlank DMA writing to the scroll registers in all my emulators but if you use a bitmapped mode you can probably do some tricks to scale the image while drawing it.
_________________
I probably suck, my not is a programmer.

#45372 - doublec - Fri Jun 10, 2005 1:01 am

To allow the user to supply the ROM for the game I'm considering either:

1) Supply a batch/script file for the user to run that appends their ROM to the executable.

or

2) Have them upload the ROM to their cartridge as a saved game. Then I read the ROM from there.

I'm leaning towards number two. Any thoughts, or other approaches.

#45375 - josath - Fri Jun 10, 2005 1:13 am

2) is no good for those of us with a free "neoflash" cart, as it has zero support for gba sram :'(

What I think may work, is this:
distribute the arm7.bin & arm9.bin & ndstool, then the script appends the rom to the arm9.bin, and makes an .nds from that.
Only way this won't work is if your arm9.bin+rom is too big to fit in memory. but that shouldn't be a problem with old games like space invaders i think.
soemthing like:

Code:
copy /b arm9.bin + sinvade.rom realarm9.bin
ndstool -c sinvade.nds -7 arm7.bin -9 realarm9.bin


Then just start looking in main ram for the sinvaders rom (main ram is what, 0x02000000 or something)

This method should make it both work with wmb and with multi-nds loaders.

#45376 - doublec - Fri Jun 10, 2005 1:21 am

That looks like the best approach. Thanks.

#45486 - tepples - Sat Jun 11, 2005 4:54 am

Yes, appending the GBFS file to the arm9 binary would work under three conditions:
  • Do not use the .sbss segment provided by devkitARM, as it will overlap the location of the GBFS file. (This also applies to multiboot programs on the Game Boy Advance.)
  • Modify GBFS so that the second search limit is 0x02400000 (end of DS EWRAM, 4 MiB in size) rather than 0x02040000 (end of GBA EWRAM, 0.25 MiB in size).
  • Run 'padbin 256 arm9.bin' before you append the GBFS archive.
Or if the restriction against .sbss doesn't work well for you, you could just use 'bin2s' (included with recent GBFS releases) to include your GBFS file in the ARM9 binary.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#45578 - doublec - Sun Jun 12, 2005 4:48 am

I've updated the space invaders emulator:

http://www.double.co.nz/nintendo_ds/space_invaders/index.html

It no longer includes the ROM and has instructions on how to add it. I give the option of using gbfs and appending it to the binary or loading it into SRAM using the flash cartridge software. If I don't find the file in the gbfs, I look for it in SRAM.

I've also added hardware scaling. This enables the game to be played in the usual DS manner (ie. held horizontally). Using the 'select' key you can switch between different display methods. Vertical, horizontal, scaled or unscaled. It includes stretching the game across both screens scaled or unscaled.

I've stll to change it so it works with multi boot and direct wifime transfers without using the flash card though.

The hardware scaling/rotating support of the rotation backgrounds is great! What need is there for a framebuffer mode with that facility?