luascript "Console Mode [lua]" \
 "comm:Coin button is used for pause. In training mode, pause the game and then press start to select character."
run:
   -- Start-up --
   if (peek(0xFF830A)==0x00) then
      poke(0xFF82C4,0x00) -- 1 coin 1 credit --
      poke(0x14849,"           ")
      poke(0x30F4,0x06) -- Restore initial value --
      poke(0x30FA,0x0A)
      poke(0xBE89,0x89)
      lpoke(0x3F9A,0x3B410B64)
      lpoke(0x1E6A,0x2B40006E)
      lpoke(0x1EA4,0x1B42006E)
      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
         poke(0xFF8BFD,0x28) -- infinite time --
         if (dpeek(0xFF8366)<0x60) and ((peek(0xFF833F)&0x10)==0x00) then -- P1 infinite energy --
            dpoke(0xFF8366,0x90)
            dpoke(0xFF84F8,0x90)
         end
         if (dpeek(0xFF8766)<0x60) and ((peek(0xFF873F)&0x10)==0x00) then -- P2 infinite energy --
            dpoke(0xFF8766,0x90)
            dpoke(0xFF88F8,0x90)
         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)
         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(0x14849,"INSERT COIN")
   poke(0x30F4,0x06)
   poke(0x30FA,0x0A)
   poke(0xBE89,0x89)
   lpoke(0x3F9A,0x3B410B64)
   lpoke(0x1E6A,0x2B40006E)
   lpoke(0x1EA4,0x1B42006E)

script "Console Mode" \
 "comm:Coin button is used for pause. In training mode, pause the game and then press start to select character."
run:
#Start-up#
if (peek($FF830A)==$00)
    poke $FF82C4 $00 #1 coin 1 credit#
    poke $14849 "           "
    poke $30F4 $06 #Restore initial value#
    poke $30FA $0A
    poke $BE89 $89
    lpoke $3F9A $3B410B64
    lpoke $1E6A $2B40006E
    lpoke $1EA4 $1B42006E
    p1char=$0000
    p2char=$0004
    p1mode=$00
    p2mode=$00
    if (peek($FF8005)>$00)and(peek($FF806E)>=$10)and(peek($FF2000)!=$03) #Start button start#
      poke $FF830A $09 #Max credit#
      poke $618001 $00 #Sound effect#
      poke $618003 $40
      poke $61801F $00
    endif
endif
#Title Screen#
if (dpeek($FFD3B0)==$0B58)and(peek($FF830A)>$00)and(peek($910000)!=$E0)
    if (peek($FF2030)==$00)and(peek($804020)==$FF)
       lpoke $1E6A $00000000 #Disable original start button#
       lpoke $1EA4 $00000000
       dpoke $FF806E $0000
    endif
    if (peek($1E6A)==$00)and((peek($804020)==$FE)or(peek($804020)==$FD))and(peek($FF806E)==$00) #Leaving title screen#
       poke $FF2030 $01
     endif
