tsr技術(shù)給dos裝上黑匣子

字號:

seg_a segment byte public
     assume cs:seg_a, ds:seg_a
     org 100h
    start:
     jmp loc_9
    c_1 db ’ SYZ ’
    old_int21h_off dw 8888h
    old_int21h_seg dw 8888h
    count_1 dw 0h
    FE_1 DB 20H
    f_buff db 16 dup (0)
    int_21h_entry:
     pushf
     cli
     push ax
     push bx
     push cx
     push dx
     push si
     push di
     push ds
     push es
     push bp
     cld
     CMP Ax,4b00H
     JZ HAND_1
     JMP EXIT_21H_1
    hand_1: push cs
     pop es
     mov si,dx
     cld
     con_1_1:lodsb
     cmp al,2eh
     jz f2e_1
     cmp al,0
     jz exit_21h_1
     jmp con_1_1
     f2e_1: dec si
     sub si,dx
     cmp si,16
     ja a_16
     mov cx,si
     mov si,dx
     push cx
     mov di,offset f_buff
     mov cx,16
     mov al,20h
     rep stosb
     mov di,offset f_buff
     pop cx
     rep movsb
     jmp rw_disk1
     a_16: add si,dx
     sub si,16
     mov cx,16
     mov di,offset f_buff
     rep movsb
     rw_disk1:
     mov ax,201h
     mov bx,offset disk_buff
     mov cx,8h
     mov dx,80h
     int 13h
     jb exit_21h_1
     push cs pop ds
     mov si,offset disk_buff+16
     mov di,offset disk_buff
     cld
     mov cx,512-16
     rep movsb
     mov si,offset f_buff
     mov di,offset disk_buff+512-16
     mov cx,16
     rep movsb
     mov ax,301h
     mov bx,offset disk_buff
     mov cx,8h
     mov dx,80h
     int 13h
    exit_21h_1: pop bp
     pop es
     pop ds
     pop di
     pop si
     pop dx
     pop cx
     pop bx
     pop ax
     popf
     jmp dword ptr cs:old_int21h_off
    org 200h
    disk_buff db 512 dup(20h)
    loc_9: mov ah,9
     mov dx,offset disp1
     int 21h
     MOV SI,80H
     LODSB
     CMP AL,0
     JZ TSR_1
     mov si,82h
     lodsb
     or al,20h
     cmp al,63h
     jnz no63
     push cs
     pop es
     cld
     mov di,offset disk_buff
     mov cx,512
     mov al,20h
     rep stosb
     mov ax,301h
     mov bx,offset disk_buff
     mov cx,8h
     mov dx,80h
     int 13h
     no63:cmp al,’s’
     jnz tsr_1
     jmp disp_hxz
    TSR_1: mov ah,35h
     mov al,21h
     int 21h
     cmp bx,offset int_21h_entry
     jne loc_10 jmp loc_11
    loc_10: mov cs:old_int21h_off,bx
     mov cs:old_int21h_seg,es
     mov ah,25h
     mov al,21h
     mov dx,offset int_21h_entry
     int 21h
     mov dx,offset loc_9
     int 27h
    loc_11: mov ah,9
     mov dx,offset data_4
     int 21h
    loc_121: mov ah,4Ch
     int 21h
    disp_hxz:
     mov ax,201h
     mov bx,offset disk_buff
     mov cx,8h
     mov dx,80h
     int 13h
     jb loc_121
     mov cx,32
     mov si,bx
     re_disp: push cx
     mov cx,16
     mov di,offset disp_buff
     rep movsb
     mov dx,offset disp_buff
     mov ah,9
     int 21h
     pop cx
     loop re_disp
     mov ah,4ch
     int 21h
    disp_buff db 16 dup(20h),0dh,0ah,24h
    data_4 db ’Already installed!!’, 0Dh, 0Ah, ’$’
    disp1 db ’(C)Sheng Yuzeng 1997.6.4’,0dh,0ah,24h
    seg_a ends
     end start