⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hdcopy.asm

📁 硬盘克隆软件。可以将硬盘上所有数据(甚至隐藏分区上的数据)原封不动不动地复制到其它硬盘上
💻 ASM
字号:
code segment 
     assume cs:code,ds:code,es:code,ss:code
     org 100h
begin:jmp main

int13buf db 20h dup(0)
         db 256 dup(0)
rootbuf  db 512 dup(0)
startsec dd 0
tatlsec  dd 0
rwsecnum db 7eh
rw       db 42h
diskflag db 80h
tatltrk  dw 0
betrk    dw 0
fitrk    dw 0
stou     db 0ffh
sec      db 3fh
segadd   dw 0
ask      db 0
disknum  db 80h,81h,0,0,0
         db 20h dup(0)
facenum  db 0
fscount  db 0
tracknum dw 0
keb      db 0,0,0,0,0
tataltrack db "Tatal track number:","$"
inputb   db 13,10,"Please input begin track number:","$"
inputf   db 13,10,"Please input end track number:","$"
err0     db 0
diskerr  db "disk I/O error.",13,10,"$"
diskio   db ": READ/WRITE error.",13,10,"$"
help     db 13,10,"Syntax: ",13,10,13,10
         db "       HDCOPY [source[drive1:] Dest[[drive2:] [drive3] [drive4]]] [/?]",13,10
         DB 13,10,"The hard disks must be the same size and the same LBA type.",13,10
         db 13,10,"Example for HDCOPY:",13,10,13,10
         DB "       HDCOPY D: C: E: F:",13,10,13,10
         db "                             Copyright (c) 2001.3 ZhongFu Corp.",13,10
         db "                             Internet email: wei_507@sina.com",13,10,07,"$"
mess     db 13,10,"NO FOUD LOSE FILE !!!",13,10,"$"
error    db 13,10,13,10,"End track > Begin track !!!",13,10
         DB "Begin track < Tatal track number !!!",13,10
         DB "End track < Tatal track number !!!",13,10
         db "OR dest hard disks not exist !",13,10,"$"
wait1    db 13,10,"Please waiting......",13,10,"$"
supe     db 13,10,"FILE FOUND. OK !",13,10,"$"
enter1   db 13,10,"$"
begintrack db 13,10,"Start:","$"
endtrack db "Track:"
shownum  db "    ","$"
disp1    db "[/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / /]",0
clsvga   db "[                                                           ]",0
disp2    db "[- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -]",0
disp3    db "[\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \]",0
okk      db 13,10,13,10,"Copy complete.OK!",13,10,07,"$"
findchar proc
         lodsb
         cmp al,0h
         je find0
         jmp find1
find0:   jmp find
find1:   xor cx,cx
         mov cl,al
         mov di,offset disknum         
k2:      mov al,[si]
         cmp al,'c'
         jne k1
K4:      mov byte ptr [di],80h
         inc di
k0:      inc si
         loop  k2
         JMP FIND
k1:      cmp al,'C'
         JNE K3
         JMP K4
K3:      CMP AL,'d'
         jne k5
         mov byte ptr [di],81h
         inc di
         jmp k0
k5:      cmp al,'D'
         JNE K6
         MOV BYTE PTR [DI],81H
         inc di
         JMP K0
K6:      CMP AL,'e'
         jne k7
         mov byte ptr [di],82h
         inc di
         jmp k0
k7:      cmp al,'E'
         JNE K8
         MOV BYTE PTR [DI],82H
         inc di
         JMP K0
K8:      CMP AL,'f'
         jne k9
         mov byte ptr [di],83h
         inc di
         jmp k0
k9:      cmp al,'F'
         JNE K10 
         MOV BYTE PTR [DI],83H
         inc di
         JMP K0
K10:     cmp al,'?'
         jne k11
         mov byte ptr [ask],al
         JMP K0
k11:     jmp k0
find:    ret
         endp

kebin proc
      mov si,offset keb
      mov cx,5
