News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Anyone Interested in Doing "SMB Special" for NES?  (Read 300329 times)

Googie

  • Hero Member
  • *****
  • Posts: 1046
  • I'd like to solve the puzzle... Jiggers!
    • View Profile
    • My work in progress ROM Hacking site
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #20 on: February 24, 2008, 01:47:49 am »
...

Here's the screen, I can't sleep until the meds kick in...



Like I said it ain't anything fancy...

frantik

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #21 on: February 24, 2008, 01:51:04 am »
sweet :D

now who's gonna do 1-2?  lol  and i noticed a few bugs in my 1-1 like the exit pipe needs to be moved over one tile and there's two mushrooms at the end of the level
« Last Edit: February 24, 2008, 02:00:10 am by frantik »

Googie

  • Hero Member
  • *****
  • Posts: 1046
  • I'd like to solve the puzzle... Jiggers!
    • View Profile
    • My work in progress ROM Hacking site
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #22 on: February 24, 2008, 02:07:03 am »
Whoops, I forgot to upload the file so here.

G'nite! ^^'

frantik

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #23 on: February 24, 2008, 05:07:23 am »
cool i'll use that one when i fix the bugs

is anyone interested in finding and decoding the level data in the game?  if anyone can find it and figure out the format I'll make a program which will decode them into maps

Karatorian

  • Sr. Member
  • ****
  • Posts: 381
  • "Gotta get get ... 6502"
    • View Profile
    • Studio Karatorian
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #24 on: February 25, 2008, 10:54:54 am »
I'd be interested if the format is not too complicated. I could probably even automate the ripping and inserting, provided you get any missing features hacked into the engine. PM me and we can discuss the details.

Edit:

I did some looking and made a little progress. The disk image format the ROM is in is kinda arcane and it took me a while to get any info on it. I eventually had to poke around the source code of an obscure utility that convered another disk image format into d88. Here's what I've learned so far. (Some of this may be wrong, there are no docs that I could find.)

The disk is split up into 256 byte sectors, which each have a 16 byte header. This means each sector takes up 272 bytes in the disk image. The disk image also has it's own header, which is 672 bytes long. Empty sectors are marked in a strange way. If the sector is empty, it's filled with the same byte as the third byte of the sector header.

Using this basic info, I coded up a little util to do some handy things. The first thing I did was compile a list of non-empty sectors. These sectors are broken up into four chunks as follows:
Code: [Select]
Chunk 0
Disk Sectors 0 - 1
Image Addresses 0x0002A0 - 0x0004BF
Chunk 1
Disk Sectors 96 - 402
Image Addresses 0x0068A0 - 0x01AECF
Chunk 2
Disk Sectors 640 - 998
Image Addresses 0x02AAA0 - 0x04280F
Chunk 3
Disk Sectors 1008 - 1175
Image Addresses 0x0431A0 - 0x04E41F

With this information in hand, I started some experimental hex editing. I guessed that chunk 0 was some sort of header or bootstrap and that chunk 1 was proably the program code, so I started with chunk 2. I seem to have been at least a little bit correct.

I zeroed out all of sector 640 and started the game up in the emulator. I immediatly died due to time up, although the level layout wasn't changed (at least on the first screen). Oh well, at least I'm on to something.

I also did a quick look to see if i could locate the game's graphics. (Not that you'd likely have any use for them, but I was curious where they are. I suspect chunk 3.) I didn't find them, but that's no real surprize. The tool I was using only supports 1BBP, NES, and Gameboy formats. I guess I'll need to locate a more featurefull graphics viewer and give it another try. (Or someone here who's feeling ambitious could do so).

My primative tool also has support for dumping the raw sector data without the headers. This might be an easier format to work with than the original as you don't have to deal with skipping the headers every sector. Which would make doing things like using a graphics tool or disassembler (the CPU is a Z80 clone BTW) more productive. If anyone is interested, I could post the dumps I made, just ask

Anyway, now I'm off to do some more investigating.
« Last Edit: February 25, 2008, 02:43:42 pm by Karatorian »
Current ProjectsFinal Fantasy EngineSMB Special for NESStudio Karatorian
@loop: lda (src),y — sta (dst),y — iny — bne @loop — inc src+1 — inc dst+1 — dex — bne @loop

frantik

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #25 on: February 25, 2008, 03:53:51 pm »
awesome!

Karatorian

  • Sr. Member
  • ****
  • Posts: 381
  • "Gotta get get ... 6502"
    • View Profile
    • Studio Karatorian
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #26 on: February 25, 2008, 05:34:34 pm »
Due to a brain fart on my part, the above map of what's empty and what has data is incorrect. While looking through the massive list of pages that my proggie said had data in them, I didn't pay enough attention and only spotted the major gaps. My code was fine, but the manual post proccessing I did was totally bogus.

