SCHG How-to

Add a New Monitor in Sonic 2 SMS

From Sonic Retro

(Original guide by Ravenfreak)

So you want to add a new monitor in Sonic 2 and wanted to use one of the few unused monitors but don't know how? Well, here's how! First, open s2.asm in your editor of choice and search for "Collision_Monitor". It should look like this:

LABEL_47F6:		;collision with monitor
	ld      hl, $D39D
	ld      a, (hl)
	bit     0, a
	jr      nz, Collision_Monitor_Rings
	bit     1, a
	jr      nz, Collision_Monitor_Life
	bit     4, a
	jr      nz, Collision_Monitor_Continue
	bit     5, a
	jr      nz, LABEL_4845
	bit     2, a
	jr      nz, Collision_Monitor_Sneakers
	bit     3, a
	jr      nz, Collision_Monitor_Invincibility
	bit     6, a
	jr      nz, LABEL_4884

These are the types of monitors used in the game. Now scroll down until you see this:

	res     5, (hl)

This is one of two blank monitors that are available to use, the other one is located after the invincibility monitor routine. Now at this point you might think to add your new monitor code after the res operand, but if you do this the game freezes. To get past this, you need to page in the bank that contains the monitors, bank 07. So after the res operand add this:

 ld a, :Bank07
      ld ($FFFF),a
      Call New_Monitor

You can change the "New_Monitor" label to whatever you want of course. xP Now to add the monitor code. Before adding your code, if you wanted to use the Question Mark monitor add this:

      ld a, ($D39D)
      cp $07
      ret z
      ;your code goes here

And that's it! But of course don't forget to edit each level's object layout, otherwise you'll never be able to test your code. xP