lua function to calculate checksum from MemoryBlock()
function checkSumMb(m) -- Roland Checksum from MemoryBlock
local sum=0
local result=0
for i=0,m:getSize()-1 do
sum=sum+m:getByte(i)
end
local result=bit.band(sum,0x7f)
if result * 1 ~=0 then
result= 0x80-result
end
return result
end --function

lua function to calculate checksum from MemoryBlock()

function checkSumMb(m) -- Roland Checksum from MemoryBlock

local sum=0

local result=0

for i=0,m:getSize()-1 do

sum=sum+m:getByte(i)

end

local result=bit.band(sum,0x7f)

if result * 1 ~=0 then

result= 0x80-result

end

return result

end --function