The particular details are that chunk 2 and chunk 3 are actually a bunch of smaller chunks and are likely all level data. As I was hacking on the level data, I noticed some blank pages where listed as having data on my map. So I checked my software and it was fine, but my wetware was buggy :P (I'm starting to suspect each of the groups of non-empty sectors (there's about 28 of them) starting at sector 640 is a single level.)

I'll get a better map posted sometime, but in the meantime, I can report that I'm making some progress. While I can't be sure of the details yet, I'm managed to decipher some of the basic map data. Apparently, the maps are stored using a basic run length encoding scheme.

Single tiles are encoded as a single byte. Runs are encoded by starting with a byte that has the length of the run minus one anded with 0xC0. (So a run of 2 is C0, a run of 3 is C1, etc.) Following the run indicator, there is a byte that indicates the tile to be repeated. The map appears to be stored vertically in rows of 12 tiles. As the game displays 12.5 tiles, I'm currently missing something.

I'm currently working on mapping out what tile is what. I've also managed to find the enemy data and the some other level data, but I haven't tried to decipher it yet. Other than the time limit, which, for level one is at 0x02AAB3. (From the looks of the enemy code, it uses a similar RLE scheme.)

If you want to mess around with the level data, the first level's tile data starts at or around 0x2ACD0. Be careful of the sector headers, I don't know if the emulator cares if they're correct or not, but it's proably best not to mess them up. The two sectors before that contain the enemies and other level one data. The chunk that straddles the sector border is apparently the enemy data (zeroing it out removes all the enemies). The stuff before that in the first sector of the level (sector 640) is some other stuff. (Probably special events like pipes.)

Hack and enjoy.
Current ProjectsFinal Fantasy EngineSMB Special for NESStudio Karatorian
@loop: lda (src),y — sta (dst),y — iny — bne @loop — inc src+1 — inc dst+1 — dex — bne @loop

frantik

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #27 on: February 26, 2008, 03:48:20 pm »
wow some really good progress has been made :D  keep us informed of an more info you learn.. i will fiddle with it a bit myself :D


edit:
btw I'm totally willing to try to hack in the various features of smb special.  with the disassembly most things aren't a huge challenge.  if it's easy to automate the ripping and inserting then that would be awesome, cause even with maps it's somewhat tedious recreate them in the editor.  either way though i'm down to make this a reality if it's at all possible :D

one issue about just straight ripping and inserting the maps will be placement of pipes and other special objects like scroll stops which might not exist in the smb special the same way.  also I smb special levels are much larger so to fully implement it a mapper will probably have to be used.  I've implemented mmc1 on smb to expand level data sucessfully so thats not an issue really but it will make it more complicated to insert automatically.  lol maybe it will have to be done by hand in the editor
« Last Edit: February 26, 2008, 06:32:28 pm by frantik »

Karatorian

  • Sr. Member
  • ****
  • Posts: 381
  • "Gotta get get ... 6502"
    • View Profile
    • Studio Karatorian
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #28 on: February 26, 2008, 07:04:52 pm »
I've made some more developments. I've discovered that I slightly misunderstood the RLE. The lenght of the runs is one longer than I though it was. It's actually run_byte ^ 0xC0 + 2. With this information, things started to make a lot more sense. It turns out that the level is stored in columns of 13 tiles each, which solves that little mystery. One complication I've ran into is that each level seems to end on a run indicator byte without a following tile. I thought some special value which only looked like a run indicator was being used as an end of level indicator, but the one I got for levels one and two aren't the same, so I'm not sure how that works at the moment. Perhaps there's a level length indicator in the data I haven't looked at yet and the last byte is something else.

I've written a little utility that dumps a level's tiles out to an uncompressed binary file. I've also included an option to render the level as a PNG, mostly to check my results. So far they seem to be good. If you want, I could post the renders of the first few levels so that you can verify the results.

If you want to check out the level data, the tile data starts 0x220 bytes from the start of the level data. (This is not counting the sector headers, which my current tool chain strips out before doing anything else.) For instance, level one is stored in sectors 640 to 649. If you extract those sectors from the disk image (without the headers), the tile data starts 0x220 bytes from the start. This is in the third sector of the level, with 32 bytes of some other data before the tile data.

