我學軟盤加解密時也用這本書,這是我的學有所用KV3000金鑰盤源程式

看雪資料發表於2000-12-09

.MODEL LARGE
STACK SEGMENT PARA STACK 'STACK'
DW 128 DUP(?)
STACK ENDS
DATA SEGMENT PARA PUBLIC 'DATA'

PA70_0  DB      46h,0,50,08;70道0面
        DB      46h,0,245,08
        DB      46h,0,110,08 
        DB      46h,0,64,08
        DB      46h,0,87,08

PA70_1  DB      46h,1,13,08;70道1面
        DB      46h,1,37,08
        DB      46h,1,206,08
        DB      46h,1,169,08
        DB      46h,1,162,08

PA71_0  DB      47h,0,231,6
        DB      47h,0,44,6;71道0面
                 

PA71_1  DB      47h,1,198,6
        DB      47h,1,192,6;71道1面
       
                 

PA72_0  DB      48h,0,51,4;72道0面
        DB      48h,0,118,6
        DB      48h,0,147,6
        DB      48h,0,223,06h
        DB      48h,0,102,6
           

PA72_1  DB      48h,1,117,6
        DB      48h,1,111,6;72道1面
       

PA73_0  DB      49h,0,44,4
        DB      49h,0,172,6
        DB      49h,0,86,6
        DB      49h,0,103,6
        DB      49h,0,190,6
       

PA73_1  DB      49h,1,77,6
        DB      49h,1,179,6
       
PA74_0  DB      4ah,0,67,6
        DB      4ah,0,107,6
       

PA74_1  DB      4ah,1,39,6
        DB      4ah,1,61,6

PA75_0  DB      4bh,0,22,6
        DB      4bh,0,18,6
       
       
PA75_1  DB      4bh,1,115,6
        DB      4bh,1,86,6
       

PA76_0  DB      4ch,0,102,6
        DB      4ch,0,52,6
       
       
PA76_1  DB      4ch,1,99,6
        DB      4ch,1,244,6

PA77_0  DB      4dh,0,25,6
        DB      4dh,0,101,5
        DB      4dh,0,138,6
        DB      4dh,0,83,6
        DB      4dh,0,53,6

PA77_1  DB      4dh,1,3,6
        DB      4dh,1,117,6

PA78_0  DB      4eh,0,133,7
        DB      4eh,0,146,6
        DB      4eh,0,254,4
        DB      4eh,0,252,6
        DB      4eh,0,156,6

PA78_1  DB      4eh,1,56,06
        DB      4eh,1,199,6
       
PA79_0  DB      4Fh,0,126,6
        DB      4Fh,0,100,6
       
       
PA79_1  DB      4fh,1,31,04
        DB      4fh,1,145,06
        DB      4fh,1,166,08
        DB      4fh,1,104,06
        DB      4fh,1,201,6

PA80_0    DB      50h,0,19,08
          DB      50h,0,125,06
          DB      50h,0,133,06
          DB      50h,0,56,05
          DB      50h,0,247,06h
                       

PA80_1  DB      50h,1,101,6
        DB      50h,1,248,6

f710 db 'k71044.fin',0
f711 db 'k711192.fin',0
f721 db 'k721111.fin',0
f731 db 'k731179.fin',0
f740 db 'k740107.fin',0
f741 db 'k74161.fin',0
f750 db 'k75018.fin',0
f751 db 'k75186.fin',0
f760 db 'k76052.fin',0
f761 db 'k761244.fin',0
f771 db 'k771117.fin',0
f781 db 'k781199.fin',0
f790 db 'k790100.fin',0
f801 db 'k801248.fin',0


