luascript "Console Mode [lua]" \
 "comm:On the title screen, press up or down to select modes. Coin button is used for pause.
In training mode, start button can restore HP, pause the game and then press start to select character."
run:
-- Start-up --
if (peek(0xFF545F)==0x00) then
    dpoke(0xFF5464,0x0109) -- 1 coin 9 credit --
    poke(0x498E,"PRESS START")
    poke(0xBE5,0x17) -- Restore initial value --
    poke(0xBF5,0x19)
    poke(0xC0B,0x18)
    poke(0xBED,0x16)
    lpoke(0xBCA,0x1B40D41A) -- Restore start button --
    dpoke(0xB78,0x13FC) -- Restore music code --
    if (peek(0x804020)==0xFE) or (peek(0x804020)==0xFD) then -- Start button start --
      poke(0xFF0010,0x01)
    end
    if (peek(0x804020)==0xFF) and (peek(0xFF0010)==0x01) then -- Start button start cont. --
      poke(0xFF0010,0x00)
      poke(0xFF545F,0x09) -- Max Credit --
    end
end
-- Title screen --
if ((dpeek(0xFFEA2A)==0x6D70) or (dpeek(0xFFEA2A)==0x6BB0)) and (peek(0xFF5100)~=0x01) and (peek(0xFF545F)>0x00) then
   if (peek(0xFF1002)==0x00) then
      lpoke(0xBCA,0x00000000) -- Disable original start button --
      poke(0xFF545F,0x09) -- Max Credit --
   end
    if (lpeek(0xBCA)==0x00000000) and (peek(0xFF1002)==0x00) then
       if (peek(0x804020)==0xFD) or (peek(0x804020)==0xFE) then
          poke(0x618001,0x00) -- sound effect --
          poke(0x618003,0x80)
          poke(0x61801F,0x00)
          poke(0xFF1002,0x01)
       end
    end
    if (peek(0xFF1002)==0x01) and (peek(0x804020)==0xFF) then
       region=peek(0xFF5479)
       poke(0xFF1002,0x02)
    end
    if (peek(0xFF1002)>=0x01) then
       poke(0xFFFA9E,0x00) -- Remove original text --
       poke(0xFF542B,0x60) -- Text on top layer --
       lpoke(0x9144A0,0xF429FFFF) -- Text Colour 1 --
       lpoke(0x9144A4,0xFFFDFF9A)
       lpoke(0x9144A8,0xFF9AFF87)
       lpoke(0x9144AC,0xFF64FF41)
       lpoke(0x9144C0,0xF429FFFF) -- Text Colour 2 --
       lpoke(0x9144C4,0xFFD7FFEA)
       lpoke(0x9144C8,0xFFEAFFD7)
       lpoke(0x9144CC,0xFFB4FF91)
       lpoke(0x908D64,0x00200000+peek(0xFF1020)) -- Arcade Mode --
       lpoke(0x908DE4,0x00410000+peek(0xFF1020))
       lpoke(0x908E64,0x00520000+peek(0xFF1020))
       lpoke(0x908EE4,0x00430000+peek(0xFF1020))
       lpoke(0x908F64,0x00410000+peek(0xFF1020))
       lpoke(0x908FE4,0x00440000+peek(0xFF1020))
       lpoke(0x909064,0x00450000+peek(0xFF1020))
       lpoke(0x9090E4,0x00200000+peek(0xFF1020))
       lpoke(0x909164,0x004D0000+peek(0xFF1020))
       lpoke(0x9091E4,0x004F0000+peek(0xFF1020))
       lpoke(0x909264,0x00440000+peek(0xFF1020))
       lpoke(0x9092E4,0x00450000+peek(0xFF1020))
       lpoke(0x909364,0x00200000+peek(0xFF1020))
       lpoke(0x908D68,0x00200000+peek(0xFF1021)) -- VS Mode --
       lpoke(0x908DE8,0x00560000+peek(0xFF1021))
       lpoke(0x908E68,0x00450000+peek(0xFF1021))
       lpoke(0x908EE8,0x00520000+peek(0xFF1021))
       lpoke(0x908F68,0x00530000+peek(0xFF1021))
       lpoke(0x908FE8,0x00550000+peek(0xFF1021))
       lpoke(0x909068,0x00530000+peek(0xFF1021))
       lpoke(0x9090E8,0x00200000+peek(0xFF1021))
       lpoke(0x909168,0x004D0000+peek(0xFF1021))
       lpoke(0x9091E8,0x004F0000+peek(0xFF1021))
       lpoke(0x909268,0x00440000+peek(0xFF1021))
       lpoke(0x9092E8,0x00450000+peek(0xFF1021))
       lpoke(0x909368,0x00200000+peek(0xFF1021))
       lpoke(0x908D6C,0x00540000+peek(0xFF1022)) -- Training Mode --
       lpoke(0x908DEC,0x00520000+peek(0xFF1022))
       lpoke(0x908E6C,0x00410000+peek(0xFF1022))
       lpoke(0x908EEC,0x00490000+peek(0xFF1022))
       lpoke(0x908F6C,0x004E0000+peek(0xFF1022))
       lpoke(0x908FEC,0x00490000+peek(0xFF1022))
       lpoke(0x90906C,0x004E0000+peek(0xFF1022))
       lpoke(0x9090EC,0x00470000+peek(0xFF1022))
       lpoke(0x90916C,0x00200000+peek(0xFF1022))
       lpoke(0x9091EC,0x004D0000+peek(0xFF1022))
       lpoke(0x90926C,0x004F0000+peek(0xFF1022))
       lpoke(0x9092EC,0x00440000+peek(0xFF1022))
       lpoke(0x90936C,0x00450000+peek(0xFF1022))
       lpoke(0x908D70,0x00200000+peek(0xFF1023)) -- Option Mode --
       lpoke(0x908DF0,0x004F0000+peek(0xFF1023))
       lpoke(0x908E70,0x00500000+peek(0xFF1023))
       lpoke(0x908EF0,0x00540000+peek(0xFF1023))
       lpoke(0x908F70,0x00490000+peek(0xFF1023))
       lpoke(0x908FF0,0x004F0000+peek(0xFF1023))
       lpoke(0x909070,0x004E0000+peek(0xFF1023))
       lpoke(0x9090F0,0x00200000+peek(0xFF1023))
       lpoke(0x909170,0x004D0000+peek(0xFF1023))
       lpoke(0x9091F0,0x004F0000+peek(0xFF1023))
       lpoke(0x909270,0x00440000+peek(0xFF1023))
       lpoke(0x9092F0,0x00450000+peek(0xFF1023))
       lpoke(0x909370,0x00200000+peek(0xFF1023))
         if (peek(0xFF1000)==0x00) then -- Arcade Mode Pointer --
            poke(0xFF1020,0x06)
            poke(0xFF1021,0x05)
            poke(0xFF1022,0x05)
            poke(0xFF1023,0x05)
         elseif (peek(0xFF1000)==0x01) then -- Versus Mode Pointer --
            poke(0xFF1020,0x05)
            poke(0xFF1021,0x06)
            poke(0xFF1022,0x05)
            poke(0xFF1023,0x05)
         elseif (peek(0xFF1000)==0x02) then -- Training Mode Pointer --
            poke(0xFF1020,0x05)
            poke(0xFF1021,0x05)
            poke(0xFF1022,0x06)
            poke(0xFF1023,0x05)
         elseif (peek(0xFF1000)==0x03) then -- Option Mode Pointer --
            poke(0xFF1020,0x05)
            poke(0xFF1021,0x05)
            poke(0xFF1022,0x05)
            poke(0xFF1023,0x06)
         end
    end
    if (peek(0xFF1002)==0x02) then
       if ((peek(0xFF5417)==0x00) and (peek(0xFF5419)==0x00)) and (peek(0xFF1001)==0xFF) then
          poke(0xFF1001,0x00)
          poke(0xFF1024,0x00) -- Act as music 'stopper' --
       end
       if (peek(0xFF5417)==0x04) or (peek(0xFF5419)==0x04) then
          if peek(0xFF1024)==0x00 then -- Sound effect --
             poke(0x618001,0x00)
             poke(0x618003,0x84)
             poke(0x61801F,0x00)
             poke(0xFF1024,0xFF)
          end
          if (dpeek(0xFF1000)==0x0000) then
            dpoke(0xFF1000,0x01FF)
          elseif (dpeek(0xFF1000)==0x0100) then
            dpoke(0xFF1000,0x02FF)
          elseif (dpeek(0xFF1000)==0x0200) then
            dpoke(0xFF1000,0x03FF)
          elseif (dpeek(0xFF1000)==0x0300) then
            dpoke(0xFF1000,0x00FF)
          end
       end
       if (peek(0xFF5417)==0x08) or (peek(0xFF5419)==0x08) then
          if peek(0xFF1024)==0x00 then -- Sound effect --
             poke(0x618001,0x00)
             poke(0x618003,0x84)
             poke(0x61801F,0x00)
             poke(0xFF1024,0xFF)
          end
          if (dpeek(0xFF1000)==0x0000) then
            dpoke(0xFF1000,0x03FF)
          elseif (dpeek(0xFF1000)==0x0300) then
            dpoke(0xFF1000,0x02FF)
          elseif (dpeek(0xFF1000)==0x0200) then
            dpoke(0xFF1000,0x01FF)
          elseif (dpeek(0xFF1000)==0x0100) then
            dpoke(0xFF1000,0x00FF)
          end
       end
       if (peek(0x804020)==0xFD) or (peek(0x804020)==0xFE) then
          lpoke(0xBCA,0x1B40D41A) -- Restore start button --
          for i=0,0xC,0x4 do
             poke(0x908D65+i,0x20) -- Remove all text --
          end
          for i=0,0xC,0x4 do
             poke(0x908DE5+i,0x20) -- Remove all text --
          end
          for i=0,0xC,0x4 do
             poke(0x908E65+i,0x20) -- Remove all text --
          end
          for i=0,0xC,0x4 do
             poke(0x908EE5+i,0x20) -- Remove all text --
          end
          for i=0,0xC,0x4 do
             poke(0x908F65+i,0x20) -- Remove all text --
          end
          for i=0,0xC,0x4 do
             poke(0x908FE5+i,0x20) -- Remove all text --
          end
          for i=0,0xC,0x4 do
             poke(0x909065+i,0x20) -- Remove all text --
          end
          for i=0,0xC,0x4 do
             poke(0x9090E5+i,0x20) -- Remove all text --
          end
          for i=0,0xC,0x4 do
             poke(0x909065+i,0x20) -- Remove all text --
          end
          for i=0,0xC,0x4 do
             poke(0x9090E5+i,0x20) -- Remove all text --
          end
          for i=0,0xC,0x4 do
             poke(0x909165+i,0x20) -- Remove all text --
          end
          for i=0,0xC,0x4 do
             poke(0x9091E5+i,0x20) -- Remove all text --
          end
          for i=0,0xC,0x4 do
             poke(0x909265+i,0x20) -- Remove all text --
          end
          for i=0,0xC,0x4 do
             poke(0x9092E5+i,0x20) -- Remove all text --
          end
          for i=0,0xC,0x4 do
             poke(0x909365+i,0x20) -- Remove all text --
          end
          if (peek(0xFF1000)==0x03) then
             dpoke(0xB78,0x0000) -- Disable music code --
             poke(0x618001,0x00) -- Sound effect --
             poke(0x618003,0x82)
             poke(0x61801F,0x00)
          end
          if (peek(0xFF1000)~=0x03) then
             dpoke(0xB78,0x13FC) -- Restore music code --
          end
          poke(0xFF1002,0x03)
       end
    end