So far, I've been able to locate level data by using my program to find groups of non-empty sectors. While this works, it's a kludge and I'd like to be able to figure out how the game itself locates the data. There's proably some sort of pointer table, but as it's stored on a disk, I don't think it'd be quite as simple as the usual ROM pointer tables. Is there anyone here who knows their way around a Z80 thats willing to take a look at the code? (If not, I think my method will work, but it's rather ad hoc.)

Next up on my adgenda is looking into the enemy data. I've got a pretty good idea where it's located, so I've simply got to figure out it's format. After that, I guess I'll have to see if I can figure out what any of the other data is.

Anyway, I think I can write a program that'll output the levels in a conviently usable binary form, but I'm not so sure about converting them to SMB format. From the little bit of looking I did into the format, it seem to be pretty complicated. I could proably do it, but it'd probably be easier for someone who knows how to deal with the format already.

In that case, it would be good to have a discussion of the interchange format the two programs should speak. SMBS basically stores it's maps as grid of tiles, while SMB stores it's maps as a list of objects with coordinates. I'd prefer to simply output a grid of tiles and let the other program deal with turning them into object lists.

Do any of the SMB level editors have support for a save format that's a grid of tiles, or do they all just store things in SMB native format?
Current ProjectsFinal Fantasy EngineSMB Special for NESStudio Karatorian
@loop: lda (src),y — sta (dst),y — iny — bne @loop — inc src+1 — inc dst+1 — dex — bne @loop

frantik

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #29 on: February 26, 2008, 07:49:49 pm »
it sounds like the level formats are significantly different.. i think it would be much easier to just output the levels to images which can be entered into smb utility by hand..  that way the levels can be recreated using fewest amount of bytes. 

please do post up some of the levels in a usable format.. i'd love to start on 1-2 lol :D

Karatorian

  • Sr. Member
  • ****
  • Posts: 381
  • "Gotta get get ... 6502"
    • View Profile
    • Studio Karatorian
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #30 on: February 26, 2008, 10:04:33 pm »
Well, my current renderer doesn't indicate the locations of the hidden blocks or the contents of the non-hidden blocks. (They're in the level data I dump, but the renderer uses the graphics the game does, so the levels are not compleatly rendered.) Once I get that taken care of, I'll post the renders and then people can start working on the layouts while I try and decipher the enemies and other data.

I should have the renderer producing usable output and get the renders posted later tonight or sometime tomorrow. Until then, thanks for your support. This is looking to be a nice project.

Edit:

Well alrighty, I've rendered all 32 levels and posted them here. They're not perfect and may have some bugs (unbeknownst to me), but they're a start. In particular, they have no sprites whatsoever. No enemies, no elevators, no falling platforms. Without which, a number of the levels (mostly the X-3 ones) would be compleatly unplayable, even if built. However, it should be enough to tide y'all over untill I can get that stuff worked out.

Some of the tiles have been tagged with letters, so you can tell what exactly they are. The key is as follows:
Code: [Select]
C block with a coin
M block with multiple coins
F block with a fire flower (or super mushroom if small)
1 block with a 1-up mushroom
S block with a starman
E pipe you can enter
V block with a vine
X block with unknown object one
H block with hammer (or super mushroom if small)
X block with unknown object two
T block with clock (adds 100 to the timer)
W block with wings (makes it so you can "swim" in air)

I don't know if the extra power-ups where used in the game or not (I didn't look that closely), but they are in the code. If they are, we may need to do some ASM hacking. Another thing that may require some ASM hacking is upsidedown pipes. I don't know if any of them are enterable, but there are some.

I didn't edit most of the levels and most of them contain extra junk at the end. I did, however edit level 4-4 as it seems to have been corrupted or something. A chunk of the level was missing (or never finished) and so the end wasn't aligned correctly. I edited the compressed level dump to shorten the corrupted chunk and align the end part correctly and made a render of that. I included both versions in the archive, just to be compleat.

« Last Edit: February 27, 2008, 05:39:54 am by Karatorian »
Current ProjectsFinal Fantasy EngineSMB Special for NESStudio Karatorian
@loop: lda (src),y — sta (dst),y — iny — bne @loop — inc src+1 — inc dst+1 — dex — bne @loop

frantik

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #31 on: February 27, 2008, 03:06:44 pm »
dude.. you rock!!!  this is really really cool :D  i will begin entering the level data for the rest of world 1 when i get a chance

it definitely looks like there will be some asm hacking needed.. and unfortunately i'm not 100% sure if every power up will be able to be included in the game. :(

MathUser2929

  • Hero Member
  • *****
  • Posts: 1644
    • View Profile
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #32 on: February 27, 2008, 04:19:29 pm »
what we dont need ported is the screen by screen progression. Screen scrolling would be fine by me, probably everyone.

