luascript "Console Mode [lua]" \
 "comm: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(0xFF830A)==0x00) then
    dpoke(0xFF829E,0x0109) -- 1 coin 1 credits --
    poke(0x1485D,"              ")
    poke(0x30F4,0x06) -- Restore initial value --
    poke(0x30FA,0x0A)
    poke(0xBE89,0x89)
    lpoke(0x3F9A,0x3B410B64)
    lpoke(0x1E6A,0x2B40006E)
    lpoke(0x1EA4,0x1B42006E)
    poke(0x11FFA,0x67) -- Restore original HP function --
    p1char=0x0000
    p2char=0x0004
    p1mode=0x00
    p2mode=0x00
    if (peek(0xFF8005)>0x00) and (peek(0xFF806E)>=0x10) and (peek(0xFF2000)~=0x03) then -- Start button start --
      poke(0xFF830A,0x09) -- Max credit --
      poke(0x618001,0x00) -- Sound effect --
      poke(0x618003,0x40)
      poke(0x61801F,0x00)
    end
end
-- Title Screen --
if (dpeek(0xFFD3B0)==0x0B58) and (peek(0xFF830A)>0x00) and (peek(0x910000)~=0xE0) then
    if (peek(0xFF2030)==0x00) and (peek(0x804020)==0xFF) then
       lpoke(0x1E6A,0x00000000) -- Disable original start button --
       lpoke(0x1EA4,0x00000000)
       dpoke(0xFF806E,0x0000)
    end
    if (peek(0x1E6A)==0x00) and ((peek(0x804020)==0xFE) or (peek(0x804020)==0xFD)) and (peek(0xFF806E)==0x00) then -- Leaving title screen --
       poke(0xFF2030,0x01)
     end
end
-- Menu in the Title screen --
if (dpeek(0xFFD3B0)==0x0B58) and (peek(0xFF2030)==0x01) then
    if ((peek(0xFF8077)==0x00) and (peek(0xFF807B)==0x00)) and (peek(0xFF2001)==0xFF) then
      poke(0xFF2001,0x00)
      poke(0x910007,0x6C) -- Restore arrow --
      poke(0x91000F,0x0C)
      poke(0xFF2020,0x00) -- Act as music 'stopper' --
    end
    if (peek(0xFF8077)==0x04) or (peek(0xFF807B)==0x04) then
       poke(0x91000F,0x88) -- Hide arrow 2 --
       if peek(0xFF2020)==0x00 then -- Sound effect --
         poke(0x618001,0x00)
         poke(0x618003,0x42)
         poke(0x61801F,0x00)
         poke(0xFF2020,0xFF)
       end
       if (dpeek(0xFF2000)==0x0000) then
         dpoke(0xFF2000,0x01FF)
       elseif (dpeek(0xFF2000)==0x0100) then
         dpoke(0xFF2000,0x02FF)
       elseif (dpeek(0xFF2000)==0x0200) then
         dpoke(0xFF2000,0x03FF)
       elseif (dpeek(0xFF2000)==0x0300) then
         dpoke(0xFF2000,0x00FF)
       end
    end
    if (peek(0xFF8077)==0x08) or (peek(0xFF807B)==0x08) then
       poke(0x910007,0x88) -- Hide arrow 1 --
       if peek(0xFF2020)==0x00 then -- Sound effect --
         poke(0x618001,0x00)
         poke(0x618003,0x42)
         poke(0x61801F,0x00)
         poke(0xFF2020,0xFF)
       end
       if (dpeek(0xFF2000)==0x0000) then
         dpoke(0xFF2000,0x03FF)
       elseif (dpeek(0xFF2000)==0x0300) then
         dpoke(0xFF2000,0x02FF)
       elseif (dpeek(0xFF2000)==0x0200) then
         dpoke(0xFF2000,0x01FF)
       elseif (dpeek(0xFF2000)==0x0100) then
         dpoke(0xFF2000,0x00FF)
       end
    end
    if (peek(0x910000)~=0xE0) then -- Menu text setting --
        poke(0xFF8035,0x20) -- Shift original text --
        poke(0x910000,0xE0) -- Arrow 1 --
        poke(0x910001,0xF3)
        poke(0x910003,0xBF)
        poke(0x910004,0x80)
        poke(0x910005,0xA7)
        poke(0x910007,0x6C)
        poke(0x910008,0xE0) -- Arrow 2 --
        poke(0x910009,0xF8)
        poke(0x91000B,0xE5)
        poke(0x91000C,0x80)
        poke(0x91000D,0xA7)
        poke(0x91000F,0x0C)
        for i=0,0x60,0x8 do
           poke(0x910017+i,0x1A) -- Text color --
        end
        for i=0,0x60,0x8 do
           poke(0x910013+i,0xD5) -- Text y-location --
        end
        for i=0,0x30,0x8 do
           poke(0x910010+i,0xE0) -- Text x-location --
        end
        for i=0,0x28,0x8 do
           poke(0x910048+i,0xE1)
        end
        for i=0,0x60,0x8 do
           poke(0x910011+i,0xB0+i/8*0xC)
        end
        for i=0,0x60,0x8 do
           poke(0x910014+i,0x80) -- Text 1st byte --
        end
    end
    -- Menu Text --
      if (peek(0xFF2000)==0x00) then -- Arcade Mode --
        poke(0x910015,0xA0)
        poke(0x91001D,0xC1)
        poke(0x910025,0xD2)
        poke(0x91002D,0xC3)
        poke(0x910035,0xC1)
        poke(0x91003D,0xC4)
        poke(0x910045,0xC5)
        poke(0x91004D,0xA0)
        poke(0x910055,0xCD)
        poke(0x91005D,0xCF)
        poke(0x910065,0xC4)
        poke(0x91006D,0xC5)
        poke(0x910075,0xA0)
      elseif (peek(0xFF2000)==0x01) then -- Versus Mode --
        poke(0x910015,0xA0)
        poke(0x91001D,0xD6)
        poke(0x910025,0xC5)
        poke(0x91002D,0xD2)
        poke(0x910035,0xD3)
        poke(0x91003D,0xD5)
        poke(0x910045,0xD3)
        poke(0x91004D,0xA0)
        poke(0x910055,0xCD)
        poke(0x91005D,0xCF)
        poke(0x910065,0xC4)
        poke(0x91006D,0xC5)
        poke(0x910075,0xA0)
      elseif (peek(0xFF2000)==0x02) then -- Training Mode --
        poke(0x910015,0xD4)
        poke(0x91001D,0xD2)
        poke(0x910025,0xC1)
        poke(0x91002D,0xC9)
        poke(0x910035,0xCE)
        poke(0x91003D,0xC9)
        poke(0x910045,0xCE)
        poke(0x91004D,0xC7)
        poke(0x910055,0xA0)
        poke(0x91005D,0xCD)
        poke(0x910065,0xCF)
        poke(0x91006D,0xC4)
        poke(0x910075,0xC5)
      elseif (peek(0xFF2000)==0x03) then -- Option Mode --
        poke(0x910015,0xA0)
        poke(0x91001D,0xCF)
        poke(0x910025,0xD0)
        poke(0x91002D,0xD4)
        poke(0x910035,0xC9)
        poke(0x91003D,0xCF)
        poke(0x910045,0xCE)
        poke(0x91004D,0xA0)
        poke(0x910055,0xCD)
        poke(0x91005D,0xCF)
        poke(0x910065,0xC4)
        poke(0x91006D,0xC5)
        poke(0x910075,0xA0)
      end
    -- Press button --
    if (peek(0xFF8076)>0x00) or (peek(0xFF8077)>=0x10) then -- P1 press button --
       poke(0xFF801C,0x00) -- Setup timer --
       poke(0x618001,0x00) -- Soud effect --
       poke(0x618003,0x43)
       poke(0x61801F,0x00)
       poke(0xFF2030,0x02)
    end
    if (peek(0xFF807A)>0x00) or (peek(0xFF807B)>=0x10) then -- P2 press button --
       poke(0xFF801C,0x00) -- Setup timer --
       poke(0x618001,0x00) -- Soud effect --
       poke(0x618003,0x43)
       poke(0x61801F,0x00)
       poke(0xFF2030,0x03)
    end