end
-- Infinity Credits --
if (peek(0xFF5105)==0x04) then
    poke(0xFF545F,0x09)
end
-- Versus Mode Script --
if (peek(0xFF1000)==0x01) then
    if (dpeek(0xFFEA2A)==0x6BB0) and (peek(0xFF5101)>0x00) then
       poke(0xFF5101,0x03)
    end
    if (peek(0xFF5105)==0x04) then -- Stage music --
       if (peek(0xFF5185)==0x0C) and (peek(0xFF51A5)<0x0C) then
         poke(0xFF5103,0x02)
       end
       if (peek(0xFF51A5)==0x0C) and (peek(0xFF5185)<0x0C) then
          poke(0xFF5103,0x01)
       end
    end
    if (peek(0xFF5000)>=0x0E) then -- Prevent continue? text. --
       poke(0xFF4200,0x06)
       poke(0xFF4600,0x06)
    end
    if (peek(0xFF5105)==0x10) then -- For draw game case --
       poke(0xFF5101,0x03)
       poke(0xFF5105,0x00)
    end
    if (peek(0xFF9FED)==0xFF) and (peek(0xFF51A3)==0x00) then -- Return to char screen --
       poke(0xFF5101,0x03)
       poke(0xFF5105,0x00)
       poke(0xFF5103,0x00)
    end
