MASM/Bitwise not
Jump to navigation
Jump to search
globals.masm
nine ptr-size arg ret old-ipt
not.masm
tmp lab not cmt ret = nand(arg, arg) = not(arg) alc one get arg nnd vpt set ret cmt set ipt to old-ipt + 9 to skip function call alc nine set tmp adr old-ipt get nine drf vpt fre tmp set ipt
main.masm
not loop tmp two new-out lab loop cmt call loop alc ptr-size set tmp adr loop drf vpt fre tmp set ipt lab main cmt init nine/ptr-size alc one get one rot one rot one rot one rot one rot one nnd vpt set tmp alc one get one nnd vpt nnd tmp fre tmp set nine cmt copies 0th byte of in to arg alc one get in set arg cmt set old-ipt alc ptr-size set tmp adr ipt drf vpt fre tmp set old-ipt cmt call not alc ptr-size set tmp adr not drf vpt fre tmp set ipt cmt init two alc one get one rot one rot one rot one rot one rot one rot one rot one set two cmt alloc new-out and sets 0th byte to ret from not alc two get ret set new-out cmt null terminates new-out alc ptr-size set tmp adr new-out get one drf vpt fre tmp cmt abusing the fact that out is currently 0 get out cmt out = new-out alc ptr-size set tmp adr new-out drf vpt fre tmp set out cmt clean-up (in case we want to add more code) fre arg fre ret fre two cmt call loop alc ptr-size set tmp adr loop drf vpt fre tmp set ipt