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

Reading Keyboard Input in 0x10c's DCPU-16 Assembly

Apr 5, 2012 05:41 AM

The as of yet undocumented DAT op code can also be used to read keyboard input by simply referencing dat 0. Here's the code from Notch's pastebin:

; Reading characters from the keyboard

; by Markus Persson

#macro nextkey(target) {

 push(i)

 set i,[keypointer]

 add i,0x9000

 set target,[i]

 ife target,0

jmp end

 set [i],0

 add [keypointer], 1

 and [keypointer], 0xf

:end

 pop(i)

}

:keypointer

dat 0

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!