end
-- Training Mode Script --
if (peek(0xFF1000)==0x02) then
    if (dpeek(0xFFEA2A)==0x6BB0) and (peek(0xFF5101)>0x00) then
    poke(0xFF5101,0x03)
    end
    if (peek(0xFF5105)==0x04) then
      if ((peek(0xFF5185)==0x0C) and (peek(0xFF51A5)<0x0C)) or ((peek(0xFF51A5)==0x0C) and (peek(0xFF5185)<0x0C)) then
       poke(0xBE5,0x19)
       poke(0xBF5,0x17)
       poke(0xC0B,0x16)
       poke(0xBED,0x18)
      end
      if (peek(0xFF5185)==0x0C) and (peek(0xFF51A5)<0x0C) then
      poke(0xFF5103,0x02)
      end
      if (peek(0xFF51A5)==0x0C) and (peek(0xFF5185)<0x0C) then
      poke(0xFF5103,0x01)
      end
    end
    if (peek(0xFF5000)==02) then
      poke(0xBE5,0x17)
      poke(0xBF5,0x19)
      poke(0xC0B,0x18)
      poke(0xBED,0x16)
    end
   if (peek(0xFF5000)==0x08) and (peek(0xFF5007)>0x30) then
      poke(0xFF4211,0xFF) -- Increase HP before start --
      poke(0xFF4611,0xFF)
      lpoke(0xFF1040,0x00000000) -- Restore value --
   end
   if (peek(0xFF5000)==0x08) then
   -- HP recovery for 1P side --
      if (peek(0xFF4220)==0x00) then -- Not switched --
      -- Active character --
         if (peek(0xFF4053)~=0x10) then
            poke(0xFFFC7F,peek(0xFF4211)-0x70) -- For normal character --
         end
         if (peek(0xFF4053)==0x10) then
            poke(0xFFFC7F,peek(0xFF4211)-0x71) -- For Apocalypse --
         end
         if (peek(0xFF4211)<0x71) then
            dpoke(0xFFFC7E,0x0000)
            poke(0xFF421B,0x01)
            poke(0xFF1040,0x01)
         end
         if (peek(0x804020)==0xFD) and (peek(0xFF4211)~=0xFF) then
            poke(0xFF1040,0x02)
         end
         if ((peek(0xFF1040)==0x01) and (peek(0xFF4211)<0xFF) and (peek(0xFF4007)==0x00)) or (peek(0xFF1040)==0x02) then
            poke(0xFF4211,peek(0xFF4211)+0x1)
            if (peek(0xFF421B)<0x90) and (peek(0xFF4211)>=0x71) then
               poke(0xFF421B,peek(0xFF421B)+0x1) -- Fix display effect --
            end
         end
         if (peek(0xFF4211)==0xFF) then
            poke(0xFF1040,0x00)
            poke(0xFF421B,0x90)
         end
      -- Inactive character --
         if (peek(0xFF4053)~=0x10) then
            poke(0xFF4A11,0xFF)
            poke(0xFFFC9B,0x90)
            poke(0xFFFC9F,0x90)
         end
      end
      if (peek(0xFF4220)==0x01) then -- Switched --
      -- Active character --
         poke(0xFFFC9F,peek(0xFF4211)-0x70)
         if (peek(0xFF4211)<0x71) then
            dpoke(0xFFFC9E,0x0000)
            poke(0xFF421B,0x01)
            poke(0xFF1042,0x01)
         end
         if (peek(0x804020)==0xFD) and (peek(0xFF4211)~=0xFF) then
            poke(0xFF1042,0x02)
         end
         if ((peek(0xFF1042)==0x01) and (peek(0xFF4211)<0xFF) and (peek(0xFF4007)==0x00)) or (peek(0xFF1042)==0x02) then
            poke(0xFF4211,peek(0xFF4211)+0x1)
            if (peek(0xFF421B)<0x90) and (peek(0xFF4211)>=0x71) then
               poke(0xFF421B,peek(0xFF421B)+0x1) -- Fix display effect --
            end
         end
         if (peek(0xFF4211)==0xFF) then
            poke(0xFF1042,0x00)
            poke(0xFF421B,0x90)
         end
      -- Inactive character --
         poke(0xFF4A11,0xFF)
         poke(0xFFFC7B,0x90)
         poke(0xFFFC7F,0x90)
      end
   -- HP recovery for 2P side --
      if (peek(0xFF4620)==0x00) then -- Not switched --
      -- Active character --
         if (peek(0xFF4453)~=0x10) then
            poke(0xFFFCBF,peek(0xFF4611)-0x70) -- For normal character --
         end
         if (peek(0xFF4453)==0x10) then
            poke(0xFFFCBF,peek(0xFF4611)-0x71) -- For Apocalypse --
         end
         if (peek(0xFF4611)<0x71) then
            dpoke(0xFFFCBE,0x0000)
            poke(0xFF461B,0x01)
            poke(0xFF1041,0x01)
         end
         if (peek(0x804020)==0xFE) and (peek(0xFF4611)~=0xFF) then
            poke(0xFF1041,0x02)
         end
         if ((peek(0xFF1041)==0x01) and (peek(0xFF4611)<0xFF) and (peek(0xFF4407)==0x00)) or (peek(0xFF1041)==0x02) then
            poke(0xFF4611,peek(0xFF4611)+0x1)
            if (peek(0xFF461B)<0x90) and (peek(0xFF4611)>=0x71) then
               poke(0xFF461B,peek(0xFF461B)+0x1) -- Fix display effect --
            end
         end
         if (peek(0xFF4611)==0xFF) then
            poke(0xFF1041,0x00)
            poke(0xFF461B,0x90)
         end
      -- Inactive character --
         if (peek(0xFF4453)~=0x10) then
            poke(0xFF4E11,0xFF)
            poke(0xFFFCDB,0x90)
            poke(0xFFFCDF,0x90)
         end
      end
      if (peek(0xFF4620)==0x01) then -- Switched --
      -- Active character --
         poke(0xFFFCDF,peek(0xFF4611)-0x70)
         if (peek(0xFF4611)<0x71) then
            dpoke(0xFFFCDE,0x0000)
            poke(0xFF461B,0x01)
            poke(0xFF1043,0x01)
         end
         if (peek(0x804020)==0xFE) and (peek(0xFF4611)~=0xFF) then
            poke(0xFF1043,0x02)
         end
         if ((peek(0xFF1043)==0x01) and (peek(0xFF4611)<0xFF) and (peek(0xFF4407)==0x00)) or (peek(0xFF1043)==0x02) then
            poke(0xFF4611,peek(0xFF4611)+0x1)
            if (peek(0xFF461B)<0x90) and (peek(0xFF4611)>=0x71) then
               poke(0xFF461B,peek(0xFF461B)+0x1) -- Fix display effect --
            end
         end
         if (peek(0xFF4611)==0xFF) then
            poke(0xFF1043,0x00)
            poke(0xFF461B,0x90)
         end
      -- Inactive character --
         poke(0xFF4E11,0xFF)
         poke(0xFFFCBB,0x90)
         poke(0xFFFCBF,0x90)
      end
   -- Other bttle parmeters --
      poke(0xFF5008,0x99)
      poke(0xFF4214,0x03)
      poke(0xFF4213,0x90)
      poke(0xFF4614,0x03)
      poke(0xFF4613,0x90)
   -- Return to character screen --
      if (peek(0xFF5115)==0x01) and ((peek(0xFF541A)==0x01) or (peek(0xFF541A)==0x02)) then
         poke(0xFF5115,0x00)
         poke(0xFF5101,0x03)
         poke(0xFF5105,0x00)
         poke(0xFF5103,0x00)
      end
   end
