Create an object at a given address: Difference between revisions
Create an object at a given address (view source)
Revision as of 10:49, 12 September 2021
, 2 years ago→{{header|8086 Assembly}}: Clarification, formatting, and better examples.
Puppydrum64 (talk | contribs) |
Puppydrum64 (talk | contribs) m (→{{header|8086 Assembly}}: Clarification, formatting, and better examples.) |
||
Line 63:
=={{header|8086 Assembly}}==
This example uses UASM to assemble MS-DOS compatible code.
<lang asm>.model small ;specify memory model to use
.stack 1024 ;set up stack
.data ;data segment
Line 84 ⟶ 85:
; now there is no need to use "mov ax, seg UserRam" since we've already loaded the data segment into DS
mov ax, 1000h ;load the value 0x1000 into AX▼
;store an integer value into memory
mov word ptr [ds:tempWord],ax ;store 0x1000 into tempWord</lang>▼
▲mov ax, 1000h ;load the value 0x1000 into AX
mov ax, 0040h ;the 8086 is 16-bit so we have to load the pieces separately.
mov word ptr [ds:tempLong_HiWord],ax ;store 0x0040 into tempLong_HiWord
;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|Ada}}==
|