Welcome to Data Crystal's new home! Data Crystal is now part of the TCRF family (sort of).
The wiki has recently moved; please report any issues in Discord. Pardon the dust.

Super Mario Land/ROM map

From Data Crystal
Jump to navigation Jump to search

Chip tiny.png The following article is a ROM map for Super Mario Land.

Lives

Life operation

  • 0x9BE-0x9CC - Checks the value at (FFFB) and do the appropriate operation
ROM0:0962 CD FD 2A         call 2AFD
ROM0:0965 A7               and  a
ROM0:0966 28 ED            jr   z,0955
ROM0:0968 18 91            jr   08FB
ROM0:096A F0 FB            ld   a,(ff00+FB)
ROM0:096C FE 29            cp   a,29
ROM0:096E 28 32            jr   z,09A2
ROM0:0970 FE 34            cp   a,34
ROM0:0972 28 3E            jr   z,09B2
ROM0:0974 FE 2B            cp   a,2B
ROM0:0976 28 46            jr   z,09BE		// Extra Life
ROM0:0978 FE 2E            cp   a,2E
ROM0:097A 20 D9            jr   nz,0955
ROM0:097C F0 99            ld   a,(ff00+99)
ROM0:097E FE 02            cp   a,02
ROM0:0980 20 26            jr   nz,09A8
ROM0:0982 E0 B5            ld   (ff00+B5),a
ROM0:0984 3E 04            ld   a,04
ROM0:0986 EA E0 DF         ld   (DFE0),a
ROM0:0989 3E 10            ld   a,10
ROM0:098B E0 ED            ld   (ff00+ED),a
ROM0:098D FA 02 C2         ld   a,(C202)
ROM0:0990 C6 FC            add  a,FC
ROM0:0992 E0 EB            ld   (ff00+EB),a
ROM0:0994 FA 01 C2         ld   a,(C201)
ROM0:0997 D6 10            sub  a,10
ROM0:0999 E0 EC            ld   (ff00+EC),a
ROM0:099B 2D               dec  l
ROM0:099C 2D               dec  l
ROM0:099D 2D               dec  l
ROM0:099E 36 FF            ld   (hl),FF
ROM0:09A0 18 B3            jr   0955

Extra Life

  • 0x9BE-0x9CC - Extra Life
ROM0:09BE 3E FF            ld   a,FF
ROM0:09C0 E0 ED            ld   (ff00+ED),a	// (FFED) = 0xFF
ROM0:09C2 3E 08            ld   a,08
ROM0:09C4 EA E0 DF         ld   (DFE0),a	// (DFE0) = 0x08
ROM0:09C7 3E 01            ld   a,01
ROM0:09C9 EA A3 C0         ld   (C0A3),a	// Extra Life
ROM0:09CC 18 BF            jr   098D

Updates Lives

  • 0x1C2A-0x1C62 - Updates Lives after a death or after earning an extra life
ROM0:1C2A F0 9F            ld   a,(ff00+9F)
ROM0:1C2C A7               and  a
ROM0:1C2D C0               ret  nz
ROM0:1C2E FA A3 C0         ld   a,(C0A3)	// Load Life earned or lost in accumulator
ROM0:1C31 B7               or   a
ROM0:1C32 C8               ret  z
ROM0:1C33 FE FF            cp   a,FF
ROM0:1C35 FA 15 DA         ld   a,(DA15)
ROM0:1C38 28 32            jr   z,1C6C		// If the player died, jump to 0x1C6C (lose a Life)
ROM0:1C3A FE 99            cp   a,99
ROM0:1C3C 28 20            jr   z,1C5E		// If the player has 99 Lives, skip the Extra Life
ROM0:1C3E F5               push af
ROM0:1C3F 3E 08            ld   a,08
ROM0:1C41 EA E0 DF         ld   (DFE0),a
ROM0:1C44 E0 D3            ld   (ff00+D3),a
ROM0:1C46 F1               pop  af
ROM0:1C47 C6 01            add  a,01		// Extra Life
ROM0:1C49 27               daa  		// (converts Lives to decimal)
ROM0:1C4A EA 15 DA         ld   (DA15),a	// Store Lives in (DA15)
ROM0:1C4D FA 15 DA         ld   a,(DA15)	// a = Lives
ROM0:1C50 47               ld   b,a
ROM0:1C51 E6 0F            and  a,0F
ROM0:1C53 EA 07 98         ld   (9807),a	// Update the number of Lives displayed on screen
ROM0:1C56 78               ld   a,b
ROM0:1C57 E6 F0            and  a,F0
ROM0:1C59 CB 37            swap a
ROM0:1C5B EA 06 98         ld   (9806),a	// Updates Lives displayed in v9806 and v9807
ROM0:1C5E AF               xor  a
ROM0:1C5F EA A3 C0         ld   (C0A3),a	// (C0A3) = 0
ROM0:1C62 C9               ret

Game Over

  • 0x1C63-0x1C6B - Game Over
