assume cs:_code,ds:_code,ss:_code,es:_code _code segment start: jmp init alteip dw ? altecs dw ? division proc far ; DX:AX Dividend ; BX Divisor ; BX:AX Quotient ; DX Rest push bp mov bp,sp push es bx les bx,dword ptr [bp+2] ;die Rückkehradresse zeigt auf dem Kode der Division ;wir möchten testen ob es Division durch BX war cmp word ptr es:[bx],0f3f7h pop bx es bp jz bzero ; wenn DIV BX wir handeln den Fehler jmp originell bzero: cmp bx,0 jnz zerodiv originell: jmp dword ptr alteip zerodiv: push cx ax dx pop ax mov dx,0 ; erweiterte Division div bx mov cx,ax pop ax div bx mov bx,cx pop cx push bp mov bp,sp ; IP des originellen Programmes ; inkrementieren add word ptr [bp+2],2 ; wir springen DIV über pop bp iret division endp init: mov ax,3500h ; gibt die Adresse des originellen Handlers zurück ; AH <- 35h; AL<-00h (Nummer der Unterbrechung) int 21h mov cs:alteip,bx ; wir speichern Adresse des originellen Handlers mov bx,es mov cs:altecs,bx mov ax,2500h ; neue Adresse des Handlers ist eingestellt ; AH<-25h; Al<-00h (Nummer der Unterbrechung) push cs pop ds mov dx, offset division int 21h ; Testprogramm: mov dx,1234h mov ax,5678h mov bx,100h div bx mov dx,1234h mov ax,5678h mov cx,100h div cx ; stellt das originelle Handler der Unterbrechung 00h zurück mov ax,2500h lds dx, dword ptr alteip int 21h mov ax,4c00h int 21h _code ends end start