;------------------------------------------------------------
MOV AX, CS ; Trap the INT 01h interrupt
XOR BX, BX
MOV DS, BX
MOV [BX], offset our_vx_code ; Offset of the custom handler
MOV [BX+2], BX ; in relation to segment 0000h
MOV DS, AX
MOV EAX, 00000000000000001100000010b
; | | | | | | | |__> Bit Lx can be set.
; | | | | | |
; | | | | | |___________> Bits LE & GE. P6 ignores
; | | | | them. Therefore, their
; | | | | value is not critical.
; | | | |
; | | | |__________________> Interrupt by execution.
; | |
; | |__________________________> LEN Breakpoint length-1 byte
MOV EBX, 7C00h
; ^^^^^^ - Linear physical buffer address,
; by which the boot sector will be loaded.
MOV DR7, EAX
MOV DR0, EBX
; ^ Load the values into debug registers. Starting from this point,
; any access to the breakpoint will generate INT 01h.
;------------------------------------------------------------
以上程序摘自《Shellcoder 编程揭秘》
;---------------------------- 字符串常量 ------------------------------
msgShow db 'Our own Int 01h procedure!',0
;----------------------------------------------------------------------
;----------------------------- 打印16进制(字节)------------------
whexb:
push ax
push dx
pushf
mov dh,dl
and dl,00fh
and dh,0f0h
ror dh,4
call @whb1
mov dh,dl
call @whb1
popf
pop dx
pop ax
ret
@whb1:
cmp dh,0ah
jc @whb2
add dh,7
@whb2:
add dh,'0'
mov ah,0eh
mov al,dh
int 10h
ret
;----------------------------- 打印字符串 ------------------------
write:
pusha
pushf
push bx
call wherexy
mov ah,9
xor cx,cx
xchg cl,bh
and cl,7fh
@wri1:
mov al,[cs:si]
cmp al,0
je @wri2
int 10h
inc si
inc dl
call gotoxy
jmp short @wri1
@wri2:
pop bx
cmp bh,80h
js @wri3
popf
popa
wcrlf:
pusha
pushf
mov ax,0e0dh
xor bl,bl
int 10h
mov al,0ah
int 10h
@wri3:
popf
popa
ret
;----------------------------- 打印16进制地址(DX:CX) ------------------------
whexptr:
push ax
push bx
call whexw
xchg dx,cx
xor bl,bl
mov ax,0e3ah
int 10h
call whexw
xchg dx,cx
pop bx
pop ax
ret
;----------------------------- 调整光标位置-----------------------
wherexy:
push ax
push bx
push cx
mov ah,3
mov bh,0
int 10h
pop cx
pop bx
pop ax
ret
;----------------------------- 调整光标位置-----------------------
gotoxy:
push ax
push bx
mov ah,2
mov bh,0
int 10h
pop bx
pop ax
ret
;----------------------------- 延迟函数 -----------------------
delay:
sti
push ax
push es
pushf
push byte 0
pop es
mov al,[es:046ch]
add ah,al
@dly1:
mov al,[es:046ch]
cmp ah,al
jne @dly1
popf
pop es
pop ax
ret