frantik

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #33 on: February 27, 2008, 04:27:09 pm »
lol of course.. thats half the reason to port it in the first place

Karatorian

  • Sr. Member
  • ****
  • Posts: 381
  • "Gotta get get ... 6502"
    • View Profile
    • Studio Karatorian
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #34 on: February 27, 2008, 06:19:44 pm »
I've been looking into the level's sprite data and it's actually in a pretty easy to use format. The sprite data starts at offset 0xA0 from the start of a given level (again, ignoring the sector headers). Each sprite's information is a block of four bytes. The first byte is the number of 8 pixel columns to advance from the column position of the last sprite. The second byte is the number of pixels down the column to position the sprite. The third byte is the sprite index. The last byte contains movement information.

While the position information is fairly straight forward and I've managed to figure out most of the sprites actually present in the level data, the movement information is giving me a bit of trouble. It doesn't seem to be that complicated, but I haven't muddled out all the details yet.

Unlike the level information, I can detect the end of the sprite data, because it has extra zero bytes between it and the tile data, so my code stops reading sprite data on a sprite data group that is four zeros. I should have a preliminary dumping program for the sprite data some time soon.

In regards to the extra power ups, as I said, I'm not sure they're even all present in the level data. Personally, I wouldn't worry about them until we come across a level that has them in it. As for getting the ASM hacks implimented, I'd be willing to help out.

With the availibility of cleaned up dissasemblies of the SMB source availible, I imagine they will be easier to impliment than they would be for some other games. If space becomes an issue, I'd be willing to look into ROM expansion. From what I've read about SMB rom expansion, it wouldn't be this complicated. (Of course, no ROM expansion is easy, but seeing as SMB uses no mapper, it's not a matter of mapper changing, just mapper adding.)

Anyway, we'll cross that bridge when we come to it.
Current ProjectsFinal Fantasy EngineSMB Special for NESStudio Karatorian
@loop: lda (src),y — sta (dst),y — iny — bne @loop — inc src+1 — inc dst+1 — dex — bne @loop

MathUser2929

  • Hero Member
  • *****
  • Posts: 1644
    • View Profile
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #35 on: February 27, 2008, 07:27:10 pm »
If your able to hack smb special why not make a infinite lives and powerup cheat/ So in case any of us need to go into the game it will be possible.

frantik

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #36 on: February 27, 2008, 07:44:17 pm »
In regards to the extra power ups, as I said, I'm not sure they're even all present in the level data. Personally, I wouldn't worry about them until we come across a level that has them in it. As for getting the ASM hacks implimented, I'd be willing to help out.

With the availibility of cleaned up dissasemblies of the SMB source availible, I imagine they will be easier to impliment than they would be for some other games. If space becomes an issue, I'd be willing to look into ROM expansion. From what I've read about SMB rom expansion, it wouldn't be this complicated. (Of course, no ROM expansion is easy, but seeing as SMB uses no mapper, it's not a matter of mapper changing, just mapper adding.)

Anyway, we'll cross that bridge when we come to it.


how do you know about the power ups that may or not be used?

and expanding smb isn't too hard i've been hacking it extensively for super mario unlimited i know plenty of locations which can be edited to add space and i've implemented two different mappers on it as well so that wont be hard either :D  looks like the first thing that needs to be done is upside down pipes though.  the way i did it loses the L pipes so i will look into other ways

Karatorian

  • Sr. Member
  • ****
  • Posts: 381
  • "Gotta get get ... 6502"
    • View Profile
    • Studio Karatorian
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #37 on: February 27, 2008, 10:57:40 pm »
how do you know about the power ups that may or not be used?

I know about all the power-ups becaus I hacked them into level one. When I was compiling data to build my level dumping program, I hacked various blocks into level one's first screen so I could figure out what they do.

Edit:

Extra, extra, read all about it! New SMBS level renders avalible! New and improved, now with 100% more sprites!

Well, I hacked on the level renderer some more and now it's dumping sprite data as well as tile data. I've rendered all the levels and posted a second tarball at the adress I linked to above. While it may not be perfect, it seems to work, for the most part.

