Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.msdos.programmer > #4047
| From | Mateusz Viste <mateusz@xyz.invalid> |
|---|---|
| Newsgroups | comp.os.msdos.programmer |
| Subject | Re: assembly: mov a memory word into register |
| Date | 2021-11-12 20:07 +0100 |
| Organization | . . . |
| Message-ID | <20211112200758.400e6110@mateusz.lan> (permalink) |
| References | <20211112143535.05889a42@mateusz.lan> <smm65c$2vd$1@gioia.aioe.org> <20211112184026.2113fa04@mateusz.lan> <smmb7i$o9e$1@gioia.aioe.org> |
2021-11-12 at 19:19 +0100, Herbert Kleebauer wrote: > > mov ah, 2 > > mov dl, [buff] > > This instruction doesn't exist, the compiler uses instead: > > mov dl, buff Well, no - in this specific example "mov dl, [buff]" does exist. It loads whatever is at the location pointed out by buff (here: the word 0x82). But note that my previous program was an actual assembly listing, not an assembly-inside-C abomination like in the first post. "mov dl, [buff]" is, in fact, the same instruction as in "mov dl, [0x82]", it is just that the assembler substitutes "buff" by its offset at compile time: 00000000 B402 mov ah,0x2 00000002 8A161501 mov dl,[0x115] 00000006 CD21 int 0x21 00000008 B402 mov ah,0x2 0000000A 8A168200 mov dl,[0x82] 0000000E CD21 int 0x21 00000010 B8004C mov ax,0x4c00 00000013 CD21 int 0x21 00000015 82 db 0x82 00000016 00 db 0x00 My foolish mistake was to expect a similar behavior within an inline assembly block when referencing a C pointer (which is different from an assembly offset and implies - as you correctly pointed out in your first reply - an extra layer of indirection). Mateusz
Back to comp.os.msdos.programmer | Previous | Next — Previous in thread | 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