assembler code doesn't work as expected, i can bet.
there is still something to be done, but dunno what atm.
i suppose there will be problem at the end of loop - it probably is infinity loop with 'jnz invert' line.
it should be different jump i think - not sure now.