Anonymous user
Create an object at a given address: Difference between revisions
Create an object at a given address (view source)
Revision as of 17:58, 20 November 2021
, 2 years agoAdded solution for Action!
Puppydrum64 (talk | contribs) m (→{{header|Z80 Assembly}}: formatting of code blocks) |
(Added solution for Action!) |
||
Line 96:
;get the address of a variable
mov ax, tempLong_LoWord ;without "word ptr" and brackets, the assembler interprets a label as a constant.</lang>
=={{header|Action!}}==
<lang Action!>DEFINE FIRST="12345"
DEFINE SECOND="54321"
PROC Main()
CARD base,copy=base
PrintF("Address of base variable: %H%E",@base)
PrintF("Address of copy variable: %H%E",@copy)
PutE()
PrintF("Assign %U value to base variable%E",FIRST)
base=FIRST
PrintF("Value of base variable: %U%E",base)
PrintF("Value of copy variable: %U%E",copy)
PutE()
PrintF("Assign %U value to base variable%E",SECOND)
base=SECOND
PrintF("Value of base variable: %U%E",base)
PrintF("Value of copy variable: %U%E",copy)
RETURN</lang>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Create_an_object_at_a_given_address.png Screenshot from Atari 8-bit computer]
<pre>
Address of base variable: $268C
Address of copy variable: $268C
Assign 12345 value to base variable
Value of base variable: 12345
Value of copy variable: 12345
Assign 54321 value to base variable
Value of base variable: 54321
Value of copy variable: 54321
</pre>
=={{header|Ada}}==
|