Machine code: Difference between revisions
Content added Content deleted
(→Tcl: Added implementation) |
m (→{{header|Tcl}}: A neater way of working) |
||
Line 101: | Line 101: | ||
# But now we have our thunk, we can execute arbitrary binary blobs |
# But now we have our thunk, we can execute arbitrary binary blobs |
||
set code {0x8B 0x44 0x24 0x4 |
set code [binary format c* {0x8B 0x44 0x24 0x4 0x3 0x44 0x24 0x8 0xC3}] |
||
puts [runMachineCode |
puts [runMachineCode $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> |