Page 1 of 1

Problem with assembly

Posted: Fri Dec 24, 2010 4:35 am
by Pes88
Hello all,
I don't understand this assembly instruction : :oops: :oops: :oops:

Code: Select all

mov	cx,#256
	sub	si,si
	sub	di,di
	rep
	movw   ; where are  they the operands ? 

Code: Select all

seg es   ???
I know the gas assembly, and this code isn't gas assembly!

I don't understand why the mov instruction is without operand e the seg instruction I don't understand that does and how translate it ....
I must translate this code on gas assembly!

thanks....

Re: Problem with assembly

Posted: Fri Dec 24, 2010 6:53 am
by Combuster
Have you never seen a "rep mov*"? If you really are familiar with assembly you should recognise it. (you'll find it in the Intel manuals as rep and movsw, rather than rep and movw)

That said, you shouldn't copy-paste code you don't understand, and especially this bit.

Re: Problem with assembly

Posted: Fri Dec 24, 2010 10:50 am
by Pes88
ok! But the instruction that I have writing isn't correct because if it is referred to instruction for the manipulation of the strings the "s" is missing on movw, or if it is the normal mov the operands are missing...

All right...

Therefore how can translate the seg instruction ( macro of the assembler ) in gas assembly, which doesn't have this instruction??

Re: Problem with assembly

Posted: Fri Dec 24, 2010 5:42 pm
by Combuster
You don't?

To be honest, I can't identify the assembler you're sourcing, I see two completely unrelated questions: one about you failing to recognising a memcpy, and one about you failing to look up a directive in the manual. Ask smart questions and realize this is a place for people capable of OS development, not novice (ASM) programmers.

In other words: you should read the forum rules, you probably guessed only one of them.

Re: Problem with assembly

Posted: Fri Dec 24, 2010 5:59 pm
by DavidCooper
You can't do anything useful with rep and a normal mov, so it should be obvious. You'll also need to have different contents in DS and ES if it's to do anything other than copy data straight back on itself (since SI and DI have been set to zero), so see if you can work out where the destination is and load ES accordingly. I don't know why you're trying to translate a defective program where you have to fill in the gaps, but good luck with it anyway.

Re: Problem with assembly

Posted: Sat Dec 25, 2010 4:04 am
by Pes88
I don't know why you're trying to translate a defective program where you have to fill in the gaps, but good luck with it anyway.
I am rewriting the bootsect.s of linux 0.12 for adapt it at my needs.

I have read the ASM manual , but the explanation of this is insufficient, because the manual explains how to use seg instruction with the symbol address and not with the registers segment.
The manual is this , chapter 3.6 SEG and WRT :
http://www.nasm.us/doc/nasmdoc3.html

Re: Problem with assembly

Posted: Sat Dec 25, 2010 5:37 am
by Pes88
Therefore how can translate the seg instruction ( macro of the assembler ) in gas assembly, which doesn't have this instruction??
i have find the solution :
seg means segment overriding

Code: Select all

seg fs
mov (bx),di
is same as mov fs:[bx] in Intel syntax or mov %fs:(%bx) in gas syntax.