One bug I noticed is that a handful of sprites at the end of 8-4 seem to be off by one column. I'm not sure why. Also, due to level 4-4 being corrupted (or something), the sprite data during and after the messed up section isn't accuratly placed. (Or rather, it is, but the tile data isn't so it amounts to the same thing.)

I implimented a hack to crop the level renders based on the sprite data. The sprite data has information indicating empty space, even after the last sprite, so I used it to cut off the level size. It seemed to work for the couple of levels I checked out, but it's a hairy hack and may not work correctly. (I've really got to decipher that header data.) If any of the levels seem to simply cut off unexpectedly, check out the version one renders and see if they help. (Note level 8-4 simply cuts off in the level data, it's not a result of this change.)

If you find any levels that get prematurely cut off, or any other apparent bugs, please report it and I'll look into it.

I've managed to get the sprite movement code data mostly worked out. Most sprites only use one of a three movement codes, which are "move left", "move right", and "stand still". One movement code is only used by parakoopas and cheep cheeps, so it proably has something to do with moving up and down, but I haven't quite worked it out. One movement code is only used by fireballs and upsidedown pirana plants, I'm not sure what it does, perhaps downward movement. The movement codes for elevators/falling platforms and firebars are more complicated. I haven't even started working out what they do exactly.

Once I get the movement codes worked out, I intend to have the level dumping program produce a series of text files that indicate the position, type and movement attribues of each sprite. While the position and type can be fairly easily determined from the renders, I'm not sure how to indicate the movement type graphically without a lot of work. The other info will be useful for verifying which sprite each movement code belongs to.

After I get the movement codes worked out, I'll be done with both the tile and sprite data, so I'll start looking into the level headers. In particular, I'll be attempting to figure out where the data that indicates how the pipes connect up. As the enterable pipes are marked specially in the level data, it's easy to tell where the entrances are, but the exit pipes are not marked, so that data must be stored somewhere else.

Until next time, keep up the good work.

If your able to hack smb special why not make a infinite lives and powerup cheat/ So in case any of us need to go into the game it will be possible.

Well, to do that, I'd have to go into the ASM code. Hacking data is a lot easier than hacking code. While I've been able to locate and mess around with the level data, I located it by means of an educated guess. I don't know anything about the Z80, or the PC-8801. The emulator that was packaged with the disk image has no save states, no debugger, no code tracer, no memory viewer, etc. While I haven't looked into finding a better one, I doubt that one with the sort of features a ROM hacker really needs to get ASM hacks done is available for such an obscure platform.

I have, however, come up with a theoretical way to rearrange the level orders. While I haven't built a tool to do so yet, it is on my to do list. I didn't want to mention it, because I didn't want to get anyone's hopes up, in case it doesn't work for whatever reason. If it works out, I should be able to move an arbitrary level to level 1-1. While that's not as nice as an unlimited starman and infintite lives, it's better than nothing.

That said, if anyone here does want to try hacking on the ASM, I can provide some (limited) information and tools. Just ask and I'll provide what help I can.
« Last Edit: February 28, 2008, 06:31:46 am by Karatorian »
Current ProjectsFinal Fantasy EngineSMB Special for NESStudio Karatorian
@loop: lda (src),y — sta (dst),y — iny — bne @loop — inc src+1 — inc dst+1 — dex — bne @loop

hybrid

  • Jr. Member
  • **
  • Posts: 18
    • View Profile
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #38 on: February 28, 2008, 01:55:07 pm »
i was able to get some cheat Engine / Cheat Search codes for this game the first four digits vary but its easy to come up with them i hope this helps. to get the first 4 digits to the codes just hack out the infinite lives codes. its a single byte search.  searching for the exact value of the lives.
Infinite Lives
????ECC5 9

Infinite Time
????ECA1 150

You will have to turn the code off to pass to the next level

Max Coins
????EC9D 153

Always Big
????EC9E 6

Always Able to shoot Fireballs
????EC9F 1

Always Invincible (star)
????EC7E 15

you will have to turn off if you land in a lava pit

Sub-World modifier
????F019 ?
use 0-? it varies depending on which world you are in
World Modifier
????F018 ?
use 0-7
you will have to beat World 1-1 in order to go the level set by the codes
Sub-World modifier
????F019 ?
use 0-? it varies depending on which world you are in
World Modifier
????F018 ?
use 0-7
you will have to beat World 1-1 in order to go the level set by the codes
« Last Edit: February 28, 2008, 09:45:12 pm by hybrid »

insectduel

  • Full Member
  • ***
  • Posts: 128
    • View Profile
    • Insectduel's Domain
Re: Anyone Interested in Doing "SMB Special" for NES?
« Reply #39 on: February 28, 2008, 02:39:42 pm »
What are the object or enemy level formats of SMB Special? Is it the same as the NES version. I got to encode the source and try to insert all levels into the NES rom if any space left out.
Please do not send me RHDN's private messages to contact me, you must use Facebook and I'll be able to reply to you quickly. I AM NOT AN ACTIVE RHDN MEMBER!