linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Translating nasm boot strap to as
@ 2011-03-19 14:48 Daniel Hilst Selli
  2011-03-19 23:31 ` Brian Raiter
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Daniel Hilst Selli @ 2011-03-19 14:48 UTC (permalink / raw)
  To: linux-assembly

I got some little code in intel syntax(nasm) and want to translate it to 
AT&T syntax to assembly it with as.

The code is a bootstrap and can be found here: http://ideone.com/Qldvx


I got problem to translate 2 things ..
this:

jmp 07C0h:start


I try this

jmp 0x7C0, start

but got "Too memory operands error"
I also try all order combinations plus $ prefix combinations

and to fill the file:

times510-($-$$)  db  0

I didn't find any $$ translation in as


-- 
"Do or do not... there is no try" Yoda Master

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

* Re: Translating nasm boot strap to as
  2011-03-19 14:48 Translating nasm boot strap to as Daniel Hilst Selli
@ 2011-03-19 23:31 ` Brian Raiter
  2011-03-19 23:43 ` Brian Raiter
  2011-03-20  0:42 ` Frank Kotler
  2 siblings, 0 replies; 6+ messages in thread
From: Brian Raiter @ 2011-03-19 23:31 UTC (permalink / raw)
  To: Daniel Hilst Selli; +Cc: linux-assembly

> this:
> 
> jmp 07C0h:start
> 
> I try this
> 
> jmp 0x7C0, start

I think what you need is:

    jmp     $0x07C0, $start

Assuming that 0x07C0 is the segment and start is the offset.

If that doesn't work, you may need to use ljmp instead of jmp (it's
been a long time since I've thought about 16-bit assembly.)

> and to fill the file:
> 
> times 510-($-$$)  db  0
> 
> I didn't find any $$ translation in as

$$ just refers to the start of the current section, so I think the
solution there is just to declare your own symbol at the top of the
section, and use that in place of $$.

b

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

* Re: Translating nasm boot strap to as
  2011-03-19 14:48 Translating nasm boot strap to as Daniel Hilst Selli
  2011-03-19 23:31 ` Brian Raiter
@ 2011-03-19 23:43 ` Brian Raiter
  2011-03-20  0:42 ` Frank Kotler
  2 siblings, 0 replies; 6+ messages in thread
From: Brian Raiter @ 2011-03-19 23:43 UTC (permalink / raw)
  To: Daniel Hilst Selli; +Cc: linux-assembly

> and to fill the file:
> 
> times510-($-$$)  db  0
> 
> I didn't find any $$ translation in as

Actually, in this particular case, a more straightforward solution is
to just assign . a new value, like this:

. = .data + 510

(assuming that this appears in your .data section)

b

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

* Re: Translating nasm boot strap to as
  2011-03-19 14:48 Translating nasm boot strap to as Daniel Hilst Selli
  2011-03-19 23:31 ` Brian Raiter
  2011-03-19 23:43 ` Brian Raiter
@ 2011-03-20  0:42 ` Frank Kotler
  2011-03-20  1:08   ` Brian Raiter
  2 siblings, 1 reply; 6+ messages in thread
From: Frank Kotler @ 2011-03-20  0:42 UTC (permalink / raw)
  To: Daniel Hilst Selli; +Cc: linux-assembly

Daniel Hilst Selli wrote:

> times510-($-$$)  db  0

.org 510

Seems to do the trick?

Best,
Frank



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

* Re: Translating nasm boot strap to as
  2011-03-20  0:42 ` Frank Kotler
@ 2011-03-20  1:08   ` Brian Raiter
  2011-03-21  2:28     ` Daniel Hilst Selli
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Raiter @ 2011-03-20  1:08 UTC (permalink / raw)
  To: Frank Kotler; +Cc: Daniel Hilst Selli, linux-assembly

>> times510-($-$$)  db  0
> 
> .org 510

Even better!

b

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

* Re: Translating nasm boot strap to as
  2011-03-20  1:08   ` Brian Raiter
@ 2011-03-21  2:28     ` Daniel Hilst Selli
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Hilst Selli @ 2011-03-21  2:28 UTC (permalink / raw)
  To: Brian Raiter; +Cc: Frank Kotler, linux-assembly

Thanks for all, now it works!

On 03/19/11 22:08, Brian Raiter wrote:
>>> times510-($-$$)  db  0
>> .org 510
> Even better!
>
> b


-- 
"Do or do not... there is no try" Yoda Master

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

end of thread, other threads:[~2011-03-21  2:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-19 14:48 Translating nasm boot strap to as Daniel Hilst Selli
2011-03-19 23:31 ` Brian Raiter
2011-03-19 23:43 ` Brian Raiter
2011-03-20  0:42 ` Frank Kotler
2011-03-20  1:08   ` Brian Raiter
2011-03-21  2:28     ` Daniel Hilst Selli

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 NNTP newsgroup(s).