end
-- Option Mode Script --
if (peek(0xFF1000)==0x03) then
   if (peek(0xFF5101)>0x00) then
      poke(0xFF541B,0xFF)
      poke(0xFFEA2A,0x00) -- Prevent text --
      poke(0xFF5479,0x02) -- English menu --
      poke(0xFF1003,0x01)
   end
   if (peek(0xFF5100)==0x00) and (peek(0xFF1003)==0x01) then -- Restart --
      poke(0xFF5479,region)
      poke(0xFF1002,0x02) -- Menu screen --
      poke(0xFF545F,0x09) -- Increase credit --
      poke(0xFF042B,0x00) -- Shorten wait time --
      poke(0xFF082B,0x00)
      poke(0xFF0C2B,0x00)
      poke(0xFF543C,0x00) -- Hide text --
   end
   if (dpeek(0xFFEA2A)==0x6D70) and (peek(0xFF1003)==0x01) then -- Restore --
      poke(0xFF543C,0x06)
      poke(0xFFFA9E,0x00) -- No original text --
      poke(0xFF1003,0x02)
   end
end
if (peek(0x618003)==0x8F) and (peek(0xFF1003)==0x02) then -- For cutting announcer's voice when return from option --
   dpoke(0xB78,0x0000) -- Remove music code --
   poke(0xFF1003,0x00)
