#Quickbms corrupter. set the settings below.

#starting address.
math STARTADR = 0x20

#set to 1 to autoend.
math AUTOEND = 1

#if autoend is 0, address to end at.
math ENDADR = 0x70

#amount of bytes before each corrupted byte.
math BETWEEN = 0x01

#start address increasing step length.
math STARTADRINC = 0x1

#startadress increases, this is the one you'll want to modify, start at 0.
math INCREASES = 0

#amoutn to add to bytes selected for corruption.
math ADDER = 0x3B

#don't chage anything below here.
get NAME filename
get SIZE asize

xmath STARTADR "STARTADR + (INCREASES * STARTADRINC)"

if STARTADR > SIZE
	print "Starting address is above filesize!"
	cleanexit
elif ENDADR > SIZE
	print "Ending address higher than filesize!"
	cleanexit
endif

putvarchr MEMORY_FILE size 0
log MEMORY_FILE 0 0

if AUTOEND = 1
	math ENDADR = SIZE
endif

xmath LOOPFOR "SIZE - (SIZE - ENDADR) - STARTADR"
xmath ENDINGLOOP "SIZE - ENDADR"

for I = 0 < STARTADR
	get BYTE byte
	put BYTE byte MEMORY_FILE
next I

for I = 0 < LOOPFOR
	get BYTE byte
	xmath CHECK "I % BETWEEN"
	if CHECK = 0
		math BYTE + ADDER
		put BYTE byte MEMORY_FILE
	else
		put BYTE byte MEMORY_FILE
	endif
next I

for I = 0 < ENDINGLOOP
	get BYTE byte
	put BYTE byte MEMORY_FILE
next I

get ESIZE asize MEMORY_FILE
log NAME 0 ESIZE MEMORY_FILE