Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.msdos.programmer > #4042
| From | Mateusz Viste <mateusz@xyz.invalid> |
|---|---|
| Newsgroups | comp.os.msdos.programmer |
| Subject | assembly: mov a memory word into register |
| Date | 2021-11-12 14:35 +0100 |
| Organization | . . . |
| Message-ID | <20211112143535.05889a42@mateusz.lan> (permalink) |
I somehow got stuck on a simple quest: copying a word from memory into a
register. Here's what I do:
void myfunc(char *buff) {
_asm {
mov ax, [buff]
}
}
This is inline assembly within OpenWatcom. My understanding so far was
that:
mov ax, buff ; copies buff (pointer) into AX
mov ax, [buff] ; copies *buff (first word at memory location) into AX
But that's not what happens now.
Whether I use "mov ax, buff" or "mov ax, [buff]", the result is the
same: AX gets the address of buff and never the value under it.
What am I missing?
I must add that it works when I do this:
void myfunc(char *buff) {
_asm {
mov bx, buff
mov ax, [bx]
}
}
I'd like to understand why my first version isn't producing what I
expect, though... Any ideas?
Mateusz
Back to comp.os.msdos.programmer | Previous | Next — Next in thread | Find similar | Unroll thread
assembly: mov a memory word into register Mateusz Viste <mateusz@xyz.invalid> - 2021-11-12 14:35 +0100
Re: assembly: mov a memory word into register "Kerr-Mudd, John" <admin@127.0.0.1> - 2021-11-12 16:52 +0000
Re: assembly: mov a memory word into register Herbert Kleebauer <klee@unibwm.de> - 2021-11-12 17:53 +0100
Re: assembly: mov a memory word into register Mateusz Viste <mateusz@xyz.invalid> - 2021-11-12 18:40 +0100
Re: assembly: mov a memory word into register Herbert Kleebauer <klee@unibwm.de> - 2021-11-12 19:19 +0100
Re: assembly: mov a memory word into register Mateusz Viste <mateusz@xyz.invalid> - 2021-11-12 20:07 +0100
Re: assembly: mov a memory word into register Herbert Kleebauer <klee@unibwm.de> - 2021-11-12 22:18 +0100
Re: assembly: mov a memory word into register rridge@csclub.uwaterloo.ca (Ross Ridge) - 2021-11-15 16:53 +0000
Re: assembly: mov a memory word into register Rod Pemberton <noemail@basdxcqvbe.com> - 2021-11-14 20:53 -0500
Re: assembly: mov a memory word into register Mateusz Viste <mateusz@xyz.invalid> - 2021-11-15 09:31 +0100
Re: assembly: mov a memory word into register Herbert Kleebauer <klee@unibwm.de> - 2021-11-15 12:10 +0100
Re: assembly: mov a memory word into register Mateusz Viste <mateusz@xyz.invalid> - 2021-11-15 13:02 +0100
csiph-web