end
-- Pause Function Script. --
    if (peek(0xFF5000)==0x08) and (peek(0xFF5101)>0x00) then
       if (peek(0xFF541A)==0x00) then
       poke(0xFF1002,0x00)
       end
       if (peek(0xFF5115)==0x00) and ((peek(0xFF541A)==0x10) or (peek(0xFF541A)==0x20)) and (peek(0xFF1002)==0x00) then
       poke(0xFF5115,0x01)
       poke(0xFF1002,0xFF)
       end
       if (peek(0xFF5115)==0x01) and ((peek(0xFF541A)==0x10) or (peek(0xFF541A)==0x20)) and (peek(0xFF1002)==0x00) then
       poke(0xFF5115,0x00)
       poke(0xFF1002,0xFF)
       end
    end
off:
    poke(0xBE5,0x17)
    poke(0xBF5,0x19)
    poke(0xC0B,0x18)
    poke(0xBED,0x16)
    lpoke(0xBCA,0x1B40D41A) -- Restore start button --
    lpoke(0x498E,0x494E5345)
    lpoke(0x4992,0x52542043)
    lpoke(0x4996,0x4F494E40)
    dpoke(0xB78,0x13FC) -- Restore music code --

luascript "Enable Apocalypse [lua]"\
 "comm:Hold start on Akuma then press any other button"
run:
-- Selection --
poke(0x88B09,0x20) -- Box location fix --
if (peek(0xFF5105)==0x04) then
  if (peek(0xFF5185)==0x00) and (peek(0xFF51A5)==0x00) then -- Special fix when this script use alone --
     poke(0xBE5,0x17)
  end
  if (peek(0xBE5)==0x17) then -- For normal case --
    if (peek(0xFF541A)==0x01) or (peek(0xFF541A)==0x03) then -- P1 press start? --
      poke(0xFF1010,0x01)
    end
    if (peek(0xFF541A)==0x00) or (peek(0xFF541A)==0x02) then -- P1 Button resumer --
      dpoke(0xFF1010,0x0000)
    end
    if (peek(0xFF541A)==0x02) or (peek(0xFF541A)==0x03) then -- P2 press start? --
      poke(0xFF1012,0x01)
    end
    if (peek(0xFF541A)==0x00) or (peek(0xFF541A)==0x01) then -- P2 Button resumer --
      dpoke(0xFF1012,0x0000)
    end
  end
  if (peek(0xBE5)==0x19) then -- For practice mode, when control is switched --
    if (peek(0xFF541A)==0x01) or (peek(0xFF541A)==0x03) then -- P1 press start? --
      poke(0xFF1012,0x01)
    end
    if (peek(0xFF541A)==0x00) or (peek(0xFF541A)==0x02) then -- P1 Button resumer --
      dpoke(0xFF1012,0x0000)
    end
    if (peek(0xFF541A)==0x02) or (peek(0xFF541A)==0x03) then -- P2 press start? --
      poke(0xFF1010,0x01)
    end
    if (peek(0xFF541A)==0x00) or (peek(0xFF541A)==0x01) then -- P2 Button resumer --
      dpoke(0xFF1010,0x0000)
    end
  end
    if (peek(0xFFA061)==0x1E) and (peek(0xFF5183)==0x00) and (dpeek(0xFF1010)==0x0100) and (peek(0xFFA033)==0xF3) then -- For P1 --
    poke(0xFF4053,0x10)
    poke(0xFF50B1,0x10)
    end
    if (peek(0xFF4053)==0x10) and (peek(0xFF5183)==0x00) and (peek(0xFF5120)==0xFF) then
    poke(0xFF6F34,0x10) -- Hide selection box --
    end
    if (peek(0xFFA061)==0x10) and (peek(0xFF5183)==0x00) and (dpeek(0xFF1010)==0x0000) and (peek(0xFF4853)~=0x10) then
    poke(0xFF4053,0x1E) -- Return to Akuma --
    end
    if (peek(0xFF4053)~=0x10) and (peek(0xFF5183)==0x00) then
    poke(0xFF6F34,0x00) -- Selection box return --
    end
    if (peek(0xFF4053)==0x10) and (peek(0xFF5183)==0x01) then -- No 2nd char. --
    poke(0xFF4853,0x10)
    poke(0xFF50B3,0x10)
    poke(0xFF5183,0x02)
    poke(0xFF5185,0x06)
    end
    if (peek(0xFF4053)==0x10) and (peek(0xFF5183)==0x02) then
    poke(0xFF6EE5,0x00) -- Hide selection color --
    end
    if (peek(0xFF9EE1)==0x1E) and (peek(0xFF51A3)==0x00) and (dpeek(0xFF1012)==0x0100) and (peek(0xFF9EB3)==0xF3) then -- For P2 --
    poke(0xFF4453,0x10)
    poke(0xFF50B5,0x10)
    end
    if (peek(0xFF4453)==0x10) and (peek(0xFF51A3)==0x00) and (peek(0xFF5120)==0xFF) then
    poke(0xFF6E52,0x02) -- Hide selection box --
    end
    if (peek(0xFF9EE1)==0x10) and (peek(0xFF51A3)==0x00) and (dpeek(0xFF1012)==0x0000) and (peek(0xFF4C53)~=0x10) then
    poke(0xFF4453,0x1E) -- Return to Akuma --
    end
    if (peek(0xFF4453)~=0x10) and (peek(0xFF51A3)==0x00) then
    poke(0xFF6E52,0x01) -- Selection box return --
    end
    if (peek(0xFF4453)==0x10) and (peek(0xFF51A3)==0x01) then -- No 2nd char. --
    poke(0xFF4C53,0x10)
    poke(0xFF50B7,0x10)
    poke(0xFF6E75,0x00) -- For box disappeared. --
    poke(0xFF51A3,0x02)
    poke(0xFF51A5,0x06)
    end
    if (peek(0xFF4453)==0x10) and (peek(0xFF51A3)==0x02) then
    poke(0xFF6E05,0x04) -- Hide selection color --
    end
