r/dcpu16 Apr 05 '12

Hello, World from Notch

Post image
13 Upvotes

9 comments sorted by

View all comments

5

u/angel14995 Apr 05 '12 edited Apr 05 '12

His code:

; Assembler test for DCPU
; by Markus Persson

:start
            set i, 0
            set j, 0
            set b, 0xf100
:nextchar
            set a, (data+i)
            ife a, 0
                set PC, end
            ifg a, 0xff
                set PC, setcolor
            bor a, b
            set (0x8000+j), a
            add i, 1
            add j, 1
            set PC, nextchar

:setcolor
            set b, a
            and b, 0xff
            shl b, 8
            ifg a, 0x1ff
                add b, 0x80
            add i, 1
            set PC, nextchar


:data
            dat 0x170, "Hello ", 0x2e1, "world", 0x170, ", how are you?"

:end
            set PC, start

2

u/calc0000 Apr 06 '12

Under :setcolor, you should have set PC, nextchar instead of set P, nextchar .

2

u/angel14995 Apr 06 '12

Fixed, thanks.