initial re-write into a proper asm coremod

* this commit is both unfinished and doesn't work in an obfuscated
* environment