0

我的汇编代码将一个单词存储在从 8C0A2 开始的地址(总共 40h 个单词)

代码的结果是寄存器 CX 为 0000h(如预期)和 DI ist 0082h(如预期)。

在 gven 地址检查 extrasegment ES 显示它没有设置为单词 AFFEh,我不知道为什么!

.186
.model  small
.stack  100h

.data
count   dw  0040h       ; write 40 times the string
muster  dw  0AFFEh      ; AFFEh to the Extrasegment with the
insert  dw  8C0Ah       ; address 8C0Ah

.code
start:
    mov ax, @data
    mov ds, ax

    mov es, insert

    mov ax, muster

    mov cx, count

    mov di, 2       

    rep stosw       

    mov ah, 4Ch     
    int 21h
    end start
4

2 回答 2

0

mov es,INSERT may be invalid, and you may need to point with bp to get the hex values

mov ax,DATA
mov ds,ax
mov bp,INSERT
mov es,[bp]
mov bp,MUSTER
mov ax,[bp]
mov bp,COUNT
mov cx,[bp]
mov di,2
rep stosw

DATA
COUNT
dw 40
MUSTER
dw AFFE
INSERT
dw 8C0A

all I get is a line of scores and squiggles.../~/~/~/~, which is AFFE the hex contents of ax

Usually losb/losw is used with stosw, this loads up al/ax

==========================

If this does work

   mov es, insert

   mov ax, muster

   mov cx, count

then all you are doing is loading es with the memory address of INSERT etc, not their contents

"Inspecting the extrasegment ES at the gven addresses shows me that it is NOT set to the word AFFE"

ES has 8C0A which is "INSERT"

于 2013-06-05T01:00:07.380 回答
0

我不确定你到底想做什么。by 指向的单词es不包含的原因0AFFEhmov di, 2- 模式插入从 开始(es+2),然后继续到更高的地址。

于 2013-06-04T22:44:46.073 回答