Machine code: Difference between revisions

Content added Content deleted
m (rearranged omits in alphanumeric order... AGAIN (sorry I really need to not be so quick to click "Save Page"))
(Added solution for Action!)
Line 22: Line 22:
* Perform any clean up actions that are appropriate for your chosen language (free the pointer or memory allocations, etc.)
* Perform any clean up actions that are appropriate for your chosen language (free the pointer or memory allocations, etc.)



=={{header|Action!}}==
<lang Action!>DEFINE ADC="$6D"
DEFINE CLC="$18"
DEFINE JSR="$20"
DEFINE LDA="$AD"
DEFINE RTS="$60"
DEFINE STA="$8D"

PROC Main()
BYTE ARRAY buf(20)
BYTE a=[19],b=[37],s
CARD addr

addr=buf
Poke(addr,CLC) addr==+1
Poke(addr,LDA) addr==+1
PokeC(addr,@a) addr==+2
Poke(addr,ADC) addr==+1
PokeC(addr,@b) addr==+2
Poke(addr,STA) addr==+1
PokeC(addr,@s) addr==+2
Poke(addr,RTS) addr==+1

[JSR buf] ;run the machine code stored on buf

PrintF("%B+%B=%B%E",a,b,s)
RETURN</lang>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Machine_code.png Screenshot from Atari 8-bit computer]
<pre>
19+37=56
</pre>


=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==