Machine code: Difference between revisions
Task description: Already there are some examples that do not strictly follow the x86 32-bit rule of this task. Relaxed requirements... Hopefully this encourages more contributions for other systems. Also cleaned up some formatting.
(→{{header|Lua}}: added Lua non-solution) |
(Task description: Already there are some examples that do not strictly follow the x86 32-bit rule of this task. Relaxed requirements... Hopefully this encourages more contributions for other systems. Also cleaned up some formatting.) |
||
Line 1:
{{task}}
The task requires poking machine code directly into memory and executing it. The machine code is the architecture-specific opcodes which has the simple task of adding two unsigned bytes together and making the result available to the high-level language.
<lang asm>mov EAX, [ESP+4]
Line 10 ⟶ 8:
ret</lang>
Or in hexadecimal:
<lang>8B 44 24 04 03 44 24 08 C3</lang>
;Task:
If different than 32-bit x86, specify the target architecture of the machine code for your example. It may be helpful to also include an assembly version of the machine code for others to reference and understand what is being executed. Then, implement the following in your favorite programming language:
* Provide a means to pass two values to the machine code.
* Perform any clean up actions that are appropriate for your chosen language (free the pointer or memory allocations, etc.)
=={{header|AutoHotkey}}==
|