Create an object at a given address: Difference between revisions

m
moved an OMIT, added a ;Task: header, split the long paragraph for the "For example".
(Added Nim example)
m (moved an OMIT, added a ;Task: header, split the long paragraph for the "For example".)
Line 1:
{{task|Basic Data Operations}}
{{basic data operation}}
{{omit from|Modula-2}}
 
In systems programing it is sometimes required to place language objects at specific memory locations, like I/O registers, hardware interrupt vectors etc.
 
'''Task'''
 
;Task:
Show how language objects can be allocated at a specific machine addresses.
 
Since most [[OS]]es prohibit access to the physical memory if it is not mapped by the application, as an example, rather than a physical address, take the address of some existing object (using suitable [[Address Operations|address operations]] if necessary). For example, create an integer object. Print the machine address of the object. Take the address of the object and create another integer object at this address. Print the value of this object to verify that it is same as one of the origin. Change the value of the origin and verify it again.
 
 
For example:
{{omit from|Modula-2}}
::*   create an integer object
::*   print the machine address of the object
::*   take the address of the object and create another integer object at this address
::*   print the value of this object to verify that it is same as one of the origin
::*   change the value of the origin and verify it again
<br><br>
 
=={{Header|6502 Assembly}}==