p1:   mov ah,01
      int 21h
      cmp al,0dh
      je p2
      cmp al,30h
      jb p3
      cmp al,39h
      ja p3
      sub al,30h
      mov [si],al
      inc si
      jmp p22
p3:   ;mov si,offset keb
      jmp p1
p22:  loop p1
p2:   mov di,offset keb
      sub si,di
      cmp si,1
      je pp1
      cmp si,2
      je pp2
      cmp si,3
      je pp3
      cmp si,4
      je pp4
      xor cx,cx
      jmp pend
pp1:  mov si,offset keb
      xor ah,ah
      mov al,[si]
      mov cx,ax
      jmp pend
pp2:  mov si,offset keb
      xor ah,ah
      mov al,[si]
      mov bx,10
      mul bx
      mov cx,ax
      xor ah,ah
      mov al,[si+1]
      add cx,ax
      jmp pend
pp3:  mov si,offset keb
      xor ah,ah
      mov al,[si]
      mov bx,100
      mul bx
      mov cx,ax
      xor ah,ah
      mov al,[si+1]
      mov bx,10
      mul bx
      add cx,ax
      xor ah,ah
      mov al,[si+2]
      add cx,ax
      jmp pend
pp4:  mov si,offset keb
      xor ah,ah
      mov al,[si]
      mov bx,1000
      mul bx
      mov cx,ax
      xor ah,ah
      mov al,[si+1]
      mov bx,100
      mul bx
      add cx,ax
      xor ah,ah
      mov al,[si+2]
      mov bx,10
      mul bx
      add cx,ax
      xor ah,ah
      mov al,[si+3]
      add cx,ax
pend: ret
      endp

input proc
      db 60h
      mov di,offset disknum
      mov si,offset int13buf
      mov word ptr [si],1ah
      mov dx,[di]  ;80h
      xor dh,dh
      mov ax,4800h
      int 13h
      jb err2
      mov al,0ffh  ;[si+8]
      cmp al,[si+8]
      je ct1
      mov al,240
ct1:  mov [stou],al
      mov al,[si+0ch]
      mov [sec],al
      db 66h
      mov ax,word ptr [si+10h]
      db 66h
      mov word ptr [tatlsec],ax
      xor ah,ah
      xor bh,bh
      mov al,[stou]
      mov bl,[sec] 
      mul bx
      mov bx,ax
      db 66h
      mov ax,word ptr [tatlsec]
      db 66h,0fh,0b7h,0dbh ;movzx ebx,bx
      db 66h,33h,0d2h ;xor edx,edx
      db 66h,0f7h,0f3h     ;div ebx
      mov [tatltrk],ax
      mov ah,9
      mov dx,offset tataltrack
      int 21h
      mov ax,[tatltrk]
      call show
      mov ah,9
      mov dx,offset shownum
      int 21h
      mov ah,9
      mov dx,offset inputb
      int 21h
      call kebin
      mov [betrk],cx
      xor ax,ax
      mov word ptr [keb],ax
      mov word ptr [keb+2],ax
      mov byte ptr [keb+4],al
      mov ah,9
      mov dx,offset inputf
      int 21h
      call kebin
      mov [fitrk],cx
      jmp bb
err2: mov byte ptr [err0],1      
bb:   db 61h
      ret
      endp

main  proc
      DB   60H
      PUSH ES
      PUSH DS
      PUSH CS
      POP  DS
      PUSH CS
      POP  ES
      cld
      mov  si,80h
      call findchar
      mov si,80h
      mov al,[si]
      or  al,al
      jz  he11
      jmp mm
he11: jmp help1
mm:   mov al,[ask]
      cmp al,'?'
      je  he11
      mov si,offset disknum
      mov al,[si]
      cmp al,[si+1]
      je  he11
      cmp al,[si+2]
      je he11
      cmp al,[si+3]
      je he11
      mov al,[si+1]
      cmp al,[si+2]
      je he11
      cmp al,[si+3]
      je he11
      mov al,[si+2]
      or al,al
      jz b
      cmp al,[si+3]
      je he11

