public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* labels, and values for mov instructions is gas
@ 2007-11-09 16:25 Brian Beardall
  2007-11-09 16:40 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Beardall @ 2007-11-09 16:25 UTC (permalink / raw)
  To: binutils

.arch i8086
.code16

.text
foo:
  mov $exit,%ax
  mov $10,%cx
  loop foo
exit:
  int $0x80
dumb:
   .int 5,5,3,2,1,2,4,2,3,4,3,2,1,5
again:
  .word 1,2,3,4,5,6,7
.equ help, 5


With this code I need the address that is at the label exit moved into
the ax register. Right now all I get is 0x0000 moving into the ax
register. How might I go about getting the correct address into ax
without doing a as -a -o test.o test.asm , and looking at the symbol
table, and manually entering the value?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: labels, and values for mov instructions is gas
  2007-11-09 16:25 labels, and values for mov instructions is gas Brian Beardall
@ 2007-11-09 16:40 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2007-11-09 16:40 UTC (permalink / raw)
  To: Brian Beardall; +Cc: binutils

Brian Beardall <brian@rapsure.net> writes:

> .arch i8086
> .code16
> 
> .text
> foo:
>   mov $exit,%ax
>   mov $10,%cx
>   loop foo
> exit:
>   int $0x80
> dumb:
>    .int 5,5,3,2,1,2,4,2,3,4,3,2,1,5
> again:
>   .word 1,2,3,4,5,6,7
> .equ help, 5
> 
> 
> With this code I need the address that is at the label exit moved into
> the ax register. Right now all I get is 0x0000 moving into the ax
> register. How might I go about getting the correct address into ax
> without doing a as -a -o test.o test.asm , and looking at the symbol
> table, and manually entering the value?

You need to run the linker on the output of the assembler.

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-11-09 16:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-09 16:25 labels, and values for mov instructions is gas Brian Beardall
2007-11-09 16:40 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).