end
-- Start game --
if ((peek(0xFF2030)==0x02) or (peek(0xFF2030)==0x03)) and (peek(0xFF801C)>=0x13) then
    if (peek(0xFF2030)==0x02) then
       poke(0xFF806E,0x10) -- P1 start --
    end
    if (peek(0xFF2030)==0x03) then
       poke(0xFF806E,0x20) -- P2 start --
    end
    poke(0xFF2030,0x04)
end
-- Restore value --
if (peek(0xFF8001)==0x02) and (peek(0xFF2030)==0x04) then
    lpoke(0x1E6A,0x2B40006E) -- Restore original start button --
    lpoke(0x1EA4,0x1B42006E)
    poke(0xFF2030,0x00)
end
-- Infinity Credits Script --
if (peek(0xFF830A)>0x00) then
    poke(0xFF830A,0x09)
end
-- Versus Mode Script --
if (peek(0xFF2000)==0x01) then
    if (dpeek(0xFFD3B0)==0x0B58) and (peek(0xFF8316)>0x00) then
       poke(0xFF8316,0x03) -- Auto activate P1 & P2 --
       poke(0xBE89,0x8A) -- Flight related --
       lpoke(0x3F9A,0x00000000) -- Stage select related --
    end
    if (peek(0xFF800D)==0x08) then -- Memorize characters --
       p1char=dpeek(0xFF8666)
       p2char=dpeek(0xFF8A66)
    end
    if (peek(0xFF8005)==0x0E) then
       poke(0xFF863C,0xFF) -- Prevent continue text --
       poke(0xFF8A3C,0xFF)
       poke(0xFF8664,0x01) -- Remain active even lose --
       poke(0xFF8A64,0x01)
    end
    if (peek(0xFF8005)==0x0E) and (peek(0xFF800F)>=0x01) and (peek(0xFF800F)<=0x03)  then -- Return to char select --
       poke(0xFF8001,0x08)
       poke(0xFF2003,0x01)
    end
    if (peek(0xFF8001)==0x02) and (peek(0xFF8005)==0x02) and (peek(0xFF2003)==0x01) then -- Deselection --
       if (peek(0xFF82C2)==0x04) then -- P1 select game speed --
         poke(0xFF83BC,0x00)
       else
         poke(0xFF83BC,0x02)
       end
       poke(0xFF83C0,0x00)
       poke(0xFF87BC,0x02)
       poke(0xFF87C0,0x00)
       dpoke(0xFF8666,p1char)
       dpoke(0xFF8A66,p2char)
       poke(0xFF2003,0x00)
    end
    if (peek(0xFF8001)==0x02) then
       poke(0xFF8B8B,0x02) -- Disable Challenger! text --
       if (peek(0xFF87BC)==0x02) then
          if math.random()*255<=127 then -- Randomize stage select - P1 or P2 --
            poke(0xFF2004,0x01)
          else
            poke(0xFF2004,0x02)
          end
       end
       if (peek(0xFF2004)<=0x01) and (peek(0xFF8005)==0x02) then -- P2 character's stage --
         poke(0xFF8B65,peek(0xFF8A67))
         if ((peek(0xFF8667)==0x00) and (peek(0xFF8A67)==0x10)) or ((peek(0xFF8667)==0x10) and (peek(0xFF8A67)==0x00)) then
           poke(0xFF8B89,0x01) -- No flight when Ryu vs Akuma or vice versa --
         else
           poke(0xFF8B89,0x00) -- Flight from P1 --
         end
       end
       if (peek(0xFF2004)==0x02) and (peek(0xFF8005)==0x02) then -- P1 character's stage --
         poke(0xFF8B65,peek(0xFF8667))
         if ((peek(0xFF8667)==0x00) and (peek(0xFF8A67)==0x10)) or ((peek(0xFF8667)==0x10) and (peek(0xFF8A67)==0x00)) then
           poke(0xFF8B89,0x00) -- No flight when Ryu vs Akuma or vice versa --
         else
           poke(0xFF8B89,0x01) -- Flight from P2 --
         end
       end
       if (peek(0xFF8B65)==0x10) and (peek(0xFF8009)==0x04) then -- Ryu's stage for Akuma --
         poke(0xFF8B65,0x00)
       end
    end
end
-- Training Mode Script --
if (peek(0xFF2000)==0x02) then
    if (dpeek(0xFFD3B0)==0x0B58) and (peek(0xFF8316)>0x00) then
       poke(0xFF8316,0x03) -- Auto activate P1 & P2 --
       poke(0xBE89,0x8A) -- Flight related --
       lpoke(0x3F9A,0x00000000) -- Stage select related --
    end
    if (peek(0xFF8001)==0x02) then
       poke(0xFF8B8B,0x02) -- Disable Challenger! text --
       if ((peek(0xFF83BC)==0x07) and (peek(0xFF87BC)<0x07)) and (dpeek(0xFF8076)==0x0000) then -- P1 as main player --
         poke(0x30F4,0x0A) -- Switch control --
         poke(0x30FA,0x06)
         poke(0xFF8B89,0x00) -- Flight from P1 --
         poke(0xFF2004,0x01)
       end
       if ((peek(0xFF87BC)==0x07) and (peek(0xFF83BC)<0x07)) and (dpeek(0xFF807A)==0x0000) then -- P2 as main player --
         poke(0x30F4,0x0A) -- Switch control --
         poke(0x30FA,0x06)
         poke(0xFF8B89,0x01) -- Flight from P2 --
         poke(0xFF2004,0x02)
       end
       if ((peek(0xFF83BC)==0x07) and (peek(0xFF87BC)==0x07)) or ((peek(0xFF83BC)<=0x02) and (peek(0xFF87BC)<=0x02)) then -- Restore control --
         poke(0x30F4,0x06)
         poke(0x30FA,0x0A)
       end
    end
    if (peek(0xFF8005)==0x08) then
       if (peek(0xFF8009)==0x00) then
          lpoke(0xFF8366,0x00FF00FF) -- Increase HP at start --
          lpoke(0xFF8766,0x00FF00FF)
          poke(0x11FFA,0x66) -- Disable original HP function --
       end
       poke(0xFF8BFD,0x28) -- infinite time --
    -- P1 HP recovery --
       if (peek(0xFF8367)>=0x6F) then -- HP bar display --
          poke(0xFF84F9,peek(0xFF8367)-0x6F)
       end
       if (peek(0xFF8367)<0x6F)  then -- When HP bar rearch 0 --
          dpoke(0xFF84F8,0x0000)
          poke(0xFF2040,0x01)
          if (peek(0xFF8367)<0x4F) then -- Prevent killed by combos --
             poke(0xFF8367,0x6F)
          end
       end
       if (peek(0x804020)==0xFD) then -- Start button retore HP --
          poke(0xFF2040,0x01)
       end
       if (peek(0xFF8367)<0xFF) and (peek(0xFF2040)==0x01) and (peek(0xFF833F)==0x00) then -- Restore HP --
          poke(0xFF8367,peek(0xFF8367)+0x1)
          poke(0xFF8369,peek(0xFF8369)+0x1)
       end
       if (peek(0xFF8367)==0xFF) then
          poke(0xFF2040,0x00)
       end
    -- P2 HP recovery --
       if (peek(0xFF8767)>=0x6F) then -- HP bar display --
          poke(0xFF88F9,peek(0xFF8767)-0x6F)
       end
       if (peek(0xFF8767)<0x6F)  then -- When HP bar rearch 0 --
          dpoke(0xFF88F8,0x0000)
          poke(0xFF2041,0x01)
          if (peek(0xFF8767)<0x4F) then -- Prevent killed by combos --
             poke(0xFF8767,0x6F)
          end
       end
       if (peek(0x804020)==0xFE) then -- Start button retore HP --
          poke(0xFF2041,0x01)
       end
       if (peek(0xFF8767)<0xFF) and (peek(0xFF2041)==0x01) and (peek(0xFF873F)==0x00) then -- Restore HP --
          poke(0xFF8767,peek(0xFF8767)+0x1)
          poke(0xFF8769,peek(0xFF8769)+0x1)
       end
       if (peek(0xFF8767)==0xFF) then
          poke(0xFF2041,0x00)
       end
       poke(0xFF85F0,0x30) -- P1 infinite power --
       poke(0xFF89F0,0x30) -- P2 infinite power --
       if (peek(0xFF8009)==0xFF) and ((peek(0xFF806E)==0x10) or (peek(0xFF806E)==0x20)) then -- Return to Character Screen Step 1 --
         p1char=dpeek(0xFF8666) -- Memorize characters --
         p2char=dpeek(0xFF8A66)
         poke(0xFF8005,0x0E)
         dpoke(0xFF800E,0x0001)
         poke(0xFF2003,0x01)
         poke(0x11FFA,0x67) -- Restore original HP function --
       end
       if (peek(0xFF2003)==0x01) then -- Return to Character Screen Step 2 --
         poke(0xFF8001,0x08)
         poke(0xFF2003,0x02)
       end
    end
       if (peek(0xFF8001)==0x02) and (peek(0xFF8005)==0x02) and (peek(0xFF2003)==0x02) then -- Deselection --
          if (peek(0xFF82C2)==0x04) then -- P1 select game speed --
            poke(0xFF83BC,0x00)
          else
            poke(0xFF83BC,0x02)
          end
          poke(0xFF83C0,0x00)
          poke(0xFF87BC,0x02)
          poke(0xFF87C0,0x00)
          dpoke(0xFF8666,p1char)
          dpoke(0xFF8A66,p2char)
          poke(0xFF2003,0x00)
       end
       if (peek(0xFF2004)<=0x01) and (peek(0xFF8005)==0x02) then -- P2 character's stage --
         poke(0xFF8B65,peek(0xFF8A67))
         if ((peek(0xFF8667)==0x00) and (peek(0xFF8A67)==0x10)) or ((peek(0xFF8667)==0x10) and (peek(0xFF8A67)==0x00)) then
           poke(0xFF8B89,0x01) -- No flight when Ryu vs Akuma or vice versa --
         else
           poke(0xFF8B89,0x00) -- Flight from P1 --
         end
       end
       if (peek(0xFF2004)==0x02) and (peek(0xFF8005)==0x02) then -- P1 character's stage --
         poke(0xFF8B65,peek(0xFF8667))
         if ((peek(0xFF8667)==0x00) and (peek(0xFF8A67)==0x10)) or ((peek(0xFF8667)==0x10) and (peek(0xFF8A67)==0x00)) then
           poke(0xFF8B89,0x00) -- No flight when Ryu vs Akuma or vice versa --
         else
           poke(0xFF8B89,0x01) -- Flight from P2 --
         end
       end
       if (peek(0xFF8B65)==0x10) and (peek(0xFF8009)==0x04) then -- Ryu's stage for Akuma --
         poke(0xFF8B65,0x00)
       end
