field dw 1, 2, 3, 4, 5, 6, 7, 8, 9, 0
variable resw 1
...
I get stack. Do you know where is the problem??? I want to get biggest number from fiel and store it in variable
Name:
Anonymous2010-11-07 8:43
Too intel, didn't read.
Do you know where is the problem???
Use debugger. If you used normal OS, I'd recommend you gdb or OllyDbg. But if it's dos, then have fun with TD(aka Turbo Debugger).
I used it. The problem is when I call mov ax, [SI]. It should point to the number from filed - eg DS:[SI], but I get wrong number. How can I acces it then?!
Name:
Anonymous2010-11-07 8:52
Exaplainus yourselfus, please.
What do you mean, wrong number?
What does it get instead? CS:[SI]? SI? Or SI contains wrong address?
mov si, field
can mean two things
mov si, offset field mov si, [offset field]
Name:
Anonymous2010-11-07 8:56
I translate it with NASM. It should be address of field - so offset. Or am I wrong?
thanks for reply. So i would call add si, 2. But the problem is, that i cannot get value stored in data section by SI. When I run this program in debugger, i get segfault because ds:[si] doesnt point to field.
Name:
Anonymous2010-11-07 14:04
Noone geeky enought?
I run this simple program and I get bad values in al.
SECTION CODE:
..start:
mov si, field
mov cx, 2
cyc:
mov al, [si] ;HERE IS MY PROBLEM MAKER
inc si
loop cyc
>>9
Maybe you need to initialize ds? See the code in http://nasm.us/doc/nasmdoc7.html#section-7.4
Note that segmentation is a pain that you don't have to deal with if you write assembly for any modern system.
Name:
Anonymous2010-11-08 3:38
>Noone geeky enought?
>; Call DOS to exit
>DOS
here is your program. Do you know it's 21st century already?