早期電腦 ISA 卡上 ROM 程序,只有 CHECKSUM = 0 時(shí), 方能被主板 BIOS 識(shí)別到,本程序用于計(jì)算 燒錄 ROM 程序的校驗(yàn)和,和大家共享。 CSEG SEGMENT 'CODE' ASSUME CS:CSEG,DS:CSEG ORG 100H _MAIN: MOV AX,CSEG MOV DS,AX MOV ES,AX JMP _START ;========================================== HANDLE DW 0000H FILENAME DB "BIOS.BIN" // 燒錄文件名 BIOS.BIN BUFFER DB 4100 DUP (00H) OERR DB 'MAKE SURE BIOS.BIN IS PRESENT.',24H // 錯(cuò)誤信息 ASCII DB '0123456789ABCDEF' ;========================================== _START: MOV AH,3DH MOV DX,OFFSET FILENAME XOR AL,AL INT 21H JNC _NEXT1 MOV DX,OFFSET OERR MOV AH,09H INT 21H JMP _EXIT _NEXT1: MOV HANDLE,AX MOV AH,3FH MOV BX,HANDLE MOV CX,4100 MOV DX,OFFSET BUFFER INT 21H MOV SI,OFFSET BUFFER XOR AX,AX MOV AL, BYTE PTR SI[2] MOV CL,9 SHL AX,CL MOV CX,AX XOR AX,AX _NEXT2: ADD AL,BYTE PTR [SI] INC SI LOOP _NEXT2 MOV CL,4 MOV CH,AL XOR AH,AH SHR AL,CL MOV SI,AX MOV AL,ASCII[SI] MOV BX,0 MOV AH,0EH INT 10H MOV AL,CH AND AX,0FH MOV SI,AX MOV AL,ASCII[SI] MOV BX,0 MOV AH,0EH INT 10H _EXIT: MOV AX,4C00H INT 21H ;========================================== CSEG ENDS END _MAIN |
|