end
-- Option Mode Script --
if (peek(0xFF2000)==0x03) and ((peek(0xFF806E)==0x10) or (peek(0xFF806E)==0x20)) and (peek(0xFF8001)==0x00) then -- Step 1 --
    poke(0xFF806E,0x40)
    poke(0xFF2005,0x01)
end
if (peek(0xFF8005)==0x0E) and (peek(0xFF2005)==0x01) then -- step 2 - Restore value --
    lpoke(0x1E6A,0x00000000) -- Re-disable original start button --
    lpoke(0x1EA4,0x00000000)
    poke(0xFF830A,0x09) -- Infinity credit --
    poke(0xFF2030,0x01)
    poke(0xFF2005,0x02)
end
if (peek(0xFF8005)==0x00) and (peek(0xFF2005)==0x02) then -- step 3 - Prevent press start text --
    poke(0xFF8035,0x20)
    if (dpeek(0xFFD3B0)==0x0B58) then
      poke(0xFF2005,0x00)
    end
end
-- Pause Function Script --
    if (peek(0xFF8005)==0x08) and (peek(0xFF800D)==0x00) then
       if (peek(0xFF806E)==0x00) then
       poke(0xFF2002,0x00)
       end
       if (peek(0xFF8009)==0x02) and ((peek(0xFF806E)==0x01) or (peek(0xFF806E)==0x02)) and (peek(0xFF2002)==0x00) then
       poke(0xFF8009,0xFF)
       poke(0xFF2002,0xFF)
       end
       if (peek(0xFF8009)==0xFF) and ((peek(0xFF806E)==0x01) or (peek(0xFF806E)==0x02)) and (peek(0xFF2002)==0x00) then
       poke(0xFF8009,0x02)
       poke(0xFF2002,0xFF)
       end
    end
off:
    poke(0x1485D,"INSERT 2 COINS")
    poke(0x30F4,0x06)
    poke(0x30FA,0x0A)
    poke(0xBE89,0x89)
    lpoke(0x3F9A,0x3B410B64)
    lpoke(0x1E6A,0x2B40006E)
    lpoke(0x1EA4,0x1B42006E)
    poke(0x11FFA,0x67) -- Restore original HP function --

luascript "Enable Akuma/Gouki [lua]" \
 "comm:Press three punch buttons to select"
run:
if (peek(0xFF8001)==0x02) then
    if (dpeek(0xFF8666)==0x0000) and (peek(0xFF864D)==0x70) then -- P1 --
      poke(0xFF8667,0x10)
      if (dpeek(0xFF8A67)==0x1000) and (peek(0xFF87BC)==0x07) then
        poke(0xFF8668,0x01)
      else
        poke(0xFF8668,0x00)
      end
    end
    if (dpeek(0xFF8A66)==0x0000) and (peek(0xFF8A4D)==0x70) then -- P2 --
      poke(0xFF8A67,0x10)
      if (dpeek(0xFF8667)==0x1000) and (peek(0xFF83BC)==0x07) then
        poke(0xFF8A68,0x01)
      else
        poke(0xFF8A68,0x00)
      end
    end
end
-- Enable Akuma's music --
if (peek(0xFF8009)==0x04) then
    if (peek(0xFF2004)==0x01) and (peek(0xFF8A67)==0x10) then -- Set indicator when P1 as main player --
       poke(0xFF2010,0x01)
    end
    if (peek(0xFF2004)==0x02) and (peek(0xFF8667)==0x10) then -- Set indicator when P2 as main player --
       poke(0xFF2010,0x01)
    end
end
-- With Sound Association --
if (peek(0xFF2010)==0x01) and (peek(0xFF8005)==0x08) and (peek(0x618001)==0xFF) and (peek(0x618003)==0x00) then
    if (peek(0xFF8009)==0x00) and (peek(0xFF800D)==0x02) and (peek(0xFF2011)==0x00) then -- Normal tempo Akuma's music --
       poke(0x618001,0x00)
       poke(0x618003,0xD5)
       poke(0x61801F,0x00)
       poke(0xFF2011,0x01)
    end
    if ((peek(0xFF8367)<=0x2F) or (peek(0xFF8767)<=0x2F)) and (peek(0xFF8009)~=0x06) and (peek(0xFF2012)==0x00)  then -- Fast tempo Akuma's music --
       poke(0x618001,0x00)
       poke(0x618003,0xD6)
       poke(0x61801F,0x00)
       poke(0xFF2012,0x01)
    end
end
if (peek(0xFF8005)==0x08) and (peek(0xFF8009)==0x04) then -- Restore after each round --
    poke(0xFF2011,0x00)
    poke(0xFF2012,0x00)
end
-- Without Sound Association --
if (peek(0xFF2010)==0x01) and (peek(0x618001)==0x00) and (peek(0x618003)==0x02) then -- Normal tempo Akuma's music --
    poke(0x618001,0x00)
    poke(0x618003,0xD5)
    poke(0x61801F,0x00)
end
if (peek(0xFF2010)==0x01) and (peek(0x618001)==0x00) and (peek(0x618003)==0x12) then -- Fast tempo Akuma's music --
    poke(0x618001,0x00)
    poke(0x618003,0xD6)
    poke(0x61801F,0x00)
end
-- Restore indicator after full battle --
if (peek(0xFF87BC)==0x02) then
    poke(0xFF2010,0x00)
    poke(0xFF2011,0x00) -- For practice mode --
end

luascript "Select Same Character (for SF2 characters)(By coin button) [lua]" \
 "comm:Press coin button to select the character occupied or selected by the other side"
run:
if (peek(0x30F4)==0x06) and (peek(0xFF8001)==0x02) then -- For Normal Control --
    if (peek(0xFF8666)==0x04) and (peek(0xFF8A66)==0x04) then
       if (peek(0xFF83BC)==0x06) and (peek(0xFF806E)==0x01) then
         poke(0xFF8667,peek(0xFF8A67))
       end
       if (peek(0xFF87BC)==0x06) and (peek(0xFF806E)==0x02) then
         poke(0xFF8A67,peek(0xFF8667))
       end
    end
end
if (peek(0x30F4)==0x0A) and (peek(0xFF8001)==0x02) then -- For Switched Control --
    if (peek(0xFF8666)==0x04) and (peek(0xFF8A66)==0x04) then
       if (peek(0xFF87BC)==0x06) and (peek(0xFF806E)==0x01) then
         poke(0xFF8A67,peek(0xFF8667))
       end
       if (peek(0xFF83BC)==0x06) and (peek(0xFF806E)==0x02) then
         poke(0xFF8667,peek(0xFF8A67))
       end
    end
end

luascript "Alternative Character Select BGM [lua]"
run:
    if (dpeek(0xFF1E4C)==0x5039) or (dpeek(0xFF1E4C)==0x1639) then
       poke(0x618001,0x00)
       poke(0x618003,0xD3)
       poke(0x61801F,0x00)
    end

script "Infinite Credits"  
run:
    poke $FF830A $09
script "Infinite Time"  
run:
    if peek($FF8BFC)>01
      dpoke $FF8BFC $9928
      dpoke $FF1E4C $503C
    endif
    if (dpeek($FF83BE)==$0202)or(dpeek($FF83BE)==$0402)
      dpoke $FF835A $0384
    endif
    if (dpeek($FF87BE)==$0202)or(dpeek($FF87BE)==$0402)
      dpoke $FF875A $0384
    endif
script "Finish this Round Now!"  
on:
    dpoke $FF8BFC $0101
script "Disable projectile impact slowdown"  
run:
    if (peek($FF8366)!=$FF)and(peek($FF8766)!=$FF)
      poke $FF8C29 $00
    endif
script "Select Background" \
 "0x00/Ryu"\
 "0x01/E.Honda"\
 "0x02/Blanka"\
 "0x03/Guile"\
 "0x04/Ken"\
 "0x05/Chun Li"\
 "0x06/Zangief"\
 "0x07/Dhalsim"\
 "0x08/M.Bison (Dictator)"\
 "0x09/Sagat"\
 "0x0A/Balrog (Boxer)"\
 "0x0B/Vega (Claw)"\
 "0x0C/Cammy"\
 "0x0D/T.Hawk"\
 "0x0E/Fei Long"\
 "0x0F/Dee Jay" 
run:
    if (dpeek($FF8004)==$4)or(dpeek($FF8004)==$E)
      dpoke $FF8B64 param
      poke $FFBDF2 param
      poke $FFBEB2 param
      poke $FFD0B2 param
      poke $FFD295 param
    endif
script "Select Starting Stage" \
 "0x00/Stage 1"\
 "0x01/Stage 2"\
 "0x02/Stage 3"\
 "0x03/Stage 4"\
 "0x04/Stage 5"\
 "0x05/Stage 6"\
 "0x06/Stage 7"\
 "0x07/Stage 8"\
 "0x08/Stage 9 (Boxer)"\
 "0x09/Stage 10 (Claw)"\
 "0x0A/Stage 11 (Sagat)"\
 "0x0B/Stage 12 (Dictator)" 
on:
    temp0=peek($003FB7)
run:
    poke $003FB7 param
off:
    poke $003FB7 temp0
script "Select Ending" \
 "0101/No Losses (Akuma/Gouki)"\
 "0100/No Continues (Dictator)"\
 "00/Normal (Dictator)" 
run:
    if param>00
      dpoke ($FF833C+$34E) param
      dpoke ($FF873C+$34E) param
    endif
    if param==$0
      poke ($FF833C+$34E) $00
      poke ($FF873C+$34E) $00
    endif
script " "  
script "P1 Infinite Energy"  
run:
    if (dpeek($FF8366)<$60)and((peek($FF833F)&$10)==$00)
      dpoke $FF8366 $90
      dpoke $FF84F8 $90
    endif
script "P1 Dizzy Status" \
 "0x00/Never get dizzied"\
 "0x40/Always get dizzied" 
run:
    dpoke $FF8398 param
    dpoke $FF839A param
script "P1 Drain All Energy Now!"  
on:
    poke $FF8367 $00
    poke $FF84F9 $00
script "P1 Infinite Power"  
run:
    if dpeek($FF8008)==$2
      poke $FF85F0 $30
    endif
script "P1 Always have No Power"  
run:
    poke $FF85F0 $00
script "P1 Drain All Power Now!"  
on:
    poke $FF85F0 $00
script "P1 Allow special moves during jump"  
run:
    poke $FF84BD $00
script "P1 Select Character" \
 "comm:If you enable during a round the graphics will not be correct. Best used on the character select screen." \
 "0x00/Ryu"\
 "0x01/E. Honda"\
 "0x02/Blanka"\
 "0x03/Guile"\
 "0x04/Ken"\
 "0x05/Chun-Li"\
 "0x06/Zangief"\
 "0x07/Dhalsim"\
 "0x08/M. Bison (Dictator)"\
 "0x09/Sagat"\
 "0x0A/Balrog (Boxer)"\
 "0x0B/Vega (Claw)"\
 "0x0C/Cammy"\
 "0x0D/T. Hawk"\
 "0x0E/Fei Long"\
 "0x0F/Dee Jay"\
 "0x10/#Akuma/Gouki" 
run:
    poke $FF8667 param
    if (param>=$08)and(peek($FF8666)==$04)
      poke $FF8666 $06
    endif
    if (param>=$0C)and(peek($FF8666)>=$04)
      poke $FF8666 $02
    endif
    if (param>=$10)and(peek($FF8666)!=$00)
      poke $FF8666 $00
    endif
script "P1 Select SuperT Colour" \
 "0x00/LP button"\
 "0x01/MP button"\
 "0x02/HP button"\
 "0x03/LK button"\
 "0x04/MK button"\
 "0x05/HK button"\
 "0x06/Start button"\
 "0x07/Hold any P/K button" 
run:
    poke $FF8668 param
    if (peek($FF8666)!=$0)or(peek($FF8667)==$10)
      poke $FF8668 (param&$01)
    endif
script "P1 Easy charge moves"  
run:
    temp0=peek($FF833C+$32B)
    temp1=peek($FF833C+$32A)
    if peek($FF833C)==$0
      temp0=$FF
    endif
    if (temp0==$1)and(temp1!=$0)
      poke ($FF833C+$81) $01
    endif
    if (temp0==$1)and(temp1!=$0)and(peek(FF833C+$AA)<=$02)
      poke ($FF833C+$AB) $01
    endif
    if (temp0==$1)and(temp1==$0)and(peek(FF833C+$88)<=$02)
      poke ($FF833C+$89) $01
    endif
    if (temp0==$1)and(temp1==$0)and(peek(FF833C+$90)<=$02)
      poke ($FF833C+$91) $01
    endif
    if (temp0==$1)and(temp1==$0)and(peek(FF833C+$94)<=$02)
      poke ($FF833C+$95) $01
    endif
    if temp0==$2
      poke ($FF833C+$81) $01
      poke ($FF833C+$B4) $01
      poke ($FF833C+$BA) $01
      poke ($FF833C+$C2) $01
    endif
    if temp0==$3
      poke ($FF833C+$81) $01
      poke ($FF833C+$87) $01
      poke ($FF833C+$95) $01
    endif
    if temp0==$5
      poke ($FF833C+$81) $01
    endif
    if (temp0==$5)and(temp1==$0)and(peek(FF833C+$B0)<=$02)
      poke ($FF833C+$B1) $01
    endif
    if (temp0==$5)and(peek(FF833C+$BA)<=$02)
      poke ($FF833C+$BB) $01
    endif
    if (temp0==$5)and(peek(FF833C+$BF)<=$02)
      poke ($FF833C+$C0) $01
    endif
    if temp0==$8
      poke ($FF833C+$81) $01
      poke ($FF833C+$89) $01
      poke ($FF833C+$92) $01
      poke ($FF833C+$C6) $01
    endif
    if (temp0==$8)and(peek(FF833C+$AC)<=$02)
      poke ($FF833C+$AD) $01
    endif
    if temp0==$A
      poke ($FF833C+$81) $01
      poke ($FF833C+$89) $01
      poke ($FF833C+$C1) $01
      poke ($FF833C+$D7) $01
      poke ($FF833C+$DE) $01
      dpoke ($FF833C+$B2) $0101
    endif
    if (temp0==$A)and(temp1==$0)and(peek(FF833C+$D4)<=$02)
      poke ($FF833C+$D5) $01
    endif
    if temp0==$B
      poke ($FF833C+$81) $01
    endif
    if (temp0==$B)and(peek(FF833C+$88)<=$02)
      poke ($FF833C+$89) $01
    endif
    if (temp0==$B)and(peek(FF833C+$8C)<=$02)
      poke ($FF833C+$8D) $01
    endif
    if (temp0==$B)and(peek(FF833C+$90)<=$02)
      poke ($FF833C+$91) $01
    endif
    if (temp0==$B)and(temp1==$0)and(peek(FF833C+$99)<=$02)
      poke ($FF833C+$9A) $01
    endif
    if (temp0==$B)and(temp1==$0)and(peek(FF833C+$9D)<=$02)
      poke ($FF833C+$9E) $01
    endif
    if (temp0==$F)and(peek(FF833C+$92)<=$02)
      poke ($FF833C+$93) $01
    endif
    if (temp0==$F)and(peek(FF833C+$96)<=$02)
      poke ($FF833C+$97) $01
    endif
    if (temp0==$F)and(peek(FF833C+$A6)<=$02)
      poke ($FF833C+$A7) $01
    endif
    if (temp0==$F)and(temp1==$0)and(peek(FF833C+$AB)<=$02)
      poke ($FF833C+$AC) $01
    endif
    if (temp0==$F)and(temp1==$0)and(peek(FF833C+$AF)<=$02)
      poke ($FF833C+$B0) $01
    endif
script "P1 Easy QCF + QCB moves"  
run:
    temp0=peek($FF833C+$32B)
    temp1=peek($FF833C+$32A)
    if peek($FF833C)==$0
      temp0=$FF
    endif
    if ((temp0==$0)or(temp0==$4)or(temp0==$10))and(temp1<=$2)
      poke ($FF833C+$90) $04
      poke ($FF833C+$94) $04
    endif
    if ((temp0==$0)or(temp0==$4))and(temp1>$2)
      poke ($FF833C+$90) $04
      poke ($FF833C+$98) $04
    endif
    if (temp0==$4)and(temp1==$0)
      poke ($FF833C+$E6) $04
    endif
    if (temp0==$7)and(temp1<=$2)
      poke ($FF833C+$80) $04
    endif
    if (temp0==$7)and(temp1>$2)
      lpoke ($FF833C+$90) $02080004
    endif
    if (temp0==$9)and(temp1<=$2)
      poke ($FF833C+$88) $04
      poke ($FF833C+$8C) $04
    endif
    if (temp0==$9)and(temp1>$2)
      lpoke ($FF833C+$90) $02080004
      lpoke ($FF833C+$A0) $02080004
    endif
    if temp0==$C
      poke ($FF833C+$96) $04
    endif
    if temp0==$E
      poke ($FF833C+$90) $04
      poke ($FF833C+$A0) $04
    endif
script "P1 Easy F,D,DF + B,D,DB moves"  
run:
    temp0=peek($FF833C+$32B)
    temp1=peek($FF833C+$32A)
    if peek($FF833C)==$0
      temp0=$FF
    endif
    if ((temp0==$0)or(temp0==$4)or(temp0==$10))and(temp1<=$2)
      poke ($FF833C+$98) $04
    endif
    if ((temp0==$0)or(temp0==$4))and(temp1>$2)
      poke ($FF833C+$A0) $04
    endif
    if (temp0==$9)and(temp1<=$2)
      poke ($FF833C+$80) $04
    endif
    if (temp0==$9)and(temp1>$2)
      lpoke ($FF833C+$98) $02080004
    endif
    if temp0==$C
      poke ($FF833C+$92) $04
    endif
    if temp0==$D
      poke ($FF833C+$8D) $04
    endif
    if temp0==$E
      poke ($FF833C+$94) $04
    endif
    if (temp0==$7)and(temp1<=$2)and((dpeek(FF833C+$314)&$2)>$0)
      dpoke ($FF833C+$88) $0608
      poke ($FF833C+$8D) $05
    endif
    if (temp0==$7)and(temp1<=$2)and((dpeek(FF833C+$314)&$1)>$0)
      dpoke ($FF833C+$88) $0608
      poke ($FF833C+$8D) $06
    endif
    if (temp0==$7)and(temp1==$8)and((dpeek(FF833C+$314)&$2)>$0)
      dpoke ($FF833C+$C8) $0608
      poke ($FF833C+$D3) $05
    endif
    if (temp0==$7)and(temp1==$8)and((dpeek(FF833C+$314)&$1)>$0)
      dpoke ($FF833C+$C8) $0608
      poke ($FF833C+$D3) $06
    endif
    if (temp0==$10)and((dpeek(FF833C+$314)&$2)>$0)
      dpoke ($FF833C+$9E) $0608
      poke ($FF833C+$A5) $05
    endif
    if (temp0==$10)and((dpeek(FF833C+$314)&$1)>$0)
      dpoke ($FF833C+$9E) $0608
      poke ($FF833C+$A5) $06
    endif
script "P1 Easy 360 + half-circle moves"  
run:
    temp0=peek($FF833C+$32B)
    temp1=peek($FF833C+$32A)
    if peek($FF833C)==$0
      temp0=$FF
    endif
    if ((temp0==$0)or(temp0==$10))and(temp1<=$2)
      poke ($FF833C+$E0) $08
    endif
    if (temp0==$1)and(temp1==$0)
      poke ($FF833C+$96) $06
    endif
    if (temp0==$4)and(temp1==$0)
      poke ($FF833C+$EA) $08
    endif
    if (temp0==$5)and(temp1==$8)
      poke ($FF833C+$B0) $08
    endif
    if (temp0==$7)and(temp1<=$2)
      poke ($FF833C+$84) $08
      poke ($FF833C+$9A) $08
    endif
    if (temp0==$7)and(temp1>$2)
      lpoke ($FF833C+$98) $02080008
    endif
    if temp0==$C
      poke ($FF833C+$A2) $04
    endif
    if (temp0==$6)and(peek(FF833C+$12)!=$0)
      lpoke ($FF833C+$80) $06060800
      lpoke ($FF833C+$9B) $06040800
    endif
    if (temp0==$6)and(peek(FF833C+$12)==$0)
      lpoke ($FF833C+$80) $06070800
      lpoke ($FF833C+$9B) $06050800
    endif
    if (temp0==$D)and(peek(FF833C+$12)!=$0)
      lpoke ($FF833C+$91) $04060800
    endif
    if (temp0==$D)and(peek(FF833C+$12)==$0)
      lpoke ($FF833C+$91) $05060800
    endif
script "P1 Easy F,DF,D + tiger-knee moves"  
run:
    temp0=peek($FF833C+$32B)
    temp1=peek($FF833C+$32A)
    if peek($FF833C)==$0
      temp0=$FF
    endif
    if (temp0==$4)and(temp1==$0)
      poke ($FF833C+$E8) $04
    endif
    if (temp0==$6)and(temp1==$0)
      poke ($FF833C+$B3) $04
    endif
    if (temp0==$9)and(temp1<=$2)
      poke ($FF833C+$84) $04
    endif
    if (temp0==$9)and(temp1>$2)
      lpoke ($FF833C+$A8) $02080004
    endif
    if temp0==$C
      poke ($FF833C+$A9) $06
    endif
    if temp0==$E
      poke ($FF833C+$B4) $06
    endif
script "P1 Easy super moves"  
run:
    temp0=dpeek($FF833C+$32A)
    if peek($FF833C)==$0
      temp0=$FF
    endif
    if temp0==$0
      poke ($FF833C+$A0) $0A
    endif
    if temp0==$1
      poke ($FF833C+$94) $0A
    endif
    if temp0==$2
      poke ($FF833C+$C1) $0A
    endif
    if temp0==$3
      poke ($FF833C+$94) $0A
    endif
    if temp0==$4
      poke ($FF833C+$A0) $08
    endif
    if temp0==$5
      poke ($FF833C+$BF) $0A
    endif
    if (temp0==$6)and(peek(FF833C+$12)!=$0)
      dpoke ($FF833C+$AC) $0E06
    endif
    if (temp0==$6)and(peek(FF833C+$12)==$0)
      dpoke ($FF833C+$AC) $0E07
    endif
    if temp0==$7
      poke ($FF833C+$96) $10
    endif
    if temp0==$8
      poke ($FF833C+$C5) $0A
    endif
    if temp0==$9
      poke ($FF833C+$9E) $08
    endif
    if temp0==$A
      poke ($FF833C+$D4) $0A
    endif
    if temp0==$B
      poke ($FF833C+$99) $0A
    endif
    if temp0==$C
      poke ($FF833C+$A6) $08
    endif
    if (temp0==$D)and(peek(FF833C+$12)!=$0)
      dpoke ($FF833C+$9E) $0E06
    endif
    if (temp0==$D)and(peek(FF833C+$12)==$0)
      dpoke ($FF833C+$9E) $0E07
    endif
    if temp0==$E
      poke ($FF833C+$B0) $0A
    endif
    if temp0==$F
      poke ($FF833C+$AF) $0A
    endif
script "P1 Easy button tap moves"  
run:
    temp0=peek($FF833C+$32B)
    temp1=peek($FF833C+$32A)
    if peek($FF833C)==$0
      temp0=$FF
    endif
    if (temp0==$1)and(temp1==$4)and(peek(FF833C+$9A)<$2)
      poke ($FF833C+$9A) $6
    endif
    if (temp0==$1)and(temp1==$4)and(peek(FF833C+$9C)<$2)
      poke ($FF833C+$9C) $6
    endif
    if (temp0==$1)and(temp1==$4)and(peek(FF833C+$9E)<$2)
      poke ($FF833C+$9E) $6
    endif
    if (temp0==$1)and((temp1==$2)or(temp1==$6)or(temp1==$8))and(peek(FF833C+$9A)<$2)
      poke ($FF833C+$9A) $2
    endif
    if (temp0==$1)and((temp1==$2)or(temp1==$6)or(temp1==$8))and(peek(FF833C+$9C)<$2)
      poke ($FF833C+$9C) $2
    endif
    if (temp0==$1)and((temp1==$2)or(temp1==$6)or(temp1==$8))and(peek(FF833C+$9E)<$2)
      poke ($FF833C+$9E) $2
    endif
    if (temp0==$1)and(temp1==$0)and(peek(FF833C+$C6)<$2)
      poke ($FF833C+$C6) $2
    endif
    if (temp0==$1)and(temp1==$0)and(peek(FF833C+$C8)<$2)
      poke ($FF833C+$C8) $2
    endif
    if (temp0==$1)and(temp1==$0)and(peek(FF833C+$CA)<$2)
      poke ($FF833C+$CA) $2
    endif
    if ((temp0==$2)or(temp0==$5))and(temp1==$4)and(peek(FF833C+$9A)<$3)
      poke ($FF833C+$9A) $8
    endif
    if ((temp0==$2)or(temp0==$5))and(temp1==$4)and(peek(FF833C+$9C)<$3)
      poke ($FF833C+$9C) $8
    endif
    if ((temp0==$2)or(temp0==$5))and(temp1==$4)and(peek(FF833C+$9E)<$3)
      poke ($FF833C+$9E) $8
    endif
    if ((temp0==$2)or(temp0==$5))and(temp1!=$4)and(peek(FF833C+$9A)<$3)
      poke ($FF833C+$9A) $3
    endif
    if ((temp0==$2)or(temp0==$5))and(temp1!=$4)and(peek(FF833C+$9C)<$3)
      poke ($FF833C+$9C) $3
    endif
    if ((temp0==$2)or(temp0==$5))and(temp1!=$4)and(peek(FF833C+$9E)<$3)
      poke ($FF833C+$9E) $3
    endif
script "P1 Set Boxer Turnpunch level" \
 "0001/One"\
 "0121/Two"\
 "0241/Three"\
 "0481/Four"\
 "0961/Five"\
 "1441/Six"\
 "1921/Seven"\
 "2401/Final" 
run:
    if peek($FF833C+$32B)==$0A
      dpoke ($FF833C+$B6) param
      dpoke ($FF833C+$B8) param
    endif
script " "  
script "P2 Infinite Energy"  
run:
    if (dpeek($FF8766)<$60)and((peek($FF873F)&$10)==$00)
      dpoke $FF8766 $90
      dpoke $FF88F8 $90
    endif
script "P2 Dizzy Status" \
 "0x00/Never get dizzied"\
 "0x40/Always get dizzied" 
run:
    dpoke $FF8798 param
    dpoke $FF879A param
script "P2 Drain All Energy Now!"  
on:
    poke $FF8767 $00
    poke $FF88F9 $00
script "P2 Infinite Power"  
run:
    if dpeek($FF8008)==$2
      poke $FF89F0 $30
    endif
script "P2 Always have No Power"  
run:
    poke $FF89F0 $00
script "P2 Drain All Power Now!"  
on:
    poke $FF89F0 $00
script "P2 Allow special moves during jump"  
run:
    poke $FF88BD $00
script "P2 Select Character" \
 "comm:If you enable during a round the graphics will not be correct. Best used on the character select screen." \
 "0x00/Ryu"\
 "0x01/E. Honda"\
 "0x02/Blanka"\
 "0x03/Guile"\
 "0x04/Ken"\
 "0x05/Chun-Li"\
 "0x06/Zangief"\
 "0x07/Dhalsim"\
 "0x08/M. Bison (Dictator)"\
 "0x09/Sagat"\
 "0x0A/Balrog (Boxer)"\
 "0x0B/Vega (Claw)"\
 "0x0C/Cammy"\
 "0x0D/T. Hawk"\
 "0x0E/Fei Long"\
 "0x0F/Dee Jay"\
 "0x10/#Akuma/Gouki" 
run:
    poke $FF8A67 param
    if (param>=$08)and(peek($FF8A66)==$04)
      poke $FF8A66 $06
    endif
    if (param>=$0C)and(peek($FF8A66)>=$04)
      poke $FF8A66 $02
    endif
    if (param>=$10)and(peek($FF8A66)!=$00)
      poke $FF8A66 $00
    endif
script "P2 Select SuperT Colour" \
 "0x00/LP button"\
 "0x01/MP button"\
 "0x02/HP button"\
 "0x03/LK button"\
 "0x04/MK button"\
 "0x05/HK button"\
 "0x06/Start button"\
 "0x07/Hold any P/K button" 
run:
    poke $FF8A68 param
    if (peek($FF8A66)!=$0)or(peek($FF8A67)==$10)
      poke $FF8A68 (param&$01)
    endif