-- Apocalypse Stage --
    if (peek(0xFF4853)==0x10) or (peek(0xFF4C53)==0x10) then -- Apocalypse Stage --
       poke(0xFF5113,0x00)
    end
end
-- Fix music change when Apocalypse in battle --
if (peek(0xFF5113)==0x00) and (peek(0xFF5000)==0x08) and (peek(0xFF5081)~=0x06) then
   if (((peek(0xFF4211)==0x00) and (peek(0xFF4001)==0x00)) or ((peek(0xFF4611)==0x00) and (peek(0xFF4401)==0x00))) and (peek(0xFF1030)==0x00) then -- Any character die of non-Apocalypse side --
      poke(0x618001,0xFF) -- Stop music --
      poke(0x618003,0x07)
      poke(0x61801F,0x00)
      poke(0xFF1030,0x01)
   end
   if (peek(0xFF1030)==0x01) and (peek(0xFF4001)==0x01) then -- P1 other character join in --
      poke(0x618001,0x00)
      if (peek(0xFF4053)~=0x24) then -- Normal characters --
         poke(0x618003,(peek(0xFF4053))/2+0x0B)
      end
      if (peek(0xFF4053)==0x24) then -- Alt.Chun Li --
         poke(0x618003,0x16)
      end
      poke(0x61801F,0x00)
      poke(0xFF1030,0x00)
   end
   if (peek(0xFF1030)==0x01) and (peek(0xFF4401)==0x01) then -- P2 other character join in --
      poke(0x618001,0x00)
      if (peek(0xFF4453)~=0x24) then -- Normal characters --
         poke(0x618003,(peek(0xFF4453))/2+0x0B)
      end
      if (peek(0xFF4453)==0x24) then -- Alt.Chun Li --
         poke(0x618003,0x16)
      end
      poke(0x61801F,0x00)
      poke(0xFF1030,0x00)
   end
end
-- Fix in Arcade Mode --
if (peek(0xFF1000)==0x00) then
   poke(0xAA23,0x10)
   poke(0xAA35,0x10)
   poke(0xAA47,0x10)
   poke(0xAA59,0x10)
-- Skip partner fight for Apocalypse & end the game --
    if (peek(0xFF5081)>=0x07) and ((peek(0xFF5101)==0x01) and (peek(0xFF4853)==0x10)) or ((peek(0xFF5101)==0x02) and (peek(0xFF4C53)==0x10)) then
       if (peek(0xFF5105)==0x0C) and (peek(0xFF5107)==0x02) and (peek(0xFF5109)==0x06) and (peek(0xFF1014)==0x00) then
          poke(0xFF5111,0xFF)
          poke(0xFF5114,0xFF)
          poke(0xFF1014,0x01)
       end
       if (peek(0xFF5105)==0x0C) and (peek(0xFF5111)==0xFF) and (peek(0xFF5114)>0xEF) and (peek(0xFF5114)~=0xFF) then
          poke(0xFF5107,0x00)
          poke(0xFF5105,0x14)
          poke(0xFF5111,0x01)
          poke(0xFF1014,0x00)
       end
    end
end

script "Allow same characters"  
on:
   poke $B584 $60
off:
   poke $B584 $66

script "Infinite Time"  
run:
    poke $FF5008 $99
script "Finish this Round Now!" \
 "comm:Disable Infinite Time before activating this cheat"  
on:
    poke $FF5008 $00