b:    mov si,offset disknum
jans: mov dl,[si]
      mov ax,4100h
      mov bx,55aah
      int 13h
      cmp bx,0aa55h
      jne err1
      inc si
      cmp byte ptr [si],0
      jnz jans
      call input
      mov al,[err0]
      cmp al,0
      jne err3
      MOV AX,[BETRK]
      CMP AX,WORD PTR [FITRK]
      JBE TRAC1
err1: MOV AH,9
      MOV DX,OFFSET ERROR
      INT 21H
      JMP FFF
err3: mov ah,9
      mov dx,offset ERROR
      int 21h
      jmp fff
TRAC1:cmp ax,[tatltrk]
      jae err1
      mov ax,[fitrk]
      cmp ax,[tatltrk]
      jae err1
FA2:  MOV AH,9
      MOV DX,OFFSET WAIT1
      INT 21H
      
      call hdcopy
      MOV AH,09
      mov dx,offset okk
      int 21h
      jmp fff
help1:mov ah,9
      mov dx,offset help
      int 21h
      jmp fff
fff:  POP  DS
      POP  ES
      DB   61H
      MOV  AX,4C00H
      INT  21H
      ret
      ENDP

xs1   proc
      db 60h
      mov ah,02h
      mov bx,0
      mov dx,1806h
      int 10h
ds1:  lodsb
      cmp al,0
      jz ds2
      mov bx,0fh
      mov ah,0eh
      int 10h
      jmp ds1
ds2:  db 61h
      ret
      endp


rw42  proc
      db 60h
      ;mov si,offset disp1
      ;call xs1
      mov si,offset int13buf
      mov word ptr [si],10h
      mov al,[rwsecnum]
      mov byte ptr [si+2],al
      mov byte ptr [si+3],0
      mov word ptr [si+4],0
      mov ax,[segadd]
      mov word ptr [si+6],ax
      db 66h
      mov ax,word ptr [startsec]
      db 66h
      mov word ptr [si+8],ax
      db 66h
      xor ax,ax
      db 66h
      mov word ptr [si+12],ax
      mov cx,2
xfff: mov ah,[rw]
      mov al,0
      mov dl,[diskflag]
      mov dh,0
      int 13h
      jb xff
      jmp norm
xff:
      mov dl,[diskflag]
      sub dl,40h
      add dl,3
      mov ah,2
      int 21h
      mov dx,offset diskio
      mov ah,9
      int 21h
      dec cx
      jnz xfff
norm: ;mov si,offset clsvga
      ;call xs1
      ;mov si,offset disp2
      ;call xs1
      ;mov si,offset clsvga
      ;call xs1
      ;mov si,offset disp3
      ;call xs1
      db 61h
      ret
      endp

hdcopy proc
       db 60h
       mov ax,[betrk]
       call show
       mov ah,9
       mov dx,offset begintrack
       int 21h
       mov ah,9
       mov dx,offset shownum
       int 21h
       mov ah,9
       mov dx,offset enter1
       int 21h
       mov ax,[betrk]
       mov [tracknum],ax
       xor ah,ah
       mov al,[stou]
       mov bl,10h
       div bl
       or ah,ah
       jnz tff
       mov al,[stou]
       db 0c0h,0e8h,03h   ;shr al,3
       dec al
       mov [facenum],al
       jmp h1
tff:   mov al,[stou]
       cmp al,0ffh
       jne end0  ;t240
       jmp end1
end0:  jmp rwend
end1:  mov al,31
       mov [facenum],al
h1:    mov ah,3
       xor bx,bx
       int 10h
       cmp dl,0
       jz gb1
       sub dl,10
       mov ah,2
       int 10h
gb1:   mov ax,[tracknum]
       call show
       mov ah,9
       mov dx,offset endtrack
       int 21h
       xor al,al
       mov [fscount],al
       mov bx,[tracknum]
       db 66h,0fh,0b7h,0c3h   ;movzx eax,bx
       mov bl,[stou]
       db 66h,0fh,0b6h,0dbh   ;movzx ebx,bl
       db 66h,0f7h,0e3h  ;mul ebx
       mov bl,[sec]
       db 66h,0fh,0b6h,0dbh   ;movzx ebx,bl
       db 66h,0f7h,0e3h  ;mul ebx
       db 66h
       mov word ptr [startsec],ax