script "P2 Easy charge moves"  
run:
    temp0=peek($FF873C+$32B)
    temp1=peek($FF873C+$32A)
    if peek($FF873C)==$0
      temp0=$FF
    endif
    if (temp0==$1)and(temp1!=$0)
      poke ($FF873C+$81) $01
    endif
    if (temp0==$1)and(temp1!=$0)and(peek(FF873C+$AA)<=$02)
      poke ($FF873C+$AB) $01
    endif
    if (temp0==$1)and(temp1==$0)and(peek(FF873C+$88)<=$02)
      poke ($FF873C+$89) $01
    endif
    if (temp0==$1)and(temp1==$0)and(peek(FF873C+$90)<=$02)
      poke ($FF873C+$91) $01
    endif
    if (temp0==$1)and(temp1==$0)and(peek(FF873C+$94)<=$02)
      poke ($FF873C+$95) $01
    endif
    if temp0==$2
      poke ($FF873C+$81) $01
      poke ($FF873C+$B4) $01
      poke ($FF873C+$BA) $01
      poke ($FF873C+$C2) $01
    endif
    if temp0==$3
      poke ($FF873C+$81) $01
      poke ($FF873C+$87) $01
      poke ($FF873C+$95) $01
    endif
    if temp0==$5
      poke ($FF873C+$81) $01
    endif
    if (temp0==$5)and(temp1==$0)and(peek(FF873C+$B0)<=$02)
      poke ($FF873C+$B1) $01
    endif
    if (temp0==$5)and(peek(FF873C+$BA)<=$02)
      poke ($FF873C+$BB) $01
    endif
    if (temp0==$5)and(peek(FF873C+$BF)<=$02)
      poke ($FF873C+$C0) $01
    endif
    if temp0==$8
      poke ($FF873C+$81) $01
      poke ($FF873C+$89) $01
      poke ($FF873C+$92) $01
      poke ($FF873C+$C6) $01
    endif
    if (temp0==$8)and(peek(FF873C+$AC)<=$02)
      poke ($FF873C+$AD) $01
    endif
    if temp0==$A
      poke ($FF873C+$81) $01
      poke ($FF873C+$89) $01
      poke ($FF873C+$C1) $01
      poke ($FF873C+$D7) $01
      poke ($FF873C+$DE) $01
      dpoke ($FF873C+$B2) $0101
    endif
    if (temp0==$A)and(temp1==$0)and(peek(FF873C+$D4)<=$02)
      poke ($FF873C+$D5) $01
    endif
    if temp0==$B
      poke ($FF873C+$81) $01
    endif
    if (temp0==$B)and(peek(FF873C+$88)<=$02)
      poke ($FF873C+$89) $01
    endif
    if (temp0==$B)and(peek(FF873C+$8C)<=$02)
      poke ($FF873C+$8D) $01
    endif
    if (temp0==$B)and(peek(FF873C+$90)<=$02)
      poke ($FF873C+$91) $01
    endif
    if (temp0==$B)and(temp1==$0)and(peek(FF873C+$99)<=$02)
      poke ($FF873C+$9A) $01
    endif
    if (temp0==$B)and(temp1==$0)and(peek(FF873C+$9D)<=$02)
      poke ($FF873C+$9E) $01
    endif
    if (temp0==$F)and(peek(FF873C+$92)<=$02)
      poke ($FF873C+$93) $01
    endif
    if (temp0==$F)and(peek(FF873C+$96)<=$02)
      poke ($FF873C+$97) $01
    endif
    if (temp0==$F)and(peek(FF873C+$A6)<=$02)
      poke ($FF873C+$A7) $01
    endif
    if (temp0==$F)and(temp1==$0)and(peek(FF873C+$AB)<=$02)
      poke ($FF873C+$AC) $01
    endif
    if (temp0==$F)and(temp1==$0)and(peek(FF873C+$AF)<=$02)
      poke ($FF873C+$B0) $01
    endif
script "P2 Easy QCF + QCB moves"  
run:
    temp0=peek($FF873C+$32B)
    temp1=peek($FF873C+$32A)
    if peek($FF873C)==$0
      temp0=$FF
    endif
    if ((temp0==$0)or(temp0==$4)or(temp0==$10))and(temp1<=$2)
      poke ($FF873C+$90) $04
      poke ($FF873C+$94) $04
    endif
    if ((temp0==$0)or(temp0==$4))and(temp1>$2)
      poke ($FF873C+$90) $04
      poke ($FF873C+$98) $04
    endif
    if (temp0==$4)and(temp1==$0)
      poke ($FF873C+$E6) $04
    endif
    if (temp0==$7)and(temp1<=$2)
      poke ($FF873C+$80) $04
    endif
    if (temp0==$7)and(temp1>$2)
      lpoke ($FF873C+$90) $02080004
    endif
    if (temp0==$9)and(temp1<=$2)
      poke ($FF873C+$88) $04
      poke ($FF873C+$8C) $04
    endif
    if (temp0==$9)and(temp1>$2)
      lpoke ($FF873C+$90) $02080004
      lpoke ($FF873C+$A0) $02080004
    endif
    if temp0==$C
      poke ($FF873C+$96) $04
    endif
    if temp0==$E
      poke ($FF873C+$90) $04
      poke ($FF873C+$A0) $04
    endif
script "P2 Easy F,D,DF + B,D,DB moves"  
run:
    temp0=peek($FF873C+$32B)
    temp1=peek($FF873C+$32A)
    if peek($FF873C)==$0
      temp0=$FF
    endif
    if ((temp0==$0)or(temp0==$4)or(temp0==$10))and(temp1<=$2)
      poke ($FF873C+$98) $04
    endif
    if ((temp0==$0)or(temp0==$4))and(temp1>$2)
      poke ($FF873C+$A0) $04
    endif
    if (temp0==$9)and(temp1<=$2)
      poke ($FF873C+$80) $04
    endif
    if (temp0==$9)and(temp1>$2)
      lpoke ($FF873C+$98) $02080004
    endif
    if temp0==$C
      poke ($FF873C+$92) $04
    endif
    if temp0==$D
      poke ($FF873C+$8D) $04
    endif
    if temp0==$E
      poke ($FF873C+$94) $04
    endif
    if (temp0==$7)and(temp1<=$2)and((dpeek(FF873C+$314)&$2)>$0)
      dpoke ($FF873C+$88) $0608
      poke ($FF873C+$8D) $05
    endif
    if (temp0==$7)and(temp1<=$2)and((dpeek(FF873C+$314)&$1)>$0)
      dpoke ($FF873C+$88) $0608
      poke ($FF873C+$8D) $06
    endif
    if (temp0==$7)and(temp1==$8)and((dpeek(FF873C+$314)&$2)>$0)
      dpoke ($FF873C+$C8) $0608
      poke ($FF873C+$D3) $05
    endif
    if (temp0==$7)and(temp1==$8)and((dpeek(FF873C+$314)&$1)>$0)
      dpoke ($FF873C+$C8) $0608
      poke ($FF873C+$D3) $06
    endif
    if (temp0==$10)and((dpeek(FF873C+$314)&$2)>$0)
      dpoke ($FF873C+$9E) $0608
      poke ($FF873C+$A5) $05
    endif
    if (temp0==$10)and((dpeek(FF873C+$314)&$1)>$0)
      dpoke ($FF873C+$9E) $0608
      poke ($FF873C+$A5) $06
    endif
script "P2 Easy 360 + half-circle moves"  
run:
    temp0=peek($FF873C+$32B)
    temp1=peek($FF873C+$32A)
    if peek($FF873C)==$0
      temp0=$FF
    endif
    if ((temp0==$0)or(temp0==$10))and(temp1<=$2)
      poke ($FF873C+$E0) $08
    endif
    if (temp0==$1)and(temp1==$0)
      poke ($FF873C+$96) $06
    endif
    if (temp0==$4)and(temp1==$0)
      poke ($FF873C+$EA) $08
    endif
    if (temp0==$5)and(temp1==$8)
      poke ($FF873C+$B0) $08
    endif
    if (temp0==$7)and(temp1<=$2)
      poke ($FF873C+$84) $08
      poke ($FF873C+$9A) $08
    endif
    if (temp0==$7)and(temp1>$2)
      lpoke ($FF873C+$98) $02080008
    endif
    if temp0==$C
      poke ($FF873C+$A2) $04
    endif
    if (temp0==$6)and(peek(FF873C+$12)!=$0)
      lpoke ($FF873C+$80) $06060800
      lpoke ($FF873C+$9B) $06040800
    endif
    if (temp0==$6)and(peek(FF873C+$12)==$0)
      lpoke ($FF873C+$80) $06070800
      lpoke ($FF873C+$9B) $06050800
    endif
    if (temp0==$D)and(peek(FF873C+$12)!=$0)
      lpoke ($FF873C+$91) $04060800
    endif
    if (temp0==$D)and(peek(FF873C+$12)==$0)
      lpoke ($FF873C+$91) $05060800
    endif
