Header Banner
wonderhowto.mark.png
Gadget Hacks Next Reality Food Hacks Null Byte The Secret Yumiverse Invisiverse Macgyverisms Mind Hacks Mad Science Lock Picking Driverless

Notch's Hello World Example (including DAT usage)

Apr 5, 2012 06:02 AM

; Assembler test for DCPU

; by Markus Persson

             set a, 0xbeef                        ; Assign 0xbeef to register a

             set [0x1000], a                      ; Assign memory at 0x1000 to value of register a

             ifn a, [0x1000]                      ; Compare value of register a to memory at 0x1000 ..  

                           set PC, end                      ; .. and jump to end if they don't match

             set i, 0                             ; Init loop counter, for clarity

:nextchar    ife [data+i], 0                      ; If the character is 0 ..

                 set PC, end                      ; .. jump to the end

             set [0x8000+i], [data+i]             ; Video ram starts at 0x8000, copy char there

             add i, 1                             ; Increase loop counter

             set PC, nextchar                     ; Loop  

:data        dat "Hello world!", 0                ; Zero terminated string

:end         sub PC, 1                            ; Freeze the CPU forever

You already know how to use your phone. With Gadget Hacks' newsletter, we'll show you how to master it. Each week, we explore features, hidden tools, and advanced settings that give you more control over iOS and Android than most users even know exists.

Sign up for Gadget Hacks Weekly and start unlocking your phone's full potential.

Related Articles

Comments

No Comments Exist

Be the first, drop a comment!