bfst:  mov al,42h
       mov [rw],al
       mov al,byte ptr [disknum]
       mov [diskflag],al
       mov al,[fscount]
       cmp al,[facenum]
       ja en8
       jmp en9
en8:   jmp end8
en9:   mov ax,5000h
       mov [segadd],ax
       mov al,7eh
       mov [rwsecnum],al
       call rw42
       db 66h,0b8h,07eh,00,00,00 ;mov eax,7eh
       db 66h
       add word ptr [startsec],ax
       mov ax,6000h
       mov [segadd],ax
       call rw42
       db 66h,0b8h,07eh,00,00,00 ;mov eax,7eh
       db 66h
       add word ptr [startsec],ax
       mov ax,7000h
       mov [segadd],ax
       call rw42
       db 66h,0b8h,07eh,00,00,00 ;mov eax,7eh
       db 66h
       add word ptr [startsec],ax
       mov ax,8000h
       mov [segadd],ax
       mov al,[fscount]
       cmp al,31
       je fnum1
       mov al,7eh
       mov [rwsecnum],al
       jmp fnum2
fnum1: mov al,3fh       
       mov [rwsecnum],al
fnum2: call rw42
       
       mov al,43h
       mov [rw],al
       mov si,offset disknum
       inc si
wdisk: mov al,[si]
       mov [diskflag],al
       push si
       db 66h
       mov ax,word ptr [startsec]
       db 66h,2dh,7ah,01,0,0   ;sub eax,17ah
       db 66h
       mov word ptr [startsec],ax
       mov ax,5000h
       mov [segadd],ax
       mov al,7eh
       mov [rwsecnum],al
       call rw42
       db 66h,0b8h,07eh,00,00,00 ;mov eax,7eh
       db 66h
       add word ptr [startsec],ax
       mov ax,6000h
       mov [segadd],ax
       call rw42
       db 66h,0b8h,07eh,00,00,00 ;mov eax,7eh
       db 66h
       add word ptr [startsec],ax
       mov ax,7000h
       mov [segadd],ax
       call rw42
       db 66h,0b8h,07eh,00,00,00 ;mov eax,7eh
       db 66h
       add word ptr [startsec],ax
       mov ax,8000h
       mov [segadd],ax
       mov al,[fscount]
       cmp al,31
       je fsnum1
       mov al,7eh
       mov [rwsecnum],al
       jmp fsnum2
fsnum1:mov al,3fh       
       mov [rwsecnum],al
fsnum2:call rw42
       pop si
       inc si
       cmp byte ptr [si],0
       jne wdisk

       mov al,[fscount]
       cmp al,31
       je hh1
       db 66h,0b8h,07eh,00,00,00 ;mov eax,7eh
       db 66h
       add word ptr [startsec],ax
       jmp hh2
hh1:   db 66h,0b8h,03fh,00,00,00 ;mov eax,3fh
       db 66h
       add word ptr [startsec],ax
hh2:   inc byte ptr [fscount]
       jmp bfst
end8:  inc word ptr [tracknum]       
       mov ax,[fitrk]
       cmp [tracknum],ax
       ja  rwend
       jmp h1
rwend: db 61h
       ret
       endp

show   proc
       db 60h
       mov si,offset shownum
       ;mov ax,[tracknum]
       xor dx,dx
       mov bx,1000
       div bx
       add al,30h
       mov [si],al
       mov ax,dx
       xor dx,dx
       mov bx,100
       div bx
       add al,30h
       mov [si+1],al
       mov ax,dx
       xor dx,dx
       mov bx,10
       div bx
       add al,30h
       mov [si+2],al
       add dl,30h
       mov [si+3],dl
       db 61h
       ret
       endp
code   ends
       end begin

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -