. : : Assembly Language : : .  |  首页  |  我提出的问题  |  我参与的问题  |  我的收藏  |  消息中心   |  游客  登录  | 
提问 | 未解决 | 已解决 | 精华区 | 搜索 |
  《汇编语言》论坛 ->转移指令的原理
主题 : :  奇怪,无缘无故多了一条nop指令  [已解决] 回复[ 5次 ]   点击[ 317次 ]  
younthu
[帖 主] [ 发表时间:2008-01-04 14:15 ] 
荣誉值:0
信誉值:4
注册日期:2007-12-11 11:14
课本上的0号中断程序

;substitute int 0
;when div 0 happen,display "divided by 0!program will be terminated!" ,and return to console
data segment
data ends
stack segment
stack ends
code segment
      assume cs:code,ds:data,ss:stack
start:
      mov ax,code
      mov ds,ax
      mov ax,0000h
      mov es,ax
      mov di,0200h     ;copy it to area of blank int table
      mov si,offset stay ;ISR
      mov cx,offset stay_end - offset stay;length of code
      rep movsb
;set int 0
      mov word ptr es:0000h,0200h
      mov word ptr es:0002,0
      mov ax,4c00h
      int 21h
stay:
      jmp isr ;*********************注意这条语句后面多了一条nop指令,请看后面的debug 数据
      db "divided by 0!program will be terminated!$"
isr:
      mov ax,cs
      mov ds,ax
      mov si,202h

      mov ax,0b800h
      mov es,ax
      mov di,12*160+36*2
      
      mov cx,offset isr - offset stay +2
;s:    mov al,[si]
;      mov es:[di],al
;      inc si
;      add di,2
;      loop s
      mov dx,0203h
      mov ax,0
      mov ds,ax
      mov ah,09h
      int 21h
      mov ax,4c00h
      int 21h
stay_end:nop
code ends
end start 
;************debug -u 0000:0200 结果*************
-u 0000:0200
0000:0200 EB2A          JMP     022C
0000:0202 90            NOP          ;***********************这句怎么来得?
0000:0203 64            DB      64    ;‘d'
0000:0204 69            DB      69     ;'i'
0000:0205 7669          JBE     0270
0000:0207 64            DB      64
0000:0208 65            DB      65
0000:0209 64            DB      64
0000:020A 206279        AND     [BP+SI+79],AH
0000:020D 2030          AND     [BX+SI],DH
0000:020F 217072        AND     [BX+SI+72],SI
0000:0212 6F            DB      6F
0000:0213 67            DB      67
0000:0214 7261          JB      0277
0000:0216 6D            DB      6D
0000:0217 207769        AND     [BX+69],DH
0000:021A 6C            DB      6C
0000:021B 6C            DB      6C
0000:021C 206265        AND     [BP+SI+65],AH
0000:021F 207465        AND     [SI+65],DH
-
后面的数据就省略了。
这个nop指令怎么出来的?哪位来帮忙捉鬼
yw007
[第2楼] [ 回复时间:2008-01-05 11:49 ] 
荣誉值:5
信誉值:0
注册日期:2007-12-16 10:57
这个问题请参阅附注3,其中的向后转移时对JMP...s的处理方法。
此问题已结贴!
    Copyright © 2006-2024   ASMEDU.NET  All Rights Reserved