assume cs:code,ds:code 
Author Message
 assume cs:code,ds:code

I just came across this line a a code file.
assume cs:code,ds:code

what is this purpose of code. which is the pseucode of assemble it
belong. Since I only use Masm at this time. Is it belong to tasm or a86

regards
yccheok

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Sun, 16 Feb 2003 12:03:31 GMT  
 assume cs:code,ds:code

Quote:

> I just came across this line a a code file.
> assume cs:code,ds:code

> what is this purpose of code. which is the pseucode of assemble it
> belong. Since I only use Masm at this time. Is it belong to tasm or a86

It's pretty mush what it says, it tells the assembler that it can assume
that cs & ds vill point to a something named 'code' (most likely a
segment). I.e. the directive 'assume' itself doesn't generate any code.

The assembler must know this whenever you refer to a label, it's the
only way the assembler can know that a label is relative to (it doesn't
necessarily have to be the segment it's defined in).

It's used by at least tasm & masm, i don't know if a86 uses it.

--
Leif

 Love, Peace, Understanding
            And
    Freedom To Every One



Sun, 16 Feb 2003 03:00:00 GMT  
 assume cs:code,ds:code

Quote:

> I just came across this line a a code file.
> assume cs:code,ds:code

> what is this purpose of code. which is the pseucode of assemble it
> belong. Since I only use Masm at this time. Is it belong to tasm or a86

Assume doesn't correspond to a mnemonic, with this pseudocode, when Tasm finds a
mov ax,[224h] it assume that this instruction will be: mov ax,cs:[224h] or mov
ax,ds:[224h].


Sun, 16 Feb 2003 03:00:00 GMT  
 assume cs:code,ds:code



Quote:
> I just came across this line a a code file.
> assume cs:code,ds:code

> what is this purpose of code. which is the pseucode of assemble it
> belong. Since I only use Masm at this time. Is it belong to tasm or
a86

> regards
> yccheok

> Sent via Deja.com http://www.deja.com/
> Before you buy.

In MASM help there is the documentation about assune directive

Sent via Deja.com http://www.deja.com/
Before you buy.



Sun, 16 Feb 2003 03:00:00 GMT  
 assume cs:code,ds:code


)I just came across this line a a code file.
)assume cs:code,ds:code
)
)what is this purpose of code. which is the pseucode of assemble it
)belong. Since I only use Masm at this time. Is it belong to tasm or a86

It does not correspond to any object code. It is like ORG. It tells the
assembler to do something.

In this case, it tells the assembler to assume that the CS and DS
segment registers point to the segment named CODE.

If you write

code    segment...

fred    dw      0

        mov     ax,[fred]

...

The assembler will complain that you don't have addressibility. If you
add

code    segment ..

fred    dw      0

        mov     ax,code
        mov     cs,ax
        assume  cs:code

        ...

        mov     ax,[fred]

then the assembler can automatically add a segment override, and
assemble it as though you wrote

        mov     ax,cs:[fred]

If you put

code    segment ..

fred    dw      0

        mov     ax,code
        mov     cs,ax
        mov     ds,ax
        assume  cs:code,ds:code
        ...

        mov     ax,[fred]

then the assembler can emit the standard code, because it can use DS,
which it will when it can.

Mike
--
char *p="char *p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
I can explain it for you, but I can't understand it for you.
I don't speak for Alcatel      <- They make me say that.



Sun, 16 Feb 2003 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Loading code segments into DS

2. Loading code segments into DS

3. Bin code for mov al,byte ptr[ds:edx]...32-bit addr/real mode

4. Finding assumed static variables in Fortran code

5. DS, CS, ES ,SS

6. Creating Selector (CS / DS) in WinXP

7. P-code, T-code, and Uni-Code Intermediate Languages

8. P-code, T-code and Uni-Code Intermediate Languages

9. Initializing DX to Code Segment(CS) Memory Address...?!?

10. Initializing DX to Code Segment(CS) Memory Address…?!?

11. Example of Python code (C code to Python code)

12. ds ds

 

 
Powered by phpBB® Forum Software