binaryDigit
08-30-2001, 12:39 AM
i have a book on assembly. unfortunately it focuses on 16bit programming. so i've been looking around at linuxassembly.org and nasm's site. but i'm having a really hard time figuring things out.
consider the following book example
var_i dw 0
var_k dw 0
mov var_i, 10
mov var_k, 13
mov ax, var_i
add var_k, ax
pretty simple. but reading nasm's site content tells me that unless i'm using brackets around my variables that i'm accessing a memory location. and that i have to specify a length.
so this is the code that i actually got to assemble
section .text
global _start
int_i dd 0
int_k dd 0
_start:
mov dword [var_i], 10
mov eax, [var_i]
mov dword [var_k], 13
add dword [var_k], eax
now it assmebles but i get a seg fault.
any help.
consider the following book example
var_i dw 0
var_k dw 0
mov var_i, 10
mov var_k, 13
mov ax, var_i
add var_k, ax
pretty simple. but reading nasm's site content tells me that unless i'm using brackets around my variables that i'm accessing a memory location. and that i have to specify a length.
so this is the code that i actually got to assemble
section .text
global _start
int_i dd 0
int_k dd 0
_start:
mov dword [var_i], 10
mov eax, [var_i]
mov dword [var_k], 13
add dword [var_k], eax
now it assmebles but i get a seg fault.
any help.