Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

moving a string into es:bp

1,219 views
Skip to first unread message

SILPHERIS

unread,
Nov 4, 1996, 3:00:00 AM11/4/96
to

Ok. For function 13 interupt 10 i need to move a string into es:bp.
How exactly would be the best way of doing this using tasm v3.2? Don't
i have to move the segment into es, and then the offset into bp? like:
mov bp, OFFSET string
mov es, SEG string

But, obviously this doesn't work. So can anyone help me.

Please reply in normal mail / or both. Thanx

Nathan Palmer
silp...@juno.com
silp...@prodigy.net

SAMUEL IGWE

unread,
Nov 5, 1996, 3:00:00 AM11/5/96
to SILP...@prodigy.net

nathan:

you are not allowed to assign immediate values to a segment
register ( binary values,integers etc). the only way is to place a value
within another register and then mov that registers value into a segment
register. (using ax is the most common)


mov ax,SEGment string
mov es,ax


;;;or
push Segment string
pop es


then simply assign the offset to bp
mov bp,offset string
and you set


later
Samuel Igwe


Jerry L Oyler

unread,
Nov 5, 1996, 3:00:00 AM11/5/96
to

SILPHERIS wrote:
>
> Ok. For function 13 interupt 10 i need to move a string into es:bp.
> How exactly would be the best way of doing this using tasm v3.2? Don't
> i have to move the segment into es, and then the offset into bp? like:
> mov bp, OFFSET string
> mov es, SEG string
>
> But, obviously this doesn't work. So can anyone help me.
> The bp register by default uses the stack segment to calculate the offset
to the data. You could code:
les bp, offset string
this should assume the data segemnt, then all should work.
BTW you might also have to inform the assembler that you are trying to
retrieve data from the stack. i.e. assume es:eseg
when you are trying to access the data using es:bp you will have to use a
segment override to fetch it.
mov ax,ES:[bp] ; get string to ax

--
Jerry L. Oyler
oy...@n-jcenter.com


J.H.

unread,
Nov 5, 1996, 3:00:00 AM11/5/96
to

SILPHERIS <SILP...@prodigy.net> wrote:

>Ok. For function 13 interupt 10 i need to move a string into es:bp.
>How exactly would be the best way of doing this using tasm v3.2? Don't
>i have to move the segment into es, and then the offset into bp? like:
>mov bp, OFFSET string
> mov es, SEG string

> But, obviously this doesn't work. So can anyone help me.

>Please reply in normal mail / or both. Thanx

>Nathan Palmer
>silp...@juno.com
>silp...@prodigy.net

Try below:

mov bp, SEG string
mov es, bp
mov bp, OFFSET string

Hope this helps.
Good luck !

Tyler Barnes

unread,
Nov 6, 1996, 3:00:00 AM11/6/96
to

TB>SI>Ok. For function 13 interupt 10 i need to move a string into es:bp.
TB>SI>How exactly would be the best way of doing this using tasm v3.2? Don't
TB>SI>i have to move the segment into es, and then the offset into bp? like:
TB>SI>mov bp, OFFSET string
TB>SI> mov es, SEG string
TB>SI> But, obviously this doesn't work. So can anyone help me.

TB>Should work... make sure you have all the other registers set right too.
TB>AL = 0, BH = Page, BL = Attribute, CX = number of characters in the
TB>string, DH = Start Row, DL = Start Column.

TB>Make sure your attribute is not the same colour as the background. (Ie:
TB>if your background is black, you shouldn't have the attribute set at
TB>zero. Set it at 7 or something.)

Whoops, just noticed something obvious. You are trying to move the
segment of the string directly into the ES register. You can't move a
constant value into a segment register, but you CAN move a word register
into a segment register. So try:

MOV AX, SEG String
MOV ES,AX

(Note: If you're using A86 then this isn't the problem.. A86 allows you
to move directly into segment registers. It assembles MOV ES,10 for
example into:

push ax
MOV AX,10
MOV ES,AX
pop ax
)

Tyler Barnes

unread,
Nov 6, 1996, 3:00:00 AM11/6/96
to

SI>Ok. For function 13 interupt 10 i need to move a string into es:bp.

SI>How exactly would be the best way of doing this using tasm v3.2? Don't

SI>i have to move the segment into es, and then the offset into bp? like:

SI>mov bp, OFFSET string

SI> mov es, SEG string

SI> But, obviously this doesn't work. So can anyone help me.

Should work... make sure you have all the other registers set right too.


AL = 0, BH = Page, BL = Attribute, CX = number of characters in the

string, DH = Start Row, DL = Start Column.