script "Select Invincibility" \
 "comm:May not protect you against All Specials? You need to select 'Neither Player' before OFF to turn it OFF properly" \
 "0x01/Neither Player"\
 "0x02/Player 1 Only"\
 "0x03/Player 2 Only"\
 "0x04/Both Players" 
run:
    if (param==$01)
      poke $07C682 $67
      lpoke $07CDBA $B0416000|(lpeek($07CDBA)&~$FFFFFF00)
      poke $07C706 $67
    endif
    if (param==$02)
      poke $07C682 $60
      lpoke $07CDBA $BDCC6400|(lpeek($07CDBA)&~$FFFFFF00)
      poke $07C706 $67
    endif
    if (param==$03)
      poke $07C706 $60
      lpoke $07CDBA $B9CE6400|(lpeek($07CDBA)&~$FFFFFF00)
      poke $07C682 $67
    endif
    if (param==$04)
      poke $07C682 $60
      poke $07C706 $60
      lpoke $07CDBA $B0416000|(lpeek($07CDBA)&~$FFFFFF00)
    endif
script "Go to the Boss Battle Next!"  
on:
    poke $FF5081 $06
script " "  
script "P1 Infinite Energy (Active Char)"  
run:
    poke $FF4211 $90
    poke $FF421B $90
script "P1 Infinite Energy (Inactive Char)"  
run:
    poke $FF4A11 $90
    poke $FF4A1B $90
script "P1 Drain All Energy Now! (Active Char)"  
on:
    poke $FF4211 $00
    poke $FF421B $00
script "P1 Drain All Energy Now! (Inactive Char)"  
on:
    poke $FF4A11 $00
    poke $FF4A1B $00
script "P1 Always Max Power"  
run:
    poke $FF4214 $03
    poke $FF4213 $90
script "P1 Always Min Power"  
run:
    poke $FF4214 $00
    poke $FF4213 $00
script "P1 Get Max Power Now!"  
on:
    poke $FF4214 $03
    poke $FF4213 $90
script "P1 Get Min Power Now!"  
on:
    poke $FF4214 $00
    poke $FF4213 $00
script "P1 Infinite Recovery Energy"  
run:
    poke $FF421B $90
script "P1 Hits always cause Max Damage"  
run:
    poke $FF4103 $FF
script "P1 Play with Apocalypse"  
run:
    poke $FF4053 $10
    poke $FF4853 $10
    poke $FF50B1 $10
    poke $FF50B3 $10
    poke $FF5113 $00
script "P1 Single Character Fighting Mode"  
run:
    poke $FF4A11 $00
    poke $FF4A1B $00
script "P1 Select Character (Active Char)" \
 "comm:You can use this cheat ingame or on the character select screen (the safest way is to change the inactive character, then switch)." \
 "0x00/Wolverine"\
 "0x02/Cyclops"\
 "0x04/Storm"\
 "0x06/Rogue"\
 "0x08/Gambit"\
 "0x0A/Sabretooth"\
 "0x0C/Juggernaut"\
 "0x0E/Magneto"\
 "0x10/#Apocalypse"\
 "0x12/Ryu"\
 "0x14/Ken Masters"\
 "0x16/Chun-Li"\
 "0x18/Dhalsim"\
 "0x1A/Zangief"\
 "0x1C/M. Bison"\
 "0x1E/#Akuma"\
 "0x20/Charlie"\
 "0x22/Cammy"\
 "0x24/#SFA-costume Chun-Li" 
run:
    poke $FF4053 param
script "P1 Select Character (Inactive Char)" \
 "comm:You can use this cheat ingame or on the character select screen (the safest way is to change the inactive character, then switch)." \
 "0x00/Wolverine"\
 "0x02/Cyclops"\
 "0x04/Storm"\
 "0x06/Rogue"\
 "0x08/Gambit"\
 "0x0A/Sabretooth"\
 "0x0C/Juggernaut"\
 "0x0E/Magneto"\
 "0x10/#Apocalypse"\
 "0x12/Ryu"\
 "0x14/Ken Masters"\
 "0x16/Chun-Li"\
 "0x18/Dhalsim"\
 "0x1A/Zangief"\
 "0x1C/M. Bison"\
 "0x1E/#Akuma"\
 "0x20/Charlie"\
 "0x22/Cammy"\
 "0x24/#SFA-costume Chun-Li" 
run:
    poke $FF4853 param
script "P1 Select Rogue's Stolen Power" \
 "0xFFFF/None"\
 "0x0000/Wolverine"\
 "0x0002/Cyclops"\
 "0x0004/Storm"\
 "0x0008/Gambit"\
 "0x000A/Sabretooth"\
 "0x000C/Juggernaut"\
 "0x000E/Magneto"\
 "0x0012/Ryu"\
 "0x0014/Ken"\
 "0x0016/Chun-Li"\
 "0x0018/Dhalsim"\
 "0x001A/Zangief"\
 "0x001C/Vega (M. Bison)"\
 "0x001E/Gouki (Akuma)"\
 "0x0020/Nash (Charlie)"\
 "0x0022/Cammy"\
 "0x0024/Chun-Li (SFZ)" 
run:
    dpoke $FF4342 param
script " "  
script "P2 Infinite Energy (Active Char)"  
run:
    poke $FF4611 $90
    poke $FF461B $90