endif
#Menu in the Title screen#
if (dpeek($FFD3B0)==$0B58)and(peek($FF2030)==$01)
    if ((peek($FF8077)==$00)and(peek($FF807B)==$00))and(peek($FF2001)==$FF)
      poke $FF2001 $00
      poke $910007 $6C #Restore arrow#
      poke $91000F $0C
      poke $FF2020 $00 #Act as music 'stopper'#
    endif
    if (peek($FF8077)==$04)or(peek($FF807B)==$04)
       poke $91000F $88 #Hide arrow 2#
       if peek($FF2020)==$00 #Sound effect#
         poke $618001 $00
         poke $618003 $42
         poke $61801F $00
         poke $FF2020 $FF
       endif
       if (dpeek($FF2000)==$0000)
         dpoke $FF2000 $01FF
       elsif (dpeek($FF2000)==$0100)
         dpoke $FF2000 $02FF
       elsif (dpeek($FF2000)==$0200)
         dpoke $FF2000 $03FF
       elsif (dpeek($FF2000)==$0300)
         dpoke $FF2000 $00FF
       endif
    endif
    if (peek($FF8077)==$08)or(peek($FF807B)==$08)
       poke $910007 $88 #Hide arrow 1#
       if peek($FF2020)==$00 #Sound effect#
         poke $618001 $00
         poke $618003 $42
         poke $61801F $00
         poke $FF2020 $FF
       endif
       if (dpeek($FF2000)==$0000)
         dpoke $FF2000 $03FF
       elsif (dpeek($FF2000)==$0300)
         dpoke $FF2000 $02FF
       elsif (dpeek($FF2000)==$0200)
         dpoke $FF2000 $01FF
       elsif (dpeek($FF2000)==$0100)
         dpoke $FF2000 $00FF
       endif
    endif
    if (peek($910000)!=$E0) #Menu text setting#
        poke $FF8035 $20 #Shift original text#
        poke $910000 $E0 #Arrow 1#
        poke $910001 $F3
        poke $910003 $BF
        poke $910004 $80
        poke $910005 $A7
        poke $910007 $6C
        poke $910008 $E0 #Arrow 2#
        poke $910009 $F8
        poke $91000B $E5
        poke $91000C $80
        poke $91000D $A7
        poke $91000F $0C
        for i=0 i<=$60 i=i+$8 poke $910017+i $1A #Text color#
        for i=0 i<=$60 i=i+$8 poke $910013+i $D5 #Text y-location#
        for i=0 i<=$30 i=i+$8 poke $910010+i $E0 #Text x-location#
        for i=0 i<=$28 i=i+$8 poke $910048+i $E1
        for i=0 i<=$60 i=i+$8 poke $910011+i $B0+i/8*$C
        for i=0 i<=$60 i=i+$8 poke $910014+i $80 #Text 1st byte#
    endif
    #Menu Text#
      if (peek($FF2000)==$00) #Arcade Mode#
        poke $910015 $A0
        poke $91001D $C1
        poke $910025 $D2
        poke $91002D $C3
        poke $910035 $C1
        poke $91003D $C4
        poke $910045 $C5
        poke $91004D $A0
        poke $910055 $CD
        poke $91005D $CF
        poke $910065 $C4
        poke $91006D $C5
        poke $910075 $A0
      elsif (peek($FF2000)==$01) #Versus Mode#
        poke $910015 $A0
        poke $91001D $D6
        poke $910025 $C5
        poke $91002D $D2
        poke $910035 $D3
        poke $91003D $D5
        poke $910045 $D3
        poke $91004D $A0
        poke $910055 $CD
        poke $91005D $CF
        poke $910065 $C4
        poke $91006D $C5
        poke $910075 $A0
      elsif (peek($FF2000)==$02) #Training Mode#
        poke $910015 $D4
        poke $91001D $D2
        poke $910025 $C1
        poke $91002D $C9
        poke $910035 $CE
        poke $91003D $C9
        poke $910045 $CE
        poke $91004D $C7
        poke $910055 $A0
        poke $91005D $CD
        poke $910065 $CF
        poke $91006D $C4
        poke $910075 $C5
      elsif (peek($FF2000)==$03) #Option Mode#
        poke $910015 $A0
        poke $91001D $CF
        poke $910025 $D0
        poke $91002D $D4
        poke $910035 $C9
        poke $91003D $CF
        poke $910045 $CE
        poke $91004D $A0
        poke $910055 $CD
        poke $91005D $CF
        poke $910065 $C4
        poke $91006D $C5
        poke $910075 $A0
      endif
    #Press button#
    if (peek($FF8076)>$00)or(peek($FF8077)>=$10) #P1 press button#
       poke $FF801C $00 #Setup timer#
       poke $618001 $00 #Soud effect#
       poke $618003 $43
       poke $61801F $00
       poke $FF2030 $02
    endif
    if (peek($FF807A)>$00)or(peek($FF807B)>=$10) #P2 press button#
       poke $FF801C $00 #Setup timer#
       poke $618001 $00 #Soud effect#
       poke $618003 $43
       poke $61801F $00
       poke $FF2030 $03
    endif
endif
#Start game#
if ((peek($FF2030)==$02)or(peek($FF2030)==$03))and(peek($FF801C)>=$13)
    if (peek($FF2030)==$02)
       poke $FF806E $10 #P1 start#
    endif
    if (peek($FF2030)==$03)
       poke $FF806E $20 #P2 start#
    endif
    poke $FF2030 $04
