Machine code: Difference between revisions

m
→‎{{header|Tcl}}: A neater way of working
(→‎Tcl: Added implementation)
m (→‎{{header|Tcl}}: A neater way of working)
Line 101:
 
# But now we have our thunk, we can execute arbitrary binary blobs
set code [binary format c* {0x8B 0x44 0x24 0x4 0x3 0x44 0x24 0x8 0xC3}]
puts [runMachineCode [binary format c* $code] 7 12]</lang>
Note that it would be more common to put that thunk in its own package (e.g., <code>machineCodeThunk</code>) and then just do something like this:
<lang tcl>package require machineCodeThunk 1.0
 
set code [binary format c* {0x8B 0x44 0x24 0x4 0x3 0x44 0x24 0x8 0xC3}]
puts [runMachineCode $code 7 12]</lang>
Anonymous user