; 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
Want to master Microsoft Excel and take your work-from-home job prospects to the next level? Jump-start your career with our Premium A-to-Z Microsoft Excel Training Bundle from the new Gadget Hacks Shop and get lifetime access to more than 40 hours of Basic to Advanced instruction on functions, formula, tools, and more.
Other worthwhile deals to check out:
- 97% off The Ultimate 2021 White Hat Hacker Certification Bundle
- 98% off The 2021 Accounting Mastery Bootcamp Bundle
- 99% off The 2021 All-in-One Data Scientist Mega Bundle
- 59% off XSplit VCam: Lifetime Subscription (Windows)
- 98% off The 2021 Premium Learn To Code Certification Bundle
- 62% off MindMaster Mind Mapping Software: Perpetual License
- 41% off NetSpot Home Wi-Fi Analyzer: Lifetime Upgrades
Be the First to Comment
Share Your Thoughts