endif
#Restore value#
if (peek($FF8001)==$02)and(peek($FF2030)==$04)
    lpoke $1E6A $2B40006E #Restore original start button#
    lpoke $1EA4 $1B42006E
    poke $FF2030 $00
endif
#Infinity Credits Script#
if (peek($FF830A)>$00)
    poke $FF830A $09
endif
#Versus Mode Script#
if (peek($FF2000)==$01)
    if (dpeek($FFD3B0)==$0B58)and(peek($FF8316)>$00)
       poke $FF8316 $03 #Auto activate P1 & P2#
       poke $BE89 $8A #Flight related#
       lpoke $3F9A $00000000 #Stage select related#
    endif
    if (peek($FF800D)==$08) #Memorize characters#
       p1char=dpeek($FF8666)
       p2char=dpeek($FF8A66)
    endif
    if (peek($FF8005)==$0E)
       poke $FF863C $FF #Prevent continue text#
       poke $FF8A3C $FF
       poke $FF8664 $01 #Remain active even lose#
       poke $FF8A64 $01
    endif
    if (peek($FF8005)==$0E)and(peek($FF800F)>=$01)and(peek($FF800F)<=$03)  #Return to char select#
       poke $FF8001 $08
       poke $FF2003 $01
    endif
    if (peek($FF8001)==$02)and(peek($FF8005)==$02)and(peek($FF2003)==$01) #Deselection#
       if (peek($FF82C2)==$04) #P1 select game speed#
         poke $FF83BC $00
       else
         poke $FF83BC $02
       endif
       poke $FF83C0 $00
       poke $FF87BC $02
       poke $FF87C0 $00
       dpoke $FF8666 p1char
       dpoke $FF8A66 p2char
       poke $FF2003 $00
    endif
    if (peek($FF8001)==$02)
       poke $FF8B8B $02 #Disable Challenger! text#
       if (peek($FF87BC)==$02)
          if rnd()<=127 #Randomize stage select - P1 or P2#
            poke $FF2004 $01
          else
            poke $FF2004 $02
          endif
       endif
       if (peek($FF2004)<=$01)and(peek($FF8005)==$02) #P2 character's stage#
         poke $FF8B65 peek($FF8A67)
         if ((peek($FF8667)==$00)and(peek($FF8A67)==$10))or((peek($FF8667)==$10)and(peek($FF8A67)==$00))
           poke $FF8B89 $01 #No flight when Ryu vs Akuma or vice versa#
         else
           poke $FF8B89 $00 #Flight from P1#
         endif
       endif
       if (peek($FF2004)==$02)and(peek($FF8005)==$02) #P1 character's stage#
         poke $FF8B65 peek($FF8667)
         if ((peek($FF8667)==$00)and(peek($FF8A67)==$10))or((peek($FF8667)==$10)and(peek($FF8A67)==$00))
           poke $FF8B89 $00 #No flight when Ryu vs Akuma or vice versa#
         else
           poke $FF8B89 $01 #Flight from P2#
         endif
       endif
       if (peek($FF8B65)==$10)and(peek($FF8009)==$04) #Ryu's stage for Akuma#
         poke $FF8B65 $00
       endif
    endif