script "P2 Infinite Energy (Inactive Char)"  
run:
    poke $FF4E11 $90
    poke $FF4E1B $90
script "P2 Drain All Energy Now! (Active Char)"  
on:
    poke $FF4611 $00
    poke $FF461B $00
script "P2 Drain All Energy Now! (Inactive Char)"  
on:
    poke $FF4E11 $00
    poke $FF4E1B $00
script "P2 Always Max Power"  
run:
    poke $FF4614 $03
    poke $FF4613 $90
script "P2 Always Min Power"  
run:
    poke $FF4614 $00
    poke $FF4613 $00
script "P2 Get Max Power Now!"  
on:
    poke $FF4614 $03
    poke $FF4613 $90
script "P2 Get Min Power Now!"  
on:
    poke $FF4614 $00
    poke $FF4613 $00
script "P2 Infinite Recovery Energy"  
run:
    poke $FF461B $90
script "P2 Hits always cause Max Damage"  
run:
    poke $FF4503 $FF
script "P2 Play with Apocalypse"  
run:
    poke $FF4453 $10
    poke $FF4C53 $10
    poke $FF50B5 $10
    poke $FF50B7 $10
    poke $FF5113 $00
script "P2 Single Character Fighting Mode"  
run:
    poke $FF4E11 $00
    poke $FF4E1B $00
script "P2 Select Character (Active Char)" \
 "comm:You can use this cheat ingame or on the character select screen (the safest way is to change the inactive character, then switch)." \
 "0x00/Wolverine"\
 "0x02/Cyclops"\
 "0x04/Storm"\
 "0x06/Rogue"\
 "0x08/Gambit"\
 "0x0A/Sabretooth"\
 "0x0C/Juggernaut"\
 "0x0E/Magneto"\
 "0x10/#Apocalypse"\
 "0x12/Ryu"\
 "0x14/Ken Masters"\
 "0x16/Chun-Li"\
 "0x18/Dhalsim"\
 "0x1A/Zangief"\
 "0x1C/M. Bison"\
 "0x1E/#Akuma"\
 "0x20/Charlie"\
 "0x22/Cammy"\
 "0x24/#SFA-costume Chun-Li" 
run:
    poke $FF4453 param
script "P2 Select Character (Inactive Char)" \
 "comm:You can use this cheat ingame or on the character select screen (the safest way is to change the inactive character, then switch)." \
 "0x00/Wolverine"\
 "0x02/Cyclops"\
 "0x04/Storm"\
 "0x06/Rogue"\
 "0x08/Gambit"\
 "0x0A/Sabretooth"\
 "0x0C/Juggernaut"\
 "0x0E/Magneto"\
 "0x10/#Apocalypse"\
 "0x12/Ryu"\
 "0x14/Ken Masters"\
 "0x16/Chun-Li"\
 "0x18/Dhalsim"\
 "0x1A/Zangief"\
 "0x1C/M. Bison"\
 "0x1E/#Akuma"\
 "0x20/Charlie"\
 "0x22/Cammy"\
 "0x24/#SFA-costume Chun-Li" 
run:
    poke $FF4C53 param
script "P2 Select Rogue's Stolen Power" \
 "0xFFFF/None"\
 "0x0000/Wolverine"\
 "0x0002/Cyclops"\
 "0x0004/Storm"\
 "0x0008/Gambit"\
 "0x000A/Sabretooth"\
 "0x000C/Juggernaut"\
 "0x000E/Magneto"\
 "0x0012/Ryu"\
 "0x0014/Ken"\
 "0x0016/Chun-Li"\
 "0x0018/Dhalsim"\
 "0x001A/Zangief"\
 "0x001C/Vega (M. Bison)"\
 "0x001E/Gouki (Akuma)"\
 "0x0020/Nash (Charlie)"\
 "0x0022/Cammy"\
 "0x0024/Chun-Li (SFZ)" 
run:
    dpoke $FF4742 param
script " "  
script "No Background Music"  
run:
    cpu audio
    dpoke $F026 $0000
    cpu main
script "Hide Background"  
on:
    temp0=dpeek($FF543A)
    temp1=dpeek($FF543C)
    temp2=dpeek($FF543E)
    temp3=dpeek($FFFA9C)
    temp4=dpeek($FFFA9E)
    temp5=dpeek($FFFAA0)
run:
    if (dpeek($FF5000)==$0800)
      dpoke $FF543A $0
      dpoke $FF543C $0
      dpoke $FF543E $0
      dpoke $FFFA9C $0
      dpoke $FFFA9E $0
      dpoke $FFFAA0 $0
      lpoke $FFDF0A $0
    endif
off:
    dpoke $FF543A temp0
    dpoke $FF543C temp1
    dpoke $FF543E temp2
    dpoke $FFFA9C temp3
    dpoke $FFFA9E temp4
    dpoke $FFFAA0 temp5
script "Select Region" \
 "comm:This cheat sets the machine region - the effectiveness may vary! You have to enable this ASAP - ON or before the ROM check screen! Or enable + RESET" \
 "0x00/Japan"\
 "0x02/USA"\
 "0x04/Hispanic"\
 "0x06/Asia"\
 "0x08/Euro"\
 "0x0A/Brazil" 
run:
    poke $FF5479 param
