Create an object at a given address: Difference between revisions

m
→‎{{header|8086 Assembly}}: Clarification, formatting, and better examples.
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
<lang asm>.model small ;specify memory model to use
.stack 1024
.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 word ptr [ds:tempWordtempLong_LoWord],ax ;store 0x1000 into tempWord</lang>tempLong_LoWord
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}}==
1,489

edits