endif
#Training Mode Script#
if (peek($FF2000)==$02)
    if (dpeek($FFD3B0)==$0B58)and(peek($FF8316)>$00)
       poke $FF8316 $03 #Auto activate P1 & P2#
       poke $BE89 $8A #Flight related#
       lpoke $3F9A $00000000 #Stage select related#
    endif
    if (peek($FF8001)==$02)
       poke $FF8B8B $02 #Disable Challenger! text#
       if ((peek($FF83BC)==$07)and(peek($FF87BC)<$07))and(dpeek($FF8076)==$0000) #P1 as main player#
         poke $30F4 $0A #Switch control#
         poke $30FA $06
         poke $FF8B89 $00 #Flight from P1#
         poke $FF2004 $01
       endif
       if ((peek($FF87BC)==$07)and(peek($FF83BC)<$07))and(dpeek($FF807A)==$0000) #P2 as main player#
         poke $30F4 $0A #Switch control#
         poke $30FA $06
         poke $FF8B89 $01 #Flight from P2#
         poke $FF2004 $02
       endif
       if ((peek($FF83BC)==$07)and(peek($FF87BC)==$07))or((peek($FF83BC)<=$02)and(peek($FF87BC)<=$02)) #Restore control#
         poke $30F4 $06
         poke $30FA $0A
       endif
    endif
    if (peek($FF8005)==$08)
       poke $FF8BFD $28 #infinite time#
       if (dpeek($FF8366)<$60)and((peek($FF833F)&$10)==$00) #P1 infinite energy#
         dpoke $FF8366 $90
         dpoke $FF84F8 $90
       endif
       if (dpeek($FF8766)<$60)and((peek($FF873F)&$10)==$00) #P2 infinite energy#
         dpoke $FF8766 $90
         dpoke $FF88F8 $90
       endif
       poke $FF85F0 $30 #P1 infinite power#
       poke $FF89F0 $30 #P2 infinite power#
       if (peek($FF8009)==$FF)and((peek($FF806E)==$10)or(peek($FF806E)==$20)) #Return to Character Screen Step 1#
         p1char=dpeek($FF8666) #Memorize characters#
         p2char=dpeek($FF8A66)
         poke $FF8005 $0E
         dpoke $FF800E $0001
         poke $FF2003 $01
       endif
       if (peek($FF2003)==$01) #Return to Character Screen Step 2#
         poke $FF8001 $08
         poke $FF2003 $02
       endif
    endif
       if (peek($FF8001)==$02)and(peek($FF8005)==$02)and(peek($FF2003)==$02) #Deselection#
          if (peek($FF82C2)==$04) #P1 select game speed#
            poke $FF83BC $00
          else
            poke $FF83BC $02
          endif
          poke $FF83C0 $00
          poke $FF87BC $02
          poke $FF87C0 $00
          dpoke $FF8666 p1char
          dpoke $FF8A66 p2char
          poke $FF2003 $00
       endif
       if (peek($FF2004)<=$01)and(peek($FF8005)==$02) #P2 character's stage#
         poke $FF8B65 peek($FF8A67)
         if ((peek($FF8667)==$00)and(peek($FF8A67)==$10))or((peek($FF8667)==$10)and(peek($FF8A67)==$00))
           poke $FF8B89 $01 #No flight when Ryu vs Akuma or vice versa#
         else
           poke $FF8B89 $00 #Flight from P1#
         endif
       endif
       if (peek($FF2004)==$02)and(peek($FF8005)==$02) #P1 character's stage#
         poke $FF8B65 peek($FF8667)
         if ((peek($FF8667)==$00)and(peek($FF8A67)==$10))or((peek($FF8667)==$10)and(peek($FF8A67)==$00))
           poke $FF8B89 $00 #No flight when Ryu vs Akuma or vice versa#
         else
           poke $FF8B89 $01 #Flight from P2#
         endif
       endif
       if (peek($FF8B65)==$10)and(peek($FF8009)==$04) #Ryu's stage for Akuma#
         poke $FF8B65 $00
       endif
    endif
endif
#Option Mode Script#
if (peek($FF2000)==$03)and((peek($FF806E)==$10)or(peek($FF806E)==$20))and(peek($FF8001)==$00) #Step 1#
    poke $FF806E $40
    poke $FF2005 $01
endif
if (peek($FF8005)==$0E)and(peek($FF2005)==$01) #step 2 - Restore value#
    lpoke $1E6A $00000000 #Re-disable original start button#
    lpoke $1EA4 $00000000
    poke $FF830A $09 #Infinity credit#
    poke $FF2030 $01
    poke $FF2005 $02
endif
if (peek($FF8005)==$00)and(peek($FF2005)==$02) #step 3 - Prevent press start text#
    poke $FF8035 $20
    if (dpeek($FFD3B0)==$0B58)
      poke $FF2005 $00
    endif
endif
#Pause Function Script#
    if (peek($FF8005)==$08)and(peek($FF800D)==$00)
       if (peek($FF806E)==$00)
       poke $FF2002 $00
       endif
       if (peek($FF8009)==$02)and((peek($FF806E)==$01)or(peek($FF806E)==$02))and(peek($FF2002)==$00)
       poke $FF8009 $FF
       poke $FF2002 $FF
       endif
       if (peek($FF8009)==$FF)and((peek($FF806E)==$01)or(peek($FF806E)==$02))and(peek($FF2002)==$00)
       poke $FF8009 $02
       poke $FF2002 $FF
       endif
    endif