Make sure your attribute is not the same colour as the background. (Ie:


if your background is black, you shouldn't have the attribute set at

Scott Nudds

unread,
Nov 10, 1996, 3:00:00 AM11/10/96
to

SAMUEL IGWE wrote:
: you are not allowed to assign immediate values to a segment

: register ( binary values,integers etc). the only way is to place a value
: within another register and then mov that registers value into a segment
: register. (using ax is the most common)

You can load a segment register from memory (variable).

mov es,foo
ret

foo dw wongo

--
<---->


Simon Tatham

unread,
Nov 11, 1996, 3:00:00 AM11/11/96
to

Scott Nudds <af...@james.freenet.hamilton.on.ca> wrote:
> You can load a segment register from memory (variable).
>
> mov es,foo
> ret
>
> foo dw wongo

As an assembler author, I'd be interested to know about this
instruction: it isn't listed in any of the opcode lists I've seen.
Can you tell me what code the `mov es,foo' instruction generates,
please?
--
<^ I /\/\ O /\/ Simon Tatham <sg...@cam.ac.uk>
_> ------------ Trinity College, Cambridge, CB2 1TQ, England

Jim Neil

unread,
Nov 13, 1996, 3:00:00 AM11/13/96
to


Simon-

Yes, you CAN do this as well as the converse (store a segment register
into memory). The opcodes are:

10001110 mod 0sr r/m Memory or Reg to Segment Register (Load).

10001100 mod 0sr r/m Segment Register to Memory or Reg (Store).

where:

mod has the "normal" meaning.
0sr is 000 => es, 001 => cs, 010 => ss, 011 => ds.
r/m has the "normal" meaning.

Note that this definition is from an 8088 book, and I believe the
case of loading INTO cs is illegal in the more modern processors.

I hope this helps...

Jim Neil ___ ___/ ____/ ___ / ____/ ____/
Creator of The / / / / / /
TERSE Programming Language / ___/ ___/ ____ / ___/
ISBN: 0-9652660-0-1 / / / \ / /
jim-...@digital.net __/ ______/ __/ __\ ______/ ______/ TM
http://www.terse.com

Simon Tatham

unread,
Nov 13, 1996, 3:00:00 AM11/13/96
to

Jim Neil <jim-...@digital.net> wrote:
> Yes, you CAN do this as well as the converse (store a segment
> register into memory). The opcodes are:

*whoops* That'll teach me to post without thinking. I read `mov
es,foo' as meaning `mov es,OFFSET foo', and failed to spot the
error. Sorry, people...

ccr...@pacific.net

unread,
Nov 14, 1996, 3:00:00 AM11/14/96
to

In <567oam$c...@lyra.csx.cam.ac.uk>, sg...@cam.ac.uk (Simon Tatham) writes:
>As an assembler author, I'd be interested to know about this
>instruction: it isn't listed in any of the opcode lists I've seen.
>Can you tell me what code the `mov es,foo' instruction generates,
>please?

The encoding for MOV segreg,mem/reg is 8E mod 0 reg r/m

where mod and r/m are used to specify the memory or register operand and
reg is two bits which specify the segment register.

Sorry, but in this case, Scott is correct.

-- Chuck

Henry S. Takeuchi

unread,
Nov 15, 1996, 3:00:00 AM11/15/96
to

In <567oam$c...@lyra.csx.cam.ac.uk>, sg...@cam.ac.uk (Simon Tatham) wrote:

>Scott Nudds <af...@james.freenet.hamilton.on.ca> wrote:
>> You can load a segment register from memory (variable).
>>
>> mov es,foo
>> ret
>>
>> foo dw wongo

>As an assembler author, I'd be interested to know about this


>instruction: it isn't listed in any of the opcode lists I've seen.
>Can you tell me what code the `mov es,foo' instruction generates,
>please?

It's in the Intel docs.
Even DEBUG knows about this instruction:

8E 06 00 01 MOV ES,[0100H]

--
Henry S. Takeuchi
ht...@eskimo.com
Seattle, Washington (USA)


Scott Nudds

unread,
Nov 18, 1996, 3:00:00 AM11/18/96
to

: Scott Nudds <af...@james.freenet.hamilton.on.ca> wrote:
: > You can load a segment register from memory (variable).
: >
: > mov es,foo
: > ret
: >
: > foo dw wongo

(Simon Tatham) wrote:
: As an assembler author, I'd be interested to know about this


: instruction: it isn't listed in any of the opcode lists I've seen.
: Can you tell me what code the `mov es,foo' instruction generates,
: please?

08CH mod.0ss.r/m MOV mem/reg,segreg
08EH mod.0ss.r/m MOV segreg,mem/reg

Available on all members of the 80x86 family from the 8088.


--
<---->


0 new messages