MASM/Bitwise nor
Jump to navigation
Jump to search
globals.masm
nine ptr-size arg arg1 ret old-ipt
nor.masm
tmp lab nor cmt tmp = not(arg) alc one get arg nnd vpt set tmp cmt ret = not(nand(not(arg1), tmp)) = not(or(arg1, arg)) = nor(arg, arg1) alc one get arg1 nnd vpt nnd tmp fre tmp 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
nor 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 copies 1st byte of in to arg1 alc ptr-size set tmp adr in get one drf vpt fre tmp set tmp alc one get tmp set arg1 cmt set old-ipt alc ptr-size set tmp adr ipt drf vpt fre tmp set old-ipt cmt call nor alc ptr-size set tmp adr nor 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 nor 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 arg1 fre ret fre two cmt call loop alc ptr-size set tmp adr loop drf vpt fre tmp set ipt