tepples wrote:8bitMicroGuy wrote:Well, as long as emulators can do it, I'm happy.
If you're not interested in running your game on a cartridge, you could always make a game for the Java or .NET platform.
JVM is an emulator, and
CLR is an emulator.
Java has a garbage collector, but I like it when I can free/delete objects using free/delete function/statement when I want and not when those tangly references are released. If Java has no pointers, but only references, then it's not for me.
Also, woah... I didn't actually realize that this copypasting would take away so much cycles! I guess I'll have to stick with bankswitching. I've been expecting so much out of this poor little primitive and tired machinie 6502
While studying the Battletoads ROM, I found out that the only tiles that are being copypasted are the noise generator (used for the bird pilot guy's screen), waterfall tiles and player tiles. All enemies use their own tiles which are static.
When I saw Tom and Jerry ROM, Jerry moves very smoothly, but there's no copypasting, just bankswitching for every 5th frame. Jerry's metasprite is 3x4 tiles if I'm not mistaken. That's 12 tiles. One bank has 64 tiles. 64 divided by 12 is 5+1/3.
This means that Jerry's walking animation uses two banks.
For the minecraft project, I took 4 hours to write up this big document
Code: Select all
Minecraft for NES - Sprite analysis
All sprites have 2 tiles because they're 8x16.
There are 4 bank address spaces.
All bank address spaces are switching constantly to make a walking effect for walking animations and breathing effect for steady creatures.
There are some tiles that are "copypasted" using this mechanism:
1. Bank address space 0 gets switched to the bank from which to copy
2. Needed data gets loaded from PPU address space into a buffer in RAM
3. Data from buffer gets written into PPU address space from 228th tile to 256th
4. Bank address space 0 gets switched back to its bankswitch animation default
Tiles from 36th to 64th in the banks being mapped to the bank address space 3 are filled with color 2 with an X in color 0 for detection of failure in copypasting in time.
These are the tile allocations:
Players = 4(head)*2(for each player)*2(normal, hurt)+4(body)*(12(steady/breathing, walking, running, jumping, falling, mining, hurt, crouching, crawling, crouching and mining, holding on ladder/wines,
climbing on ladder/wines) = 64
Sheep = 4(head)*2(normal, hurt)+6(body)*3(steady/breathing, walk, hurt)) = 26
Pig = 4(head)*2(normal, hurt)+6(body)*3(steady/breathing, walk, hurt)) = 26
Cow = 4(head)*2(normal, hurt)+6(body)*3(steady/breathing, walk, hurt)) = 26
Zombie = 4(head)*2(normal, hurt)+4(body)*2(steady/shaking, walking) = 16
Skeleton = 4(head)+4(body)*2(steady, walking) = 12
Creeper = 4(head)+4(body)*2(steady, walking) = 12
Enderman = 4(head)+8(body)*2(steady, walking) = 20
Villager = 4(head)+4(body)*3(stop, walkA, walkB) = 16
Explosion = 4 (will be mirrored, is animated by bankswitch) = 4
Flames = 4 (will be mirrored, is animated by bankswitch) = 4
Shattered block piece = 2(that's the minimum of one sprite and metasprite, will be animated as a polar rotating piece of block by bankswitch) = 2
Cracking block animation = 4*2(for each player) = 8 (will be copypasted because it cannot be synchronous with the bankswitch animation)
Dropped items = 2(that's the minimum of one sprite and metasprite, they are copypasted on need)*8 = 16
Held items = 2(same)*2(for each player) = 4
Copypasted tiles = Cracking block animation + Dropped items + Held items = 8 + 16 + 4 = 20
Sprite Palette 0 = Orange, Red, Brown (Explosion, Fire, Wood, Wooden planks, Wheat, Bucket with Lava)
Sprite Palette 1 = White, Pink, Dark brown (Skeleton, Pig, Enderman, Pink dyed sheep, Player torso, Raw beef, Flowers)
Sprite Palette 2 = White, Green, Dark blue (Creeper, Cow, Green dyed sheep, Zombie, Player torso, Seeds, Bucket, Bucket with Water)
Sprite Palette 3 = White, Skin color, Dark gray (Sheep, Player head, Villager, Cracking block animation, Shattered block)
tokumaru wrote:The number of the tiles in the need to change at the same time would be... Let's say, Raccoon Mario, 2 fireballs, 2 Hammer Brothers, 4 Hammers. 12+2*2+2*4+4*2. That's 32 tiles per frame.
32 tiles * 16 bytes * 8 cycles = 4096 cycles, with the fastest possible code copying directly from ROM to VRAM. You'd have to blank a little over 16 scanlines in order to be able to transfer this much data, but that's not counting the other updates (OAM, NT + AT, palettes).
If you use have 2560 bytes of RAM to spare, you can update the 32 tiles in only 3072 cycles, in which case you'd only need 8 or so blanked scanlines (again, not considering the other VRAM updates).
So how much would I need to sacrifice from the scanlines if I have 20 tiles? How much cycles? The game will run in PAL mode which means 50fps and it will not blank full frames. Maybe just a bit from the scanlines. Game code must run in each frame, not every second or third, etc.
I'll have source address selection code as explained in "copypasting", then I'll copy the tiles from VROM into a buffer by using
Code: Select all
LDA $2006 (is it 2006 for loading from VROM?)
STA $8000 (PRG-RAM from MMC5)
LDA $2006
STA $8001
etc...
Just finding the tile and then performing this without loops to save cycles.
Then I'll just do
Code: Select all
LDA $8000
STA $2007
LDA $8001
STA $2007
etc...