ROM0:1C63 3E 39            ld   a,39
ROM0:1C65 E0 B3            ld   (ff00+B3),a	// (FFB3) = 0x39
ROM0:1C67 EA A4 C0         ld   (C0A4),a	// (C0A4) = 0x39
ROM0:1C6A 18 F2            jr   1C5E

Lose 1 Life

  • 0x1C6C-0x1C72 - Lose 1 Life
ROM0:1C6C A7               and  a
ROM0:1C6D 28 F4            jr   z,1C63		// If the player has no more Lives, Game Over
ROM0:1C6F D6 01            sub  a,01		// Lives - 1
ROM0:1C71 18 D6            jr   1C49

Object Locations

0xA004 is the first Chibibo(Goomba).

And below is the general location for the rest of the enemies, and other non-power-up sprites for each level. Tempting as it is, you are not allowed to use fewer enemies in one level to add more to another. It's really annoying in 3-3, which uses way too few sprites.

  • $A002-$A070 - 1-1
  • $A073-$A0FC - 1-2
  • $A0FE-$A18D - 1-3
  • $5179-$5220 - 2-1
  • $5222-$5299 - 2-2
  • $529B-$530F - 2-3
  • $CE74-$CF1B - 3-1
  • $CF1D-$CFD6 - 3-2
  • $CFD8-$D03D - 3-3
  • $5311-$5403 - 4-1
  • $5405-$54D3 - 4-2
  • $54D5-$55B8 - 4-3

Enemy Data/Object Data

00 Chibibo (Goomba)
01 Flattened Chibibo
02 Pakkun (Piranha Plant)
03 Invisible Flying Bat thing
04 Nokobon (Turtle)
05 Nokobon's bomb
06 Punching Hand
07 Rising Platform that you step on and it rises.
08 1-3 Boss
09 Thing killable by jumping on it.
0A Falling Platform
0B Left to Right Platform
0C Falling Tile from 1-2 (Falls as you pass by it)
0D Nothing?
0E Jumping Bat thing.
0F Death Animation of Jumping Bat Thing.
10 Jumping Fish
11 Nothing?
12 Nothing?
13 Same as 07
14 Same as 07 but rises on its own
15 Jumping Bat Thing death noise.
16 Fireballs?
17 Half of 1-3 boss that goes in a Counter-Clockwise motion and vanishes.
18 Like 16 but waits to attack.
19 Same as 15
1A Cue the 2-3 Water boss but it keeps rising. May need walls to stop it. That, and it is supposed to center on a "Swimming" Mario.
1B Higher Fireball
1C Nothing?
1D Jumping Spynx-like enemy
1E Lower Fireball
1F Flying Boss Ball
20 (Jumping Bat Thing)?
21 Explosion that shoots 2 bullets(Water level) (Gunion?)
22 Low Boss Ball
23 Bouncing Ball?
24 Really high jumping thing (From another level)
25 Something that rises when you go by it and you can jump on it and kill it. Then it makes that death noise
26 Nothing?
27 Explosion?
28 A Right Moving Mushroom that is passthroughable
29 Same as 28 but Left Moving
2A Right Moving Heart: Passthroughable
2B Left Moving Heart: Passthroughable
2C Right Moving Star: Passthroughable
2D Flower (Passthroughable) A little ways off the ground.
2E Flower (Passthroughable) On the ground.
2F It start as one thing, then splits into three. (This may be from another level.)
30 Something that scoots across the ground. Unkillable?
31 Moving really fast thing (From another level?)
32 Cue a boss. (Undistinguishable)
33 Something flipping around.
34 Left Moving Star (Passthroughable)
35 Falling Object?
36 Falling Object from the end of levels
37 Nothing?
38 Diagonal Right Moving Platform
39 Diagonal Left Moving Platform
3A Up to Down Two ball platform.
3B Left to Right Two Ball platform.
3C Some jumping enemy
3D Death of 3C
3E Death Sound?
3F Gao (fireball shooting sphinx)
40 Death of 3F
41 Death Sound?
42 Flying Bee
43 Death of 42
44 Death Sound?
45 Falling Arrow
46 Nokobon Explosion
47 Jumping thing. Can stand on it.
48 Boss music, and some moving thing.
49 Gira shooter from Pipe
4A Gira (Bullet Bill)
4B Low Bullet
4C One of those 36 sprites, but it raises and carrys Mario to the end of the level, but also past the end.
4D Same as 4C but rises on its own.
4E Nothing.
4F Explosion!
50 Right Diagonal Bullet
51 Rises then falls and kills. Some ball?
52 Something that moves on ground and rises and shoots back a bullet.
53 Some thing that jumps around.
54 Fireball going around in a circle.
55 Upside Down Pakkun
56 Pionpi
57 Same as 56 but its dead first, then it jumps.
58 Low moving fast fireball
59 Something invisible that you run over and Mario hops up and gets 800 points.
5A Diagonal Left Bullet
5B Cue Final Boss
5C Fireball explosion spewing Fireballs from Final Boss
5D Upper Fireball from Fireball explosion from Final Boss
5E Middle Fireball from Fireball explosion from Final Boss
5F Lower Fireball from Fireball explosion from Final Boss
60 Final Boss with different music and faster too?
61 Another Boss?
62 Explosion and then Final Boss.
63 Diagonal left Goomba (Most likely TileSet issue) going very fast.
64 Like 63 but it goes Up and drops something.
65 A Goomba, that when passed by, it turns into a rising platform.
66 Nothing?
67 Boss Music with thing that jumps around and flies away when contact with Mario.
68 Like 64 but it falls back down.
69 Not moving thing (Goomba?)
6A Thing that kills you and likes to change sprites randomly.
6B Diagonalish thing. Touch it and it turns into a star, but you cant get it.
6C Thing that jumps on ground. Dies eventually.
6D Thing that rises and then Boss Music starts.
6E Like 69
6F Like 6C but keeps going.
70 Dosn't move. Kills you.
71 Dosn't move. Hit it and it explodes and shoots two fireballs.
72 Like 6F
73 Like 71
74 Like 71
75 Like 72
76 Like 6A
77 Not moving. Jump and it "Dies" and shoots out a fireball.
78 Like 6F
79 Boss Music. Thing that kills you if you walk into it.
7A Dosnt move.
7B Like 6F but slower.
7C Not Moving
7D Like 6A
7E Thing that dosnt move.