DISP1 DB 'Failure!',0ah,0dh,24h
DISP2 DB 'Success!',0ah,0dh,24h
DISP3 DB 'Making KV3000 Key Disk!',0AH,0DH,24H
DISP4 DB 'CRACKED by ZHUXIAOHUA 2000.11.18',0AH,0DH,24H
DISP5 DB 'TRY A BUG',0AH,0DH,24H
DISP6 DB 'Insert a disk in drive A: press any key to continue!',0ah,0dh,24h
DISP7 DB 'E-mail:zhuxiaohua@126.com', 0ah,0dh,24h
READ_ERR DB 'Can not open fin file or file not exist!',0AH,0DH,24H
DISP700 DB 'Track 70 side 0 made OK',0AH,0DH,24H
DISP701 DB 'Track 70 side 1 made OK',0ah,0dh,24h
DISP710 DB 'Track 71 side 0 made OK',0AH,0DH,24H
DISP711 DB 'Track 71 side 1 made OK',0ah,0dh,24h
DISP720 DB 'Track 72 side 0 made OK',0ah,0dh,24h
DISP721 DB 'Track 72 side 1 made OK',0AH,0DH,24H
DISP730 DB 'Track 73 side 0 made OK',0AH,0DH,24H
DISP731 DB 'Track 73 side 1 made OK',0ah,0dh,24h
DISP740 DB 'Track 74 side 0 made OK',0ah,0dh,24h
DISP741 DB 'Track 74 side 1 made OK',0ah,0dh,24h
DISP750 DB 'Track 75 side 0 made OK',0ah,0dh,24h
DISP751 DB 'Track 75 side 1 made OK',0AH,0DH,24H
DISP760 DB 'Track 76 side 0 made OK',0ah,0dh,24h
DISP761 DB 'Track 76 side 1 made OK',0AH,0DH,24H
DISP770 DB 'Track 77 side 0 made OK',0AH,0DH,24H
DISP771 DB 'Track 77 side 1 made OK',0ah,0dh,24h
DISP780 DB 'Track 78 side 0 made OK',0AH,0DH,24H
DISP781 DB 'Track 78 side 1 made OK',0ah,0dh,24h
DISP790 DB 'Track 79 side 0 made OK',0ah,0dh,24h
DISP791 DB 'Track 79 side 1 made OK',0ah,0dh,24h
DISP800 DB 'Track 80 side 0 made OK',0ah,0dh,24h
DISP801 DB 'Track 80 side 1 made OK',0ah,0dh,24h

DISP710W DB 'Track 71 side 0 Write OK',0AH,0DH,24H
DISP711W DB 'Track 71 side 1 Write OK',0ah,0dh,24h
DISP721W DB 'Track 72 side 1 Write OK',0AH,0DH,24H
DISP731W DB 'Track 73 side 1 Write OK',0ah,0dh,24h
DISP740W DB 'Track 74 side 0 Write OK',0ah,0dh,24h
DISP741W DB 'Track 74 side 1 Write OK',0ah,0dh,24h
DISP750W DB 'Track 75 side 0 Write OK',0ah,0dh,24h
DISP751W DB 'Track 75 side 1 Write OK',0AH,0DH,24H
DISP760W DB 'Track 76 side 0 Write OK',0ah,0dh,24h
DISP761W DB 'Track 76 side 1 Write OK',0AH,0DH,24H
DISP770W DB 'Track 77 side 0 Write OK',0AH,0DH,24H
DISP771W DB 'Track 77 side 1 Write OK',0ah,0dh,24h
DISP780W DB 'Track 78 side 0 Write OK',0AH,0DH,24H
DISP781W DB 'Track 78 side 1 Write OK',0ah,0dh,24h
DISP790W DB 'Track 79 side 0 Write OK',0ah,0dh,24h
DISP791W DB 'Track 79 side 1 Write OK',0ah,0dh,24h
DISP800W DB 'Track 80 side 0 Write OK',0ah,0dh,24h
DISP801W DB 'Track 80 side 1 Write OK',0ah,0dh,24h


ERR DB 00;格式化或寫盤成功標誌01成功00失敗
DATA_CX DW 0000H;格式化磁碟磁軌號臨時存區CX
DATA_BX DW 0000H;
DATA_FILE DB 8192 DUP(0)
DATA ENDS


