静雨纷纷 发表于 2012-5-26 16:49:54

一点小问题啦····求指导啦·····

本帖最后由 静雨纷纷 于 2012-5-26 16:51 编辑

我在notepad++中打开的显示如下··
datasg segment
   db '1. display      '
   db '2. brows      '
   db '3. replase      '
   db '4. modify      '
datasg ends


但在debug下运行的结果
-d 13f8:0000
13F8:000031 2E 20·····             ··············      20 20 20 20 20 20   1. DISPlay
13F8:001032 2E 20 ········································ 20 20 20 20 33 2E 20   2. BROWs.    3.
13F8:002072 65 70 4C 41 53 45 20-20 20 20 20 20 34 2E 20   repLASE      4.
13F8:00306D 6F 64 49 46 59 00 20-20 20 20 20 20 00 00 00   modIFY.      ...

有时候用记事本打开的时候····那个单引号经常不在它应该出现的位置上··???
求·指导一下啦啊··············告诉我到底发生了什么···

Yara 发表于 2012-5-26 16:49:55

静雨纷纷 发表于 2012-5-27 03:05 static/image/common/back.gif
嗯····· 但是我在notepad++中打开asm时··显示的和别的一样长·看不出来我多定义了几个字节··我想 ...

你试一下
assume cs:codesg,ss:stacksg,ds:datasg
      
      stacksg segment
                dw 0,0,0,0,0,0,0,0
      stacksg ends
      
      datasg segment
                        db '1. display      '
                        db '2. brows      '
                        db '3. replase      '
                        db '4. modify       '
      datasg ends
      
      codesg segment
      start:      mov ax,datasg
                        mov ds,ax
                        mov bx,0
                        mov ax,stacksg                        
                        mov ss,ax
                        mov sp,16
                        
                        
                        mov cx,4
      s:                push cx
                        mov si,3
                        
                        mov cx,4
      abc:      mov al,
                        and al ,11011111b
                        mov ,al      
                        inc si
                        loop abc
                        
                        add bx,10h
                        pop cx
                        loop s
                        
                        mov ax,4c00h
                        int 21h
      codesg ends
      end start

,我调试过是没错的,问题应该就是定义的时候错了

Yara 发表于 2012-5-26 17:16:22

很抱歉,你想问的是notepad++和记事本打开的asm文件的不同吗?如果是,那就只能说编码的不同了,如果不是,就发全代码出来吧,你这样子不能解释什么

风中雨 发表于 2012-5-26 18:47:26

没记错的话,单引号不算数据,只是标志着数据的开始,它的下一个字符才是数据的真正开始,

静雨纷纷 发表于 2012-5-26 22:22:54

Yara 发表于 2012-5-26 17:16 static/image/common/back.gif
很抱歉,你想问的是notepad++和记事本打开的asm文件的不同吗?如果是,那就只能说编码的不同了,如果不是, ...

        assume cs:codesg,ss:stacksg,ds:datasg
       
        stacksg segment
                dw 0,0,0,0,0,0,0,0
        stacksg ends
       
        datasg segment
                        db '1. display      '
                        db '2. brows          '                        db '3. replase      '
                        db '4. modify       '
        datasg ends
       
        codesg segment
        start:        mov ax,datasg
                        mov ds,ax
                        mov bx,0
                        mov ax,stacksg                       
                        mov ss,ax
                        mov sp,16
                       
                       
                        mov cx,4
        s:                push cx
                        mov si,3
                       
                        mov cx,4
        abc:        mov al,
                        and al ,11011111b
                        mov ,al       
                        inc si
                        loop abc
                       
                        add bx,10h
                        pop cx
                        loop s
                       
                        mov ax,4c00h
                        int 21h
        codesg ends
        end start
      代码是这样的··· 然后debug   ·就是我刚开始给的了···

Yara 发表于 2012-5-26 22:36:58

      assume cs:codesg,ss:stacksg,ds:datasg
      
      stacksg segment
                dw 0,0,0,0,0,0,0,0
      stacksg ends
      
      datasg segment
                        db '1. display      '
                        db '2. brows      '
                                                db '3. replase      '
                        db '4. modify       '
      datasg ends
      
      codesg segment
      start:      mov ax,datasg
                        mov ds,ax
                        mov bx,0
                        mov ax,stacksg                        
                        mov ss,ax
                        mov sp,16
                        
                        
                        mov cx,4
      s:                push cx
                        mov si,3
                        
                        mov cx,4
      abc:      mov al,
                        and al ,11011111b
                        mov ,al      
                        inc si
                        loop abc
                        
                        add bx,10h
                        pop cx
                        loop s
                        
                        mov ax,4c00h
                        int 21h
      codesg ends
      end start
你错在
db '2. brows            ',这里你多定义了几个字节,所以在后面的都错了,改正一下就可以把前面的都4个小写字母都转换为大写了,你试一下吧

静雨纷纷 发表于 2012-5-27 03:05:12

Yara 发表于 2012-5-26 22:36 static/image/common/back.gif
assume cs:codesg,ss:stacksg,ds:datasg
      
      stacksg segment


嗯····· 但是我在notepad++中打开asm时··显示的和别的一样长·看不出来我多定义了几个字节··我想知道是怎么回事··

静雨纷纷 发表于 2012-5-28 19:04:31

Yara 发表于 2012-5-27 12:07 static/image/common/back.gif
你试一下
assume cs:codesg,ss:stacksg,ds:datasg
      


嗯····谢谢了······ 用edit··记事本··notepad++··打相同的代码··是不是一样???
页: [1]
查看完整版本: 一点小问题啦····求指导啦·····