汇编语言(王爽)--实验15 安装新的int 9中断历程

时间:2021-11-04 00:47:56

慎看:emu8086没有IO设备的支持,所以我瞎写的程序

汇编语言(王爽)--实验15 安装新的int 9中断历程

assume cs:code

stack segment
    db 128 dup(0)
stack ends

data segment
    dw 0,0
data ends

code segment
start:mov ax,stack
      mov ss,ax
      mov sp,128
      
      push cs
      pop ds        ;ds=cs
      
      mov ax,0
      mov es,ax       ;es=0
      
      mov si,offset int9
      mov di,204h
      mov cx,offset int9-offset int9end
      cld
      movsb
      
      push es:[9*4]
      pop es:[200h]
      push es:[9*4+2]
      pop es:[202h]
      
      cli 
      mov word ptr es:[9*4],204h
      mov word ptr es:[9*4+2],0
      sti
      
      mov ax,4c00h
      int 21h
       
   
      
 int9:push ax
      push bx
      push es
      push cx
      
      in al,60h
      
      pushf
      call dword ptr cs:[200h]
      
      cmp al,1Eh
      jne int9ret
      
      mov ax,0b800h
      mov es,ax
      mov aL,'A'
      mov bx,0
      mov cx,2000
    s:mov es:[bx],al
      add bx,2
      loop s
       
int9ret:pop cx
        pop es
        pop bx
        pop ax
        iret
int9end:nop  

code ends

end start