CODE SEGMENT PARA PUBLIC 'CODE'
ASSUME CS:CODE,DS:DATA,SS:STACK
    MAIN PROC FAR
    PUSH DS
    XOR AX,AX
    PUSH AX
    MOV AX,DATA
    MOV DS,AX
    MOV ES,AX
    LEA DX,DISP3
    MOV AH,09H
    INT 21H
    LEA DX,DISP4
    INT 21H
    LEA DX,DISP6
    INT 21H

    MOV AH,0
    INT 16H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,05;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,4600H;開始格式化70道0面
    LEA BX,DATA_CX
    MOV ES:[BX],AX
    MOV DX,0;0面
    LEA AX,PA70_0
    LEA BX,DATA_BX
    MOV ES:[BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ  R700
    JMP FAIL
R700: LEA DX,DISP700
    MOV AH,09H
    INT 21H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,05;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,4600H;開始格式化70道1面
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0100h;1面
    LEA AX,PA70_1
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ  R701
    JMP FAIL
R701:LEA DX,DISP701
    MOV AH,09H
    INT 21H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,02;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,4700H;開始格式化71道0面
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0;0面
    LEA AX,PA71_0
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ  R710
    JMP FAIL
R710:LEA DX,DISP710
    MOV AH,09H
    INT 21H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,02;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,4700H;開始格式化71道1面
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0100h;1面
    LEA AX,PA71_1
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ R711
    JMP FAIL
R711:LEA DX,DISP711
    MOV AH,09H
    INT 21H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,05;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,4800H;開始格式化72道0面
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0;0面
    LEA AX,PA72_0
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ R720
    JMP  FAIL
R720:LEA DX,DISP720
    MOV AH,09H
    INT 21H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,02;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,4800H;開始格式化72道1面
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0100h;1面
    LEA AX,PA72_1
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ R721
    JMP  FAIL
R721:LEA DX,DISP721
    MOV AH,09H
    INT 21H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,05;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,4900H;開始格式化73道0面
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0;0面
    LEA AX,PA73_0
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ  R730
    JMP  FAIL
R730:LEA DX,DISP730
    MOV AH,09H
    INT 21H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,02;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,4900H;開始格式化73道1面
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0100h;1面
    LEA AX,PA73_1
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ R731
    JMP  FAIL
R731:LEA DX,DISP731
    MOV AH,09H
    INT 21H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,02;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,4a00H;開始格式化74道0面
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0;0面
    LEA AX,PA74_0
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ R740
    JMP  FAIL
R740:LEA DX,DISP740
    MOV AH,09H
    INT 21H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,02;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,04BH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,4a00H;開始格式化74道1面
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0100h;1面
    LEA AX,PA74_1
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ  R741
    JMP  FAIL
R741:LEA DX,DISP741
    MOV AH,09H
    INT 21H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,02;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,4b00H;開始格式化75道0面
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0;0面
    LEA AX,PA75_0
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ R750
    JMP  FAIL
R750:LEA DX,DISP750
    MOV AH,09H
    INT 21H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,02;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
   
    MOV AX,4b00H;開始格式化75道1面
    LEA BX,DATA_CX
    MOV es:[BX],AX
    MOV DX,0100h;1面
    LEA AX,PA75_1
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,es:[BX]
    CMP AX,00
    JZ R751
    JMP  FAIL
R751:LEA DX,DISP751
    MOV AH,09H
    INT 21H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,02;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,4c00H;開始格式化76道0面
    LEA BX,DATA_CX
    MOV es:[BX],AX
    MOV DX,0;0面
    LEA AX,PA76_0
    LEA BX,DATA_BX
    MOV es:[BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,es:[BX]
    CMP AX,00
    JZ  R760
    JMP FAIL
R760:LEA DX,DISP760
    MOV AH,09H
    INT 21H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,02;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,4c00H;開始格式化76道1面
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0100h;1面
    LEA AX,PA76_1
    LEA BX,DATA_BX
    MOV es:[BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ R761
    JMP  FAIL
R761:LEA DX,DISP761
    MOV AH,09H
    INT 21H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,05;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,4d00H;開始格式化77道0面
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0;0面
    LEA AX,PA77_0
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ  R770
    JMP FAIL
R770:LEA DX,DISP770
    MOV AH,09H
    INT 21H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,02;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,4d00H;開始格式化77道1面
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0100h;1面
    LEA AX,PA77_1
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ R771
    JMP  FAIL
R771:LEA DX,DISP771
    MOV AH,09H
    INT 21H
PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,05;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,4e00H;開始格式化78道0面
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0;0面
    LEA AX,PA78_0
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ  R780
    JMP FAIL
R780:LEA DX,DISP780
   
    MOV AH,09H
    INT 21H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,02;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,4e00H;開始格式化78道1面
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0100h;1面
    LEA AX,PA78_1
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ  R781
    JMP FAIL
R781:LEA DX,DISP781
    MOV AH,09H
    INT 21H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,02;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,4f00H;開始格式化79道0面
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0;0面
    LEA AX,PA79_0
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ  R790
    JMP FAIL
R790:LEA DX,DISP790
    MOV AH,09H
    INT 21H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,05;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,4f00H;開始格式化79道1面
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0100h;1面
    LEA AX,PA79_1
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ  R791
    JMP FAIL
R791:LEA DX,DISP791;開始格式化80道0面
    MOV AH,09H
    INT 21H
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,05;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,5000H;開始格式化80道0面
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0;0面
    LEA AX,PA80_0
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ  R800
    JMP FAIL
R800:LEA DX,DISP800
    MOV AH,09H
    INT 21H
    PUSH ES;開始格式化80道1面
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,04
    MOV ES:[BX+3],AL;扇區大小
    MOV AL,02;每道格式化扇區數
    MOV ES:[BX+4],AL
    MOV AL,54H;扇區間隙正常為54h
    MOV ES:[BX+7],AL
    MOV AL,06fH;充填位元組,正常為F6H
    MOV ES:[BX+8],AL

    POP ES
    MOV AX,5000H;開始格式化80道1面
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0100h;1面
    LEA AX,PA80_1
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL FORMATS
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ R801
    JMP  FAIL
R801:LEA DX,DISP801
    MOV AH,09H
    INT 21H



    LEA DX,F710;讀71道0面44扇區指紋檔案
    CALL READFILE
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,06
    MOV ES:[BX+3],AL;扇區大小
    MOV ES:[BX+8],AL
    POP ES
    MOV AX,472cH;寫71道0面44扇區
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0000h;0面
    LEA AX,DATA_FILE
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL WRITES
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ W710
    JMP  FAIL
W710:LEA DX,DISP710W
    MOV AH,09H
    INT 21H

;讀71道1面192扇區指紋檔案
    LEA DX,F711
    CALL READFILE
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,06
    MOV ES:[BX+3],AL;扇區大小
    MOV ES:[BX+8],AL
    POP ES
    MOV AX,47c0H;寫71道1面192扇區
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0100h;1面
    LEA AX,DATA_FILE
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL WRITES
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ W711
    JMP  FAIL
W711:LEA DX,DISP711W
    MOV AH,09H
    INT 21H


    LEA DX,F721;讀72道1面111扇區指紋檔案
    CALL READFILE
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,06
    MOV ES:[BX+3],AL;扇區大小
    MOV ES:[BX+8],AL
    POP ES
    MOV AX,486fH;寫72道1面111扇區
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0100h;0面
    LEA AX,DATA_FILE
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL WRITES
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ W721
    JMP  FAIL
W721:LEA DX,DISP721W
    MOV AH,09H
    INT 21H


LEA DX,F731;讀73道1面179扇區指紋檔案
    CALL READFILE
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,06
    MOV ES:[BX+3],AL;扇區大小
    MOV ES:[BX+8],AL
    POP ES
    MOV AX,49b3H;寫73道1面179扇區
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0100h;1面
    LEA AX,DATA_FILE
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL WRITES
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ W731
    JMP  FAIL
W731:LEA DX,DISP731W
    MOV AH,09H
    INT 21H


LEA DX,F740;讀74道0面107扇區指紋檔案
    CALL READFILE
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,06
    MOV ES:[BX+3],AL;扇區大小
    MOV ES:[BX+8],AL
    POP ES
    MOV AX,4a6bH;寫74道0面107扇區
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0000h;1面
    LEA AX,DATA_FILE
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL WRITES
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ W740
    JMP  FAIL
W740:LEA DX,DISP740W
    MOV AH,09H
    INT 21H



LEA DX,F741;讀74道1面61扇區指紋檔案
    CALL READFILE
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,06
    MOV ES:[BX+3],AL;扇區大小
    MOV ES:[BX+8],AL
    POP ES
    MOV AX,4a3dH;寫74道1面61扇區
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0100h;1面
    LEA AX,DATA_FILE
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL WRITES
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ W741
    JMP  FAIL
W741:LEA DX,DISP741W
    MOV AH,09H
    INT 21H



LEA DX,F750;讀75道0面18扇區指紋檔案
    CALL READFILE
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,06
    MOV ES:[BX+3],AL;扇區大小
    MOV ES:[BX+8],AL
    POP ES
    MOV AX,4b12H;寫74道0面107扇區
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0000h;1面
    LEA AX,DATA_FILE
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL WRITES
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ W750
    JMP  FAIL
W750:LEA DX,DISP750W
    MOV AH,09H
    INT 21H




LEA DX,F751;讀75道1面86扇區指紋檔案
    CALL READFILE
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,06
    MOV ES:[BX+3],AL;扇區大小
    MOV ES:[BX+8],AL
    POP ES
    MOV AX,4b56H;寫75道1面86扇區
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0100h;1面
    LEA AX,DATA_FILE
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL WRITES
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ W751
    JMP  FAIL
W751:LEA DX,DISP751W
    MOV AH,09H
    INT 21H



LEA DX,F760;讀76道0面34扇區指紋檔案
    CALL READFILE
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,06
    MOV ES:[BX+3],AL;扇區大小
    MOV ES:[BX+8],AL
    POP ES
    MOV AX,4c34H;寫74道0面107扇區
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0000h;1面
    LEA AX,DATA_FILE
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL WRITES
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ W760
    JMP  FAIL
W760:LEA DX,DISP760W
    MOV AH,09H
    INT 21H




LEA DX,F761;讀76道1面244扇區指紋檔案
    CALL READFILE
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,06
    MOV ES:[BX+3],AL;扇區大小
    MOV ES:[BX+8],AL
    POP ES
    MOV AX,4cf4H;寫76道1面244扇區
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0100h;1面
    LEA AX,DATA_FILE
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL WRITES
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ W761
    JMP  FAIL
W761:LEA DX,DISP761W
    MOV AH,09H
    INT 21H




LEA DX,F771;讀77道1面117扇區指紋檔案
    CALL READFILE
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,06
    MOV ES:[BX+3],AL;扇區大小
    MOV ES:[BX+8],AL
    POP ES
    MOV AX,4d75H;寫77道1面117扇區
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0100h;1面
    LEA AX,DATA_FILE
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL WRITES
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ W771
    JMP  FAIL
W771:LEA DX,DISP771W
    MOV AH,09H
    INT 21H


LEA DX,F781;讀78道1面119扇區指紋檔案
    CALL READFILE
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,06
    MOV ES:[BX+3],AL;扇區大小
    MOV ES:[BX+8],AL
    POP ES
    MOV AX,4ec7H;寫78道1面119扇區
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0100h;1面
    LEA AX,DATA_FILE
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL WRITES
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ W781
    JMP  FAIL
W781:LEA DX,DISP781W
    MOV AH,09H
    INT 21H



LEA DX,F790;讀79道0面100扇區指紋檔案
    CALL READFILE
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,06
    MOV ES:[BX+3],AL;扇區大小
    MOV ES:[BX+8],AL
    POP ES
    MOV AX,4f64H;寫70道0面100扇區
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,000h;0面
    LEA AX,DATA_FILE
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL WRITES
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ W790
    JMP  FAIL
W790:LEA DX,DISP790W
    MOV AH,09H
    INT 21H





    LEA DX,F801;讀80道1面248扇區指紋檔案
    CALL READFILE
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H
    MOV AL,06
    MOV ES:[BX+3],AL;扇區大小
    MOV ES:[BX+8],AL
    POP ES
    MOV AX,50f8H;寫80道1面248扇區
    LEA BX,DATA_CX
    MOV [BX],AX
    MOV DX,0100h;1面
    LEA AX,DATA_FILE
    LEA BX,DATA_BX
    MOV [BX],AX
    CALL WRITES
    LEA BX,ERR;判斷是否出錯
    MOV AX,[BX]
    CMP AX,00
    JZ W801
    JMP  FAIL
W801:LEA DX,DISP801W
    MOV AH,09H
    INT 21H



JMP EXIT




FAIL:LEA DX,DISP1
    MOV AH,09H
    INT 21H
    LEA DX,DISP7
    INT 21H

    JMP EXIT1
EXIT:LEA DX,DISP2
    MOV AH,09H
    INT 21H
    LEA DX,DISP7
    INT 21H

    JMP EXIT1
EXIT1:PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H;恢復磁碟引數
    MOV AL,02H
    MOV ES:[BX+3],AL
    MOV AL,12H
    MOV ES:[BX+4],AL;
    MOV AL,54H
    MOV ES:[BX+7],AL
    MOV AL,0F6H
    MOV ES:[BX+8],AL
    POP ES
    RET
MAIN ENDP

FORMATS PROC NEAR;格式化特殊磁軌
    MOV  CX,05h
REP01:PUSH CX
    LEA BX,DATA_CX;得到磁軌號
    MOV AX,es:[BX]
    MOV CX,AX
         
    LEA BX,DATA_BX;取得磁軌格式
    MOV AX,ES:[BX]
    MOV BX,AX
    MOV AX,0501h
    INT 13H
    JNB RIGHT01;成功轉移
    POP CX
    DEC CX
    JZ FAIL01
    JMP REP01
FAIL01:LEA BX,ERR;寫出錯標誌
      MOV AX,01
      MOV [BX],AX
      JMP QUIT01
RIGHT01:POP CX
        LEA BX,ERR;寫入成功標誌
        MOV AX,00
        MOV [BX],AX
QUIT01:RET       
FORMATS ENDP

WRITES PROC NEAR;格式化特殊磁軌
    MOV  CX,05h
REP02:PUSH CX
    LEA BX,DATA_CX;得到磁軌號
    MOV AX,es:[BX]
    MOV CX,AX
         
    LEA BX,DATA_BX;取得磁軌格式
    MOV AX,ES:[BX]
    MOV BX,AX
    MOV AX,0301h
    INT 13H
    JNB RIGHT02;成功轉移
    POP CX
    DEC CX
    JZ FAIL02
    JMP REP02
FAIL02:LEA BX,ERR;寫出錯標誌
      MOV AX,01
      MOV [BX],AX
      JMP QUIT02
RIGHT02:POP CX
        LEA BX,ERR;寫入成功標誌
        MOV AX,00
        MOV [BX],AX
QUIT02:RET       
WRITES ENDP




READFILE PROC NEAR
    PUSH ES
    MOV AH,35H
    MOV AL,1EH
    INT 21H;置正常磁碟引數
    MOV AL,02H
    MOV ES:[BX+3],AL
    MOV AL,12H
    MOV ES:[BX+4],AL;
    MOV AL,54H
    MOV ES:[BX+7],AL
    MOV AL,0F6H
    MOV ES:[BX+8],AL
    POP ES
    mov ax,3d00h            ;為讀而開啟檔案
    int 21h
    jnb read                  ;成功轉
err1:lea dx,READ_ERR
    mov ah,9
    int 21h
        mov ah,4ch
        int 21h
read:
    mov bx,ax              ;bx=檔案號
    mov cx,8192            ;讀入8192位元組
    lea dx,DATA_FILE          ;ds:dx為讀入地址
    mov ah,3fh
    int 21h                ;讀入檔案至data_00,ax為讀入位元組數
    cmp ax,8192
        jnz err1
    mov ah,3eh
    int 21h                ;關閉檔案
    ret
readfile endp
CODE ENDS
END MAIN

相關文章