Note: Add $80 to the enemy's number to make it appear only in Hard Mode.
Note2: These were all tested in the first level, 1-1, so TileSets may be an issue, therefore the object data stated here that is "buggy" or "glitchy" may work in other levels.

Level Map Structure

The first byte is split in two parts. The high 4 bits are a y-component(y) and the low 4 bits are a length(x). The game draws x tiles to y + 2(because of the status bar at the top of the screen). There are x bytes following the first byte that indicate what tile to draw. I'm not sure how many bytes follow if x=0. The tile number is the byte + or - 0x80. If the byte is 0x00-0x7F, 0x80 is added. If the byte is 0x80-0xFF, 0x80 is subtracted. 7F appears to be a tile that is a used coin block. F4 appears to be a coin. An FD byte indicates that there isn't x bytes after the first byte. Instead, ONE byte follows the first byte and is repeated x times. If x=0, it fills the rest of the column. If there is a FE byte it goes to the next row. For example, at 0xA817, there are the bytes 00 FD 7F FE. y is 0. x is also 0. FD indicates there is only one tile byte. The tile indicated by 7F is repeated across the entire column because x=0. FE indicates that that is the end of the line. I'm not sure, but FF tells the game, that it is the end of the tile map. -Quoted from Coolman.

  • 0xA2BE (0xA200-0xB872?) - The first Level Map (1-1)
  • 0x56CD-0x65D2 - The second Level Map
  • 0x65D3-0x7DAD - The fourth Level Map
  • 0xD22C-0xE416 - The third Level Map

Screen Order

  • 0xA198-0xA1B5 - 1-1
  • 0xA1BD-0xA1D8 - 1-2
  • 0xA1E0-0xA1FD - 1-3
  • 0x55C1-0x55E0 - 2-1
  • 0x55E8-0x5603 - 2-2
  • 0x560B-0x562E - 2-3
  • 0xD045-0xD072 - 3-1
  • 0xD07A-0xD099 - 3-2
  • 0xD0A1-0xD0BE - 3-3
  • 0x5636-0x5663 - 4-1
  • 0x566B-0x5692 - 4-2
  • 0x569A-0x56C9 - 4-3

Sound Engine Commands

Music tracks are stored as a series of pointers to chains of Sound Engine Commands (SEC) for each channel. The SEC chains of each music track are stored right below their pointers.
Here is how each SEC is interpreted:

00 = SEC chain terminator

01 = plays rest

02-90 = plays note at frequency given by frequency table at 0xEF72-0xF001 (rom3:6f72-rom3:7001). Because frequencies occupy 2 bytes, only the even SECs play valid notes.
A few examples (octaves may be off by 1):
02 = C-1
10 = G-1
1A = C-2
28 = G-2
32 = C-3
3A = E-3
3C = F-3
40 = G-3
44 = A-3
48 = B-3
4A = C-4
4E = D-4
50 = D#4
52 = E-4
54 = F-4
58 = G-4
5C = A-4
62 = C-5
6E = F-5
70 = G-5
90 = B-6

91-9C = plays invalid notes

9D = set NRX sound registers (where X can be either 1, 2, 3 or 4, depending on which channel the SEC is executed for)
this SEC is followed by three bytes:
byte1 = NRX2
byte2 = NRX0? (no effect?)
byte3 = NRX1

9E-9F = plays invalid notes

AX = set Note Duration to the value of the Xth index of the Note Durations Table (where X can be any hex digit). The Note Durations Table is pointed to by ram:df01

B0-FF = plays invalid notes

References