off:
    poke $14849 "INSERT COIN"
    poke $30F4 $06
    poke $30FA $0A
    poke $BE89 $89
    lpoke $3F9A $3B410B64
    lpoke $1E6A $2B40006E
    lpoke $1EA4 $1B42006E

script "Enable Akuma/Gouki" \
 "comm:Press three punch buttons to select"
run:
if (peek($FF8001)==$02)
    if (dpeek($FF8666)==$0000)and(peek($FF864D)==$70) #P1#
      poke $FF8667 $10
      if (dpeek($FF8A67)==$1000)and(peek($FF87BC)==$07)
        poke $FF8668 $01
      else
        poke $FF8668 $00
      endif
    endif
    if (dpeek($FF8A66)==$0000)and(peek($FF8A4D)==$70) #P2#
      poke $FF8A67 $10
      if (dpeek($FF8667)==$1000)and(peek($FF83BC)==$07)
        poke $FF8A68 $01
      else
        poke $FF8A68 $00
      endif
    endif
endif
#Enable Akuma's music#
if (peek($FF8009)==$04)
    if (peek($FF2004)==$01)and(peek($FF8A67)==$10) #Set indicator when P1 as main player#
       poke $FF2010 $01
    endif
    if (peek($FF2004)==$02)and(peek($FF8667)==$10) #Set indicator when P2 as main player#
       poke $FF2010 $01
    endif
endif
#With Sound Association#
if (peek($FF2010)==$01)and(peek($FF8005)==$08)and(peek($618001)==$FF)and(peek($618003)==$00)
    if (peek($FF8009)==$00)and(peek($FF800D)==$02)and(peek($FF2011)==$00) #Normal tempo Akuma's music#
       poke $618001 $00
       poke $618003 $D5
       poke $61801F $00
       poke $FF2011 $01
    endif
    if ((peek($FF8367)<=$2F)or(peek($FF8767)<=$2F))and(peek($FF8009)!=$06)and(peek($FF2012)==$00)  #Fast tempo Akuma's music#
       poke $618001 $00
       poke $618003 $D6
       poke $61801F $00
       poke $FF2012 $01
    endif
endif
if (peek($FF8005)==$08)and(peek($FF8009)==$04) #Restore after each round#
    poke $FF2011 $00
    poke $FF2012 $00
endif
#Without Sound Association#
if (peek($FF2010)==$01)and(peek($618001)==$00)and(peek($618003)==$02) #Normal tempo Akuma's music#
    poke $618001 $00
    poke $618003 $D5
    poke $61801F $00
endif
if (peek($FF2010)==$01)and(peek($618001)==$00)and(peek($618003)==$12) #Fast tempo Akuma's music#
    poke $618001 $00
    poke $618003 $D6
    poke $61801F $00
endif
#Restore indicator after full battle#
if (peek($FF87BC)==$02)
    poke $FF2010 $00
    poke $FF2011 $00 #For practice mode#
endif

script "Select Same Character (for SF2 characters)" \
 "comm:Press coin button to select the character occupied or selected by the other side"
run:
if (peek($30F4)==$06)and(peek($FF8001)==$02) #For Normal Control#
    if (peek($FF8666)==$04)and(peek($FF8A66)==$04)
       if (peek($FF83BC)==$06)and(peek($FF806E)==$01)
         poke $FF8667 peek($FF8A67)
       endif
       if (peek($FF87BC)==$06)and(peek($FF806E)==$02)
         poke $FF8A67 peek($FF8667)
       endif
    endif
endif
if (peek($30F4)==$0A)and(peek($FF8001)==$02) #For Switched Control#
    if (peek($FF8666)==$04)and(peek($FF8A66)==$04)
       if (peek($FF87BC)==$06)and(peek($FF806E)==$01)
         poke $FF8A67 peek($FF8667)
       endif
       if (peek($FF83BC)==$06)and(peek($FF806E)==$02)
         poke $FF8667 peek($FF8A67)
       endif
    endif
endif

script "Alternative Character Select BGM"
run:
    if (dpeek($FF1E4C)==$5039)or(dpeek($FF1E4C)==$1639)
       poke $618001 $00
       poke $618003 $D3
       poke $61801F $00
    endif

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