script "P2 Easy F,DF,D + tiger-knee moves"  
run:
    temp0=peek($FF873C+$32B)
    temp1=peek($FF873C+$32A)
    if peek($FF873C)==$0
      temp0=$FF
    endif
    if (temp0==$4)and(temp1==$0)
      poke ($FF873C+$E8) $04
    endif
    if (temp0==$6)and(temp1==$0)
      poke ($FF873C+$B3) $04
    endif
    if (temp0==$9)and(temp1<=$2)
      poke ($FF873C+$84) $04
    endif
    if (temp0==$9)and(temp1>$2)
      lpoke ($FF873C+$A8) $02080004
    endif
    if temp0==$C
      poke ($FF873C+$A9) $06
    endif
    if temp0==$E
      poke ($FF873C+$B4) $06
    endif
script "P2 Easy super moves"  
run:
    temp0=dpeek($FF873C+$32A)
    if peek($FF873C)==$0
      temp0=$FF
    endif
    if temp0==$0
      poke ($FF873C+$A0) $0A
    endif
    if temp0==$1
      poke ($FF873C+$94) $0A
    endif
    if temp0==$2
      poke ($FF873C+$C1) $0A
    endif
    if temp0==$3
      poke ($FF873C+$94) $0A
    endif
    if temp0==$4
      poke ($FF873C+$A0) $08
    endif
    if temp0==$5
      poke ($FF873C+$BF) $0A
    endif
    if (temp0==$6)and(peek(FF873C+$12)!=$0)
      dpoke ($FF873C+$AC) $0E06
    endif
    if (temp0==$6)and(peek(FF873C+$12)==$0)
      dpoke ($FF873C+$AC) $0E07
    endif
    if temp0==$7
      poke ($FF873C+$96) $10
    endif
    if temp0==$8
      poke ($FF873C+$C5) $0A
    endif
    if temp0==$9
      poke ($FF873C+$9E) $08
    endif
    if temp0==$A
      poke ($FF873C+$D4) $0A
    endif
    if temp0==$B
      poke ($FF873C+$99) $0A
    endif
    if temp0==$C
      poke ($FF873C+$A6) $08
    endif
    if (temp0==$D)and(peek(FF873C+$12)!=$0)
      dpoke ($FF873C+$9E) $0E06
    endif
    if (temp0==$D)and(peek(FF873C+$12)==$0)
      dpoke ($FF873C+$9E) $0E07
    endif
    if temp0==$E
      poke ($FF873C+$B0) $0A
    endif
    if temp0==$F
      poke ($FF873C+$AF) $0A
    endif
script "P2 Easy button tap moves"  
run:
    temp0=peek($FF873C+$32B)
    temp1=peek($FF873C+$32A)
    if peek($FF873C)==$0
      temp0=$FF
    endif
    if (temp0==$1)and(temp1==$4)and(peek(FF873C+$9A)<$2)
      poke ($FF873C+$9A) $6
    endif
    if (temp0==$1)and(temp1==$4)and(peek(FF873C+$9C)<$2)
      poke ($FF873C+$9C) $6
    endif
    if (temp0==$1)and(temp1==$4)and(peek(FF873C+$9E)<$2)
      poke ($FF873C+$9E) $6
    endif
    if (temp0==$1)and((temp1==$2)or(temp1==$6)or(temp1==$8))and(peek(FF873C+$9A)<$2)
      poke ($FF873C+$9A) $2
    endif
    if (temp0==$1)and((temp1==$2)or(temp1==$6)or(temp1==$8))and(peek(FF873C+$9C)<$2)
      poke ($FF873C+$9C) $2
    endif
    if (temp0==$1)and((temp1==$2)or(temp1==$6)or(temp1==$8))and(peek(FF873C+$9E)<$2)
      poke ($FF873C+$9E) $2
    endif
    if (temp0==$1)and(temp1==$0)and(peek(FF873C+$C6)<$2)
      poke ($FF873C+$C6) $2
    endif
    if (temp0==$1)and(temp1==$0)and(peek(FF873C+$C8)<$2)
      poke ($FF873C+$C8) $2
    endif
    if (temp0==$1)and(temp1==$0)and(peek(FF873C+$CA)<$2)
      poke ($FF873C+$CA) $2
    endif
    if ((temp0==$2)or(temp0==$5))and(temp1==$4)and(peek(FF873C+$9A)<$3)
      poke ($FF873C+$9A) $8
    endif
    if ((temp0==$2)or(temp0==$5))and(temp1==$4)and(peek(FF873C+$9C)<$3)
      poke ($FF873C+$9C) $8
    endif
    if ((temp0==$2)or(temp0==$5))and(temp1==$4)and(peek(FF873C+$9E)<$3)
      poke ($FF873C+$9E) $8
    endif
    if ((temp0==$2)or(temp0==$5))and(temp1!=$4)and(peek(FF873C+$9A)<$3)
      poke ($FF873C+$9A) $3
    endif
    if ((temp0==$2)or(temp0==$5))and(temp1!=$4)and(peek(FF873C+$9C)<$3)
      poke ($FF873C+$9C) $3
    endif
    if ((temp0==$2)or(temp0==$5))and(temp1!=$4)and(peek(FF873C+$9E)<$3)
      poke ($FF873C+$9E) $3
    endif
script "P2 Set Boxer Turnpunch level" \
 "0001/One"\
 "0121/Two"\
 "0241/Three"\
 "0481/Four"\
 "0961/Five"\
 "1441/Six"\
 "1921/Seven"\
 "2401/Final" 
run:
    if peek($FF873C+$32B)==$0A
      dpoke ($FF873C+$B6) param
      dpoke ($FF873C+$B8) param
    endif
script " "  
script "No Background Music"  
run:
    cpu audio
    dpoke $F018 $0000
    cpu main
script "Hide Background" \
 "comm:Activate before match start; set to Claw or Dictator stage for no BG sprites"  
on:
    temp0=peek($FF8041)&0F
    temp1=peek($FF8047)&0F
    temp2=dpeek($00B2A8)
    temp3=lpeek($00B2AA)
    temp4=dpeek($00B2AE)
    temp5=lpeek($00B2B0)
    temp6=dpeek($00CE04)
    temp7=lpeek($00CE06)
    temp8=dpeek($00B31E)
    temp9=lpeek($01283C)
    temp10=lpeek($00864C)
    temp11=dpeek($008840)
run:
    poke $FF8041 peek($FF8041)|temp0
    poke $FF8047 peek($FF8047)|temp1
    dpoke $00B31E temp8
    lpoke $01283C temp9
    temp10=lpeek($00864C)
    temp11=dpeek($008840)
    dpoke $00B2A8 $4E71
    lpoke $00B2AA $4E714E71
    dpoke $00B2AE $4E71
    lpoke $00B2B0 $4E714E71
    dpoke $00CE04 $4E71
    lpoke $00CE06 $4E714E71
    if ((dpeek($FF8004)==$0008)and(peek($FF8366)==$0)and(peek($FF8766)==$0))
      dpoke $00B31E $601A
      lpoke $01283C $4E754E71
    endif
    if (((lpeek($FF8004)==$00080000&&lpeek($ff8008)==$00020000))and(peek($FF8366)==$0)and(peek($FF8766)==$0))
      poke $FF8041 peek($FF8041)&F0
      poke $FF8047 peek($FF8047)&F0
      lpoke $00864C $4E714E71
      dpoke $008840 $4E71
    endif
off:
    poke $FF8041 peek($FF8041)|temp0
    poke $FF8047 peek($FF8047)|temp1
    dpoke $00B2A8 temp2
    lpoke $00B2AA temp3
    dpoke $00B2AE temp4
    lpoke $00B2B0 temp5
    dpoke $00CE04 temp6
    lpoke $00CE06 temp7
    dpoke $00B31E temp8
    lpoke $01283C temp9
    lpoke $00864C temp10
    dpoke $008840 temp11
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/Euro"\
 "0x06/Hispanic"\
 "0x08/Asia" 
run:
    poke $FF82FB param
