After the output of the modified interrupt (the question is, would you like to reboot?), It does not return the value of the old interrupt back. He must, after I click 1, perform a reboot. I work in TASM, here is an example of my code.

.386 dseg segment use16 text1 db 13,10,'Y 1t res? y1/n0 $' dseg ends cseg segment use16 assume ds:dseg, cs:cseg m1: mov cx, dseg mov ds, cx ; читаем из вектора 19 табл.прерыв. 4 байта и сохр. их в стек (прямое обращение) mov ax,0 mov es,ax mov di, 19h shl di,2 mov bx, di mov ax, [di+2] push bx push ax ; записываем в 19 вектор табл. перыв. адрес своей процедуры lea dx,textart mov es:bx,dx mov dx,cs mov es:[bx+2],dx ; вызов нашей процедуры int 19h cmp al,31h jne short m2 ; если не равно 1, то просто завершаем ; запишем в табл.прерыв. сохраненные адреса ранее pop bx pop ax mov [di],bx mov [di+2], ax int 19h m2: mov ah,4ch; завершение программы int 21h textart proc mov ah, 9 ; выводим строку lea dx,text1 int 21h mov ah,1h ;ввод 0 или 1, по идее то что будет введено будет в AL int 21h iret textart endp cseg ends end m1 

    2 answers 2

    The first mistake:

     mov bx, di mov ax, [di+2] push bx push ax 

    What do you save in bx ? It is necessary not di , but [di] ...

    • Yeah, changed. Only now he gave me DOS ERORR, ax = 604 - papalimer
    • I don’t know what to do at all - papalimer
    • What to do is a good question. Especially in the context of "what for it is needed at all" :) Somehow the use case for such a situation does not seem to be here. To output a request for a reboot, it is not necessary to replace 19h at all. Yes, and DOS can be overloaded easier ... - PinkTux
    • Unfortunately, in the university they do not give to do arbitrarily, but only on the instructions ... - papalimer
    • @papalimer In your version, you take data not from the vector table, but from your own code by the di offset, because by default mov works with the ds segment. You need to explicitly specify the segment mov bx, es:[di] everywhere . And don't forget to do the same when returning the values ​​back - Mike

    Here it seems wrote .386 dseg segment use16 Message db 'Y 1t res? y1 / n0 $ 'Answer db 2 dup (?) dseg ends cseg segment use16 assume ds: dseg, cs: cseg m1: mov cx, dseg mov ds, cx

      mov al, 19h mov ah, 35h int 21h mov al,60h mov sp, es mov ds,sp mov dx,bx mov ah,25h int 21h; Перезаписали из 19h в 60h mov cx,cseg mov ds,cx lea dx,reboot mov al,19h mov ah,25h int 21h mov cx, dseg mov ds, cx int 19h mov ah,4ch int 21h reboot proc lea dx, ds:Message mov ah, 09h int 21h lea si, ds:Answer mov ah, 01h int 21h cmp al, '1' jne short m3 ;если не равно mov al, 60h mov ah, 35h int 21h mov al,19h mov cx, es mov ds,cx mov dx,bx mov ah,25h int 21h int 19h m3: iret reboot endp cseg ends end m1