Problem with assembly

Programming, for all ages and all languages.
Post Reply
Pes88
Posts: 11
Joined: Sun Nov 21, 2010 11:49 am

Problem with assembly

Post 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....
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Problem with assembly

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Pes88
Posts: 11
Joined: Sun Nov 21, 2010 11:49 am

Re: Problem with assembly

Post 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??
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Problem with assembly

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
DavidCooper
Member
Member
Posts: 1150
Joined: Wed Oct 27, 2010 4:53 pm
Location: Scotland

Re: Problem with assembly

Post 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.
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming
Pes88
Posts: 11
Joined: Sun Nov 21, 2010 11:49 am

Re: Problem with assembly

Post 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
Pes88
Posts: 11
Joined: Sun Nov 21, 2010 11:49 am

Re: Problem with assembly

Post 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.
Post Reply