MASM/Print A

From Esolang
Jump to navigation Jump to search
Back to Minimal assembly language

globals.masm

nine ptr-size

main.masm

loop
_64 _65
two
new-out
tmp

lab loop
        alc ptr-size
        set tmp
        adr loop
        drf vpt
        fre tmp
        set ipt


lab main
        cmt init nine
        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 init _65
        alc one
        get one
        rot one
        rot one
        nnd vpt
        set _64
        alc one
        get one
        nnd vpt
        nnd _64
        fre _64
        set _65

        cmt init two
        alc one
        get one
        rot one
        rot one
        rot one
        rot one
        rot one
        rot one
        rot one
        set two

        cmt set 0th value of new-out (to _65, aka 'A')
        alc two
        get _65
        set new-out

        cmt set 1st value of new-out (to 0, aka string termination)
        alc ptr-size
        set tmp
        adr new-out
        get one
        drf vpt
        cmt abusing the fact that out is currently 0
        get out
        fre tmp

        cmt set out to new-out
        alc ptr-size
        set tmp
        adr new-out
        drf vpt
        fre tmp
        set out

        cmt goto loop
        alc ptr-size
        set tmp
        adr loop
        drf vpt
        fre tmp
        set ipt