rmich@Lise.Unit.NO (Rolf Michelsen) (05/03/91)
I have a problem with TAMS version 2.0. Has anybody tried to use segment overrides in any of the string instructions?? I am trying to move data from ES:SI to ES:DI with REP MOVS [byte es:si],[di] but did it work? NO :-( As far as I know it is possible to use segment overrides for the SI-part of a string instruction. Am I wrong or is TAMS wrong?? TAMS does not generate an error when doing this, it simply does not output the segment override byte to the object/list file. This was assembled in ideal mode... Thanx in advance :-) ___________________ / | / Snail-Mail: | / Rolf Michelsen | / Studpost 130 | \ 7034 Trondheim-NTH| \ E-Mail: | \ rmich@lise.unit.no| \___________________|
dj@ctron.com (DJ Delorie) (05/03/91)
In article <1991May3.063740.10187@ugle.unit.no>, rmich@Lise.Unit.NO (Rolf Michelsen) writes: > I have a problem with TAMS version 2.0. Has anybody tried to use > segment overrides in any of the string instructions?? I am trying > to move data from ES:SI to ES:DI with REP MOVS [byte es:si],[di] but > did it work? NO :-( As far as I know it is possible to use segment > overrides for the SI-part of a string instruction. Am I wrong or is > TAMS wrong?? TAMS does not generate an error when doing this, it simply > does not output the segment override byte to the object/list file. This > was assembled in ideal mode... String instructions do not obey segment overrides. DJ dj@ctron.com
a_rubin@dsg4.dse.beckman.com (05/03/91)
In <1469@balrog.ctron.com> dj@ctron.com (DJ Delorie) writes: >String instructions do not obey segment overrides. According to my manual, they obey segment overrides for the source/DS argument only. (In MASM, you also must use the syntax REP MOVS BYTE PTR ignored,ES:ignored ;(or something like that) as the format for MOV is dest,source. >DJ >dj@ctron.com -- a_rubin@dsg4.dse.beckman.com My opinions are my own, and do not represent those of my employer.
ralf+@cs.cmu.edu (Ralf Brown) (05/04/91)
In article <1469@balrog.ctron.com> dj@ctron.com writes: }In article <1991May3.063740.10187@ugle.unit.no>, rmich@Lise.Unit.NO (Rolf Michelsen) writes: }> I have a problem with TAMS version 2.0. Has anybody tried to use }> segment overrides in any of the string instructions?? I am trying }> to move data from ES:SI to ES:DI with REP MOVS [byte es:si],[di] but }> did it work? NO :-( As far as I know it is possible to use segment }> overrides for the SI-part of a string instruction. Am I wrong or is } }String instructions do not obey segment overrides. Only partially true. You can't override the ES: on the implicit use of DI, but you *can* override the DS: on the implicit use of SI. This means that STOS and SCAS cannot make use of segment overrides, but LODS can be overridden, as can the source operands of MOVS and CMPS. To get TASM to put in segment overrides on a string instruction, you'll need to jam the appropriate byte into the assembly just prior to the string instruction. I would suggest something like SEG_ES MACRO DB 26h ENDM ... SEG_ES MOVSW ... -- {backbone}!cs.cmu.edu!ralf ARPA: RALF@CS.CMU.EDU FIDO: Ralf Brown 1:129/3.1 BITnet: RALF%CS.CMU.EDU@CARNEGIE AT&Tnet: (412)268-3053 (school) FAX: ask DISCLAIMER? Did | It isn't what we don't know that gives us trouble, it's I claim something?| what we know that ain't so. --Will Rogers
andy@bluemoon.uucp (Andy Vaught) (05/05/91)
rmich@Lise.Unit.NO (Rolf Michelsen) writes: > > I have a problem with TAMS version 2.0. Has anybody tried to use > segment overrides in any of the string instructions?? I am trying > to move data from ES:SI to ES:DI with REP MOVS [byte es:si],[di] but > did it work? NO :-( As far as I know it is possible to use segment Segment overrides are indeed allowed with MOVS, and if you can't figure out how to get it on one line, you can use two lines: seges rep movsb Unfortunately, using a segment override with a rep prefix, while legal, is not a good idea. On the 8086, if an interrupt occurs, the 8086 forgets about one of the prefixes-- the REP prefix, I think. So what happens is the interrupt service routine executes, returns to the string move, and thinks its done (CX is nonzero). This is fixed on the 80386, and I'm not sure about the 80286. ------------------------------------------------------------------ Andy Vaught (Fuzzy Andy) :: C Code. C Code Run. Run C code, Run... Grad Student on Vacation :: before I whip out my 12-Gauge andy@bluemoon.uucp :: Dynamic Debugging Tool!
rcollins@altos86.Altos.COM (Robert Collins) (05/07/91)
In article <1469@balrog.ctron.com> dj@ctron.com writes: > >String instructions do not obey segment overrides. > On whose part? Certain string instructions do allow segment overrides. Believe me, I use them all of the time. With MASM, I must encode them as follows: rep movs byte ptr es:[di],byte ptr es:[si] The CPU certainly does support segment overrides for some string instructions. -- "Worship the Lord your God, and serve him only." Mat. 4:10 Robert Collins UUCP: ...!sun!altos86!rcollins HOME: (408) 225-8002 WORK: (408) 432-6200 x4356
rmich@Lise.Unit.NO (Rolf Michelsen) (05/08/91)
Sorry for the mess and confusion my original posting regarding segment overrides in string instructions. It *is* possible to use overrides on the SI part. My problem was to make TASM put these overrides into my .obj file when writing things like 'rep movs [byte es:si],[di]'. However, as someone pointed out, the *destination* for the move is the first argument (just as for a normal mov instruction). I went back and tested this 'rep movs [byte di],[es:si]' and of course it worked :-) The only remaining problem is then that TASM don't flag 'mov [si],[di]' as an error which it clearly is. (And since the TASM quick reference *always* uses the phrase 'move from SI to DI' which suggests SI before DI) this may lead to troubles for us who usually use movsb/movsw and don't care about the order of the operators. Hope this settles the matter :-) ___________________ / | / Snail-Mail: | / Rolf Michelsen | / Studpost 130 | \ 7034 Trondheim-NTH| \ E-Mail: | \ rmich@lise.unit.no| \___________________|
uncal@talgras.UUCP (Al Amet) (05/09/91)
Those of you that do a segment override on a repeat move had better make sure the program won't be running on an 8088/86 machine. Intel documents the segment override WILL BE FORGOTTEN if an interrupt occurs during the repeate move execution.