- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试为我的 boot.bin 和 kernel.bin 文件创建一个可引导的软盘驱动器。我的 boot.asm 代码是:
bits 16
section .text
start:
JMP MAIN
WAIT_FOR_KEY:
MOV AH, 00H
INT 16H
RET
CLEAR:
MOV AH, 0H ;CHANGING THE VIDEO MODE TO CLEAR THE SCREEN
MOV AL, 03H ;VIDEO MODE COD
INT 10H
RET
LOG_TO_HTS:
PUSH BX
PUSH AX
MOV BX, AX
MOV DX, 0
DIV WORD[ALL_SECTORS]
ADD DL, 01H
MOV CL, DL
MOV AX, BX
MOV DX, 0
DIV WORD [ALL_SECTORS]
MOV DX, 0
DIV WORD[FACES]
MOV DH, DL
MOV CH, AL
POP AX
POP BX
MOV DL, BYTE [BOOT_DEVICE]
RET
ECHO: ;-=-=-=PRINTING FUNCTION =-=-=-;
LODSB ;MOV ONE CHAR FROM SI TO AL AND DELETE IT FROM SI
CMP AL, 0 ;CHECK IF THE VALUE IN AL=0, IF ITS ZERO THEN WE
JE DONE ;WE ARE DONE PRINTING, AND JUMP BACK TO THE MAIN FUNCTION
CMP AL, 59
JE NEWLINE
MOV AH, 0EH ;THE FUNCTION CODE FOR PRINTING (TELETYPE PRINTING)
INT 10H ;BIOS CALL
JMP ECHO ;IF WE ARRIVED TO THIS LINE THATS MEAN WE ARE NOT DONE WITH
;PRINTING THE WHOLE STREING SO JUMP BACK AND COMPLETE THE PROCESS
DONE: ;LABEL CONTAINS ONE INSTRUCTION TO JUMP BACK TO THE LINE
RET ;WHERE WE CALLED THE ECHO FUNCTION
NEWLINE:
PUSHA
MOV AH, 0EH
MOV AL, 13
INT 10H
MOV AL, 10
INT 10H
POPA
RET
RESET_DRIVE: ;RESET FLOPPY DRIVE FUNCTION
MOV AX, 0 ;THE FUNCTION CODE TO RESET DRIVE
MOV DL, BYTE [BOOT_DEVICE] ;DRIVE ID TO RESET
INT 13H
RET
MAIN: ;THE MAIN FUNCTION LABEL
;TO BEGIN LOADING EXTERNAL FILE LIKE KERNEL SOME THINGS MUST BE DONE LIKE :
;1- SETTING UP THE STACK
;2- SETTING UP THE SEGMENTS
;3- SPECIFY THE BOOT DRIVE
;SETTING UP THE STACK
CLI ;CLEAR INTERRUPTS TO SET THE SEGMENT
XOR AX, AX ;SET THE BOTTOM OF THE STACK
MOV SS, AX
MOV SP, 0XFFFF ;SET THE TOP OF THE STACK
STI ;RESTORE THE INTERRUPTS
;SETTING UP THE SEGMENTS
MOV AX, 07C0H
MOV DS, AX
MOV ES, AX
;AFTER SETTING UP SEGMENTS AND STACK, YOU ARE FREE TO CODE WHAT EVER YOU WANT
;THE CPU WILL RECOGNISE YOUR CODE AS A BOOTLOADER
CALL CLEAR
;MOV SI, WELCOME_MSG
;CALL ECHO
MOV [BOOT_DEVICE], DL ;SAVE THE DRIVE ID TO USE IT LATER
;WE WILL USE IN 13H TO LOAD ROOT DIR. THAT WE NEED TO LOAD THE FIRST SECTOR OF THE KERNEL
;THEN WE WILL LOAD FAT TO LOAD THE WHOLE KERNEL SINCE THE FILE LOAD PROCESS CONSISTS OF 3 STEPS
;1- LOAD THE FISRT SECTOR OF THE FILE
;2- LOAD THE WHOLE FILE AND COPY IT INTO RAM
;3- EXCUTE THE FILE
;THE ROOT DIR. AND FAT ARE LOCATED IN SOMEWHERE ON THE FLOPPY DRIVE AS FOLLOWS
;1- SETTING UP AND LOADING THE ROOT DIR.
MOV AH, 02H ;THE FUNCTION CODE FOR LOADING ROOT DIR.
MOV AL, 14 ;THE SIZE OF THE ROOT DIR. THE ROOT DIR. = 14 AND WE WANT TO LOAD IT ALL SO AL=14
MOV BX, TEMP ;THE TEMP STORAGE FOR THE DATA WILL BE READED OR LOADED
MOV CH, 0 ;TRACK WE WANT TO LOAD, ITS TRACK 0 BEACUSE THE ROOT DIR. LOCATED THERE (CYLINDER)
MOV CL, 2 ;SECTOR WE WANT TO LOAD, ITS SECTOR 2 BEACUSE THE ROOT DIR. LOCATED THERE
MOV DH, 1 ;HEAD WE WANT TO LOAD, ITS HEAD 1 BEACUSE THE ROOT DIR. LOCATED THERE
PUSHA ;TO BE ABLE TO RETRY TO LOAD ROOT DIR. IF INT 13H FAILED
LOAD_RD:
INT 13H
JNC LOAD_RD_DONE ;IF WE ARRIVE HERE, THATS MEAN THAT THE ROOT DIR. LOADED SUCCESSFULLY
CALL RESET_DRIVE ;RESET FLOPPY FUNCTION CALL
JMP LOAD_RD ;RETRY IF INT 13H FAILED
LOAD_RD_DONE:
POPA
;NOW WE WILL SEARCH IN THE ROOT DIR. TABLE IF IT CONTAINS THE DESIRED FILE NAME WHICH IS KERNEL.BIN
;WE WILL USE CMPSB INSTRUCTION THAT COMPARES THE VALUE OF DS:SI AND ES:DI
;ES AND DS ARE ALREADY SET
;THE SEARCH WILL BE LIMITED TO SEARCH AMONG 11 BYTES BECAUSE THE FILE NAME IS 11 BYTES
MOV DI, TEMP ;THE RESULT WE GOT (THE ENTRY)
MOV CX, 224 ;THE MAX. POSSIBLE FILE NUMBER THAT WE COULD HAVE IS 224 SO WE LIMIT THE SEARCH TO IT (THE VALUE THAT WILL BE DECREASED WHILE LOOPING)
FIND_KERNEL:
PUSH CX ;PUSH CX AND DI BECAUSE THEY HELD IMPORTANT DATA THAT WE DONT WANT TO LOSE
POP DX
MOV SI, FILE_NAME ;THE VALUE THAT WE WILL COMPARE THE RESULT OF ROOT DIR. TO FIND
MOV CX, 11 ;TO REPEATE THE SEARCH PROCESS 11 TIMES(THE FILE NAME LENGTH)
REP CMPSB ;COPMARES SI WITH DI
JE FOUND_KERNEL ;IF WO GO TO THE NEXT LINE, THAT MEANS THAT THE KERNEL IS NOT FOUNDED YET
;AND SINCE DI IS POINTS TO THE FIRST ENTRY, WE NEED TO MOVE TO THE NEXT ONE BY ADDING 32
ADD AX, 32
MOV DI, TEMP
ADD DI, AX
PUSH DX
POP CX
LOOP FIND_KERNEL
;IF WE ARE HERE, THEN THE KERNEL IS NOT EXISTS
;MOV SI, FAILED_TO_LOAD_KERNEL
;CALL ECHO
CLI
INT 18H ;CRASH AND HALT THE PROCESSOR
FOUND_KERNEL: ;IF WE FOUND THE KERNEL WE WILL BE HERE
;NOW WE HAVE THE ENTRY POINT FOR THE KERNEL SAVED IN DL REGISTER
;WE GOT THE KERNEL FROM THE FIRST 11 BYTES SO WE NEED TO ADD 15 TO GET TO THE 26 BYTES
;THE FIRST SECTOR IS LOCATED AT 26 AND 27 SO WE MUST ADD 15 TO LOAD THE KERNEL IN THE FIRST SECTOR
MOV AX, WORD [DI+15] ;WORD ADDED TO COPY BOTH 26 AND 27 BYTES TO AX, THE WORD IS 2 BYTES
MOV [ENTERY_POINT], AX
;2- SETTING UP AND LOADING THE FAT
MOV AX, 1
MOV BX, TEMP ;THE TEMP STORAGE FOR THE DATA WILL BE READED OR LOADED
CALL LOG_TO_HTS
MOV AH, 2 ;THE FUNCTION CODE FOR LOADING ROOT DIR.
MOV AL, 9 ;THE SIZE OF THE ROOT DIR. THE ROOT DIR. = 14 AND WE WANT TO LOAD IT ALL SO AL=14
PUSHA ;TO BE ABLE TO RETRY TO LOAD ROOT DIR. IF INT 13H FAILED
LOAD_FAT:
INT 13H
JNC LOAD_FAT_DONE ;IF WE ARRIVE HERE, THATS MEAN THAT THE FAT LOADED SUCCESSFULLY
CALL RESET_DRIVE ;RESET FLOPPY FUNCTION CALL
JMP LOAD_FAT ;RETRY IF INT 13H FAILED
LOAD_FAT_DONE: ;IF LOADING FAT DONE SUCCESSFULLY, WE WILL BE HERE
MOV AH, 2
MOV AL, 1
PUSH AX
LOAD_SECTOR: ;ROOT DIR. GIVES US A DATA SECTOR AND WE WANT A LOGICAL SECTOR, WE WILL DO IT HERE
MOV AX, WORD [ENTERY_POINT]
ADD AX, 31 ;31 ADDED TO DONE THE CONVERTION
CALL LOG_TO_HTS ;COVERTS THE LOGICAL SECTORS INTO HEAD TRACK SECTORS
MOV AX, 2000H
MOV ES, AX
MOV BX, WORD[OFFSET_]
POP AX
PUSH AX
INT 13H
JNC GET_NEXT
CALL RESET_DRIVE
JMP LOAD_SECTOR
GET_NEXT:
MOV AX, [ENTERY_POINT]
MOV DX, 0
MOV BX, 6
MUL BX
MOV BX, 4
DIV BX
MOV SI, TEMP
ADD SI, AX
MOV AX, WORD[SI]
OR DX, DX
JZ EVEN
ODD:
SHR AX, 4
JMP SHORT COMP_SECTOR
EVEN:
AND AX, 0FFFH
COMP_SECTOR:
MOV WORD [ENTERY_POINT], AX
CMP AX, 0FF8H
JAE END
ADD WORD[OFFSET_], 512
JMP LOAD_SECTOR
END:
;MOV SI, KERNEL_LOADED_MSG
CALL ECHO
CALL WAIT_FOR_KEY
POP AX
MOV DL, BYTE[BOOT_DEVICE]
JMP 2000H:0000H
OFFSET_ DW 0
ALL_SECTORS DW 18
FACES DW 2
ENTERY_POINT DW 0
;FAILED_TO_LOAD_KERNEL DB "Error, Cannot Load The Kernel. Booting Process Aborted;",0
BOOT_DEVICE DB 0
FILE_NAME DB "KERNEL BIN"
;WELCOME_MSG DB "Litesoft bootloader Copyright (C) 2012-2016 By Mohamed El Sayed;",0
;KERNEL_LOADED_MSG DB "Kernel Loaded, Press Any Key To Continue...",0
TIMES 510 - ($-$$) DB 0 ;LOOK FOR EVERY SINGLE EMPTY BIT AND FILL IT WITH ZERO
;TILL THE BOOTLOADER SIZE BE 512 BYTE
DW 0xAA55 ;THE BOOT SIGNETUARE, ALWAYS THE SAME
TEMP: ;HERE IN BYTE 513 WE HAVE SOME MEMORY THAT WILL NOT BE EXECUTED
;AND WE CAN USE IT AS A TEMP MEMORY
我计划使用的方法是使用 dd 创建一个软盘镜像并将我的引导加载程序写入第一个扇区然后挂载它并将我的内核复制到它。
我用过的命令
1- mkdosfs -C floppy.flp 1440
,此命令创建软盘镜像
2- dd status=noxfer conv=notrunc if=boot.bin of=floppy.flp
,这个命令将bootloader烧录到第一个扇区
这些命令非常有效,我的引导加载程序在第一个扇区成功创建了软盘镜像
当我尝试使用以下命令挂载软盘镜像以将内核复制到其中时出现问题
rm -rf tmp-loop
mkdir tmp-loop && mount -o loop -t vfat floppy.flp tmp-loop && cp kernel.bin tmp-loop/
每次我尝试挂载软盘镜像时都会出现此错误
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
此错误的解决方案是什么?我正在使用 Ubuntu 16.04。
最佳答案
你缺少合适的BIOS Parameter Block(BPB)在引导加载程序的开头。此结构包含某些 BIOS 使用/更新的信息;引导加载程序可以使用它来读取未分区媒体(如软盘)上的 FAT 文件系统;必须存在于 mount
之类的软件中,以确定虚拟软盘镜像代表的媒体类型。在FAT12的情况下在未分区的媒体(如软盘)上,文件系统信息存在于主引导记录的 BPB 中。一个常见的布局是 DOS 3.4 EBPB它可能看起来像:
start:
JMP MAIN
TIMES 3-($-$$) DB 0x90 ; Support 2 or 3 byte encoded JMPs before BPB.
; Dos 3.4 EBPB 1.44MB floppy
OEMname: db "mkfs.fat" ; mkfs.fat is what OEMname mkdosfs uses
bytesPerSector: dw 512
sectPerCluster: db 1
reservedSectors: dw 1
numFAT: db 2
numRootDirEntries: dw 224
numSectors: dw 2880
mediaType: db 0xf0
numFATsectors: dw 9
sectorsPerTrack: dw 18
numHeads: dw 2
numHiddenSectors: dd 0
numSectorsHuge: dd 0
driveNum: db 0
reserved: db 0
signature: db 0x29
volumeID: dd 0x2d7e5a1a
volumeLabel: db "NO NAME "
fileSysType: db "FAT12 "
基于上面的 DOS 3.4 EBPB 和您的 boot.asm
代码,这个 BPB 代表一个类似的到使用 mkdosfs -C floppy.flp 1440
生成的 1.44MB 软盘引导扇区:
bits 16
section .text
start:
JMP MAIN
TIMES 3-($-$$) DB 0x90 ; Support 2 or 3 byte encoded JMPs before BPB.
; Dos 3.4 EBPB 1.44MB floppy
OEMname: db "mkfs.fat" ; mkfs.fat is what OEMname mkdosfs uses
bytesPerSector: dw 512
sectPerCluster: db 1
reservedSectors: dw 1
numFAT: db 2
numRootDirEntries: dw 224
numSectors: dw 2880
mediaType: db 0xf0
numFATsectors: dw 9
sectorsPerTrack: dw 18
numHeads: dw 2
numHiddenSectors: dd 0
numSectorsHuge: dd 0
driveNum: db 0
reserved: db 0
signature: db 0x29
volumeID: dd 0x2d7e5a1a
volumeLabel: db "NO NAME "
fileSysType: db "FAT12 "
WAIT_FOR_KEY:
MOV AH, 00H
INT 16H
RET
CLEAR:
MOV AH, 0H ;CHANGING THE VIDEO MODE TO CLEAR THE SCREEN
MOV AL, 03H ;VIDEO MODE COD
INT 10H
RET
LOG_TO_HTS:
PUSH BX
PUSH AX
MOV BX, AX
MOV DX, 0
DIV WORD[ALL_SECTORS]
ADD DL, 01H
MOV CL, DL
MOV AX, BX
MOV DX, 0
DIV WORD [ALL_SECTORS]
MOV DX, 0
DIV WORD[FACES]
MOV DH, DL
MOV CH, AL
POP AX
POP BX
MOV DL, BYTE [BOOT_DEVICE]
RET
ECHO: ;-=-=-=PRINTING FUNCTION =-=-=-;
LODSB ;MOV ONE CHAR FROM SI TO AL AND DELETE IT FROM SI
CMP AL, 0 ;CHECK IF THE VALUE IN AL=0, IF ITS ZERO THEN WE
JE DONE ;WE ARE DONE PRINTING, AND JUMP BACK TO THE MAIN FUNCTION
CMP AL, 59
JE NEWLINE
MOV AH, 0EH ;THE FUNCTION CODE FOR PRINTING (TELETYPE PRINTING)
INT 10H ;BIOS CALL
JMP ECHO ;IF WE ARRIVED TO THIS LINE THATS MEAN WE ARE NOT DONE WITH
;PRINTING THE WHOLE STREING SO JUMP BACK AND COMPLETE THE PROCESS
DONE: ;LABEL CONTAINS ONE INSTRUCTION TO JUMP BACK TO THE LINE
RET ;WHERE WE CALLED THE ECHO FUNCTION
NEWLINE:
PUSHA
MOV AH, 0EH
MOV AL, 13
INT 10H
MOV AL, 10
INT 10H
POPA
RET
RESET_DRIVE: ;RESET FLOPPY DRIVE FUNCTION
MOV AX, 0 ;THE FUNCTION CODE TO RESET DRIVE
MOV DL, BYTE [BOOT_DEVICE] ;DRIVE ID TO RESET
INT 13H
RET
MAIN: ;THE MAIN FUNCTION LABEL
;TO BEGIN LOADING EXTERNAL FILE LIKE KERNEL SOME THINGS MUST BE DONE LIKE :
;1- SETTING UP THE STACK
;2- SETTING UP THE SEGMENTS
;3- SPECIFY THE BOOT DRIVE
;SETTING UP THE STACK
CLI ;CLEAR INTERRUPTS TO SET THE SEGMENT
XOR AX, AX ;SET THE BOTTOM OF THE STACK
MOV SS, AX
MOV SP, 0XFFFF ;SET THE TOP OF THE STACK
STI ;RESTORE THE INTERRUPTS
;SETTING UP THE SEGMENTS
MOV AX, 07C0H
MOV DS, AX
MOV ES, AX
;AFTER SETTING UP SEGMENTS AND STACK, YOU ARE FREE TO CODE WHAT EVER YOU WANT
;THE CPU WILL RECOGNISE YOUR CODE AS A BOOTLOADER
CALL CLEAR
;MOV SI, WELCOME_MSG
;CALL ECHO
MOV [BOOT_DEVICE], DL ;SAVE THE DRIVE ID TO USE IT LATER
;WE WILL USE IN 13H TO LOAD ROOT DIR. THAT WE NEED TO LOAD THE FIRST SECTOR OF THE KERNEL
;THEN WE WILL LOAD FAT TO LOAD THE WHOLE KERNEL SINCE THE FILE LOAD PROCESS CONSISTS OF 3 STEPS
;1- LOAD THE FISRT SECTOR OF THE FILE
;2- LOAD THE WHOLE FILE AND COPY IT INTO RAM
;3- EXCUTE THE FILE
;THE ROOT DIR. AND FAT ARE LOCATED IN SOMEWHERE ON THE FLOPPY DRIVE AS FOLLOWS
;1- SETTING UP AND LOADING THE ROOT DIR.
MOV AH, 02H ;THE FUNCTION CODE FOR LOADING ROOT DIR.
MOV AL, 14 ;THE SIZE OF THE ROOT DIR. THE ROOT DIR. = 14 AND WE WANT TO LOAD IT ALL SO AL=14
MOV BX, TEMP ;THE TEMP STORAGE FOR THE DATA WILL BE READED OR LOADED
MOV CH, 0 ;TRACK WE WANT TO LOAD, ITS TRACK 0 BEACUSE THE ROOT DIR. LOCATED THERE (CYLINDER)
MOV CL, 2 ;SECTOR WE WANT TO LOAD, ITS SECTOR 2 BEACUSE THE ROOT DIR. LOCATED THERE
MOV DH, 1 ;HEAD WE WANT TO LOAD, ITS HEAD 1 BEACUSE THE ROOT DIR. LOCATED THERE
PUSHA ;TO BE ABLE TO RETRY TO LOAD ROOT DIR. IF INT 13H FAILED
LOAD_RD:
INT 13H
JNC LOAD_RD_DONE ;IF WE ARRIVE HERE, THATS MEAN THAT THE ROOT DIR. LOADED SUCCESSFULLY
CALL RESET_DRIVE ;RESET FLOPPY FUNCTION CALL
JMP LOAD_RD ;RETRY IF INT 13H FAILED
LOAD_RD_DONE:
POPA
;NOW WE WILL SEARCH IN THE ROOT DIR. TABLE IF IT CONTAINS THE DESIRED FILE NAME WHICH IS KERNEL.BIN
;WE WILL USE CMPSB INSTRUCTION THAT COMPARES THE VALUE OF DS:SI AND ES:DI
;ES AND DS ARE ALREADY SET
;THE SEARCH WILL BE LIMITED TO SEARCH AMONG 11 BYTES BECAUSE THE FILE NAME IS 11 BYTES
MOV DI, TEMP ;THE RESULT WE GOT (THE ENTRY)
MOV CX, 224 ;THE MAX. POSSIBLE FILE NUMBER THAT WE COULD HAVE IS 224 SO WE LIMIT THE SEARCH TO IT (THE VALUE THAT WILL BE DECREASED WHILE LOOPING)
FIND_KERNEL:
PUSH CX ;PUSH CX AND DI BECAUSE THEY HELD IMPORTANT DATA THAT WE DONT WANT TO LOSE
POP DX
MOV SI, FILE_NAME ;THE VALUE THAT WE WILL COMPARE THE RESULT OF ROOT DIR. TO FIND
MOV CX, 11 ;TO REPEATE THE SEARCH PROCESS 11 TIMES(THE FILE NAME LENGTH)
REP CMPSB ;COPMARES SI WITH DI
JE FOUND_KERNEL ;IF WO GO TO THE NEXT LINE, THAT MEANS THAT THE KERNEL IS NOT FOUNDED YET
;AND SINCE DI IS POINTS TO THE FIRST ENTRY, WE NEED TO MOVE TO THE NEXT ONE BY ADDING 32
ADD AX, 32
MOV DI, TEMP
ADD DI, AX
PUSH DX
POP CX
LOOP FIND_KERNEL
;IF WE ARE HERE, THEN THE KERNEL IS NOT EXISTS
;MOV SI, FAILED_TO_LOAD_KERNEL
;CALL ECHO
CLI
INT 18H ;CRASH AND HALT THE PROCESSOR
FOUND_KERNEL: ;IF WE FOUND THE KERNEL WE WILL BE HERE
;NOW WE HAVE THE ENTRY POINT FOR THE KERNEL SAVED IN DL REGISTER
;WE GOT THE KERNEL FROM THE FIRST 11 BYTES SO WE NEED TO ADD 15 TO GET TO THE 26 BYTES
;THE FIRST SECTOR IS LOCATED AT 26 AND 27 SO WE MUST ADD 15 TO LOAD THE KERNEL IN THE FIRST SECTOR
MOV AX, WORD [DI+15] ;WORD ADDED TO COPY BOTH 26 AND 27 BYTES TO AX, THE WORD IS 2 BYTES
MOV [ENTERY_POINT], AX
;2- SETTING UP AND LOADING THE FAT
MOV AX, 1
MOV BX, TEMP ;THE TEMP STORAGE FOR THE DATA WILL BE READED OR LOADED
CALL LOG_TO_HTS
MOV AH, 2 ;THE FUNCTION CODE FOR LOADING ROOT DIR.
MOV AL, 9 ;THE SIZE OF THE ROOT DIR. THE ROOT DIR. = 14 AND WE WANT TO LOAD IT ALL SO AL=14
PUSHA ;TO BE ABLE TO RETRY TO LOAD ROOT DIR. IF INT 13H FAILED
LOAD_FAT:
INT 13H
JNC LOAD_FAT_DONE ;IF WE ARRIVE HERE, THATS MEAN THAT THE FAT LOADED SUCCESSFULLY
CALL RESET_DRIVE ;RESET FLOPPY FUNCTION CALL
JMP LOAD_FAT ;RETRY IF INT 13H FAILED
LOAD_FAT_DONE: ;IF LOADING FAT DONE SUCCESSFULLY, WE WILL BE HERE
MOV AH, 2
MOV AL, 1
PUSH AX
LOAD_SECTOR: ;ROOT DIR. GIVES US A DATA SECTOR AND WE WANT A LOGICAL SECTOR, WE WILL DO IT HERE
MOV AX, WORD [ENTERY_POINT]
ADD AX, 31 ;31 ADDED TO DONE THE CONVERTION
CALL LOG_TO_HTS ;COVERTS THE LOGICAL SECTORS INTO HEAD TRACK SECTORS
MOV AX, 2000H
MOV ES, AX
MOV BX, WORD[OFFSET_]
POP AX
PUSH AX
INT 13H
JNC GET_NEXT
CALL RESET_DRIVE
JMP LOAD_SECTOR
GET_NEXT:
MOV AX, [ENTERY_POINT]
MOV DX, 0
MOV BX, 6
MUL BX
MOV BX, 4
DIV BX
MOV SI, TEMP
ADD SI, AX
MOV AX, WORD[SI]
OR DX, DX
JZ EVEN
ODD:
SHR AX, 4
JMP SHORT COMP_SECTOR
EVEN:
AND AX, 0FFFH
COMP_SECTOR:
MOV WORD [ENTERY_POINT], AX
CMP AX, 0FF8H
JAE END
ADD WORD[OFFSET_], 512
JMP LOAD_SECTOR
END:
;MOV SI, KERNEL_LOADED_MSG
CALL ECHO
CALL WAIT_FOR_KEY
POP AX
MOV DL, BYTE[BOOT_DEVICE]
JMP 2000H:0000H
OFFSET_ DW 0
ALL_SECTORS DW 18
FACES DW 2
ENTERY_POINT DW 0
;FAILED_TO_LOAD_KERNEL DB "Error, Cannot Load The Kernel. Booting Process Aborted;",0
BOOT_DEVICE DB 0
FILE_NAME DB "KERNEL BIN"
;WELCOME_MSG DB "Litesoft bootloader Copyright (C) 2012-2016 By Mohamed El Sayed;",0
;KERNEL_LOADED_MSG DB "Kernel Loaded, Press Any Key To Continue...",0
TIMES 510 - ($-$$) DB 0 ;LOOK FOR EVERY SINGLE EMPTY BIT AND FILL IT WITH ZERO
;TILL THE BOOTLOADER SIZE BE 512 BYTE
DW 0xAA55 ;THE BOOT SIGNETUARE, ALWAYS THE SAME
TEMP: ;HERE IN BYTE 513 WE HAVE SOME MEMORY THAT WILL NOT BE EXECUTED
;AND WE CAN USE IT AS A TEMP MEMORY
如果您从此代码生成boot.bin
并将其放在软盘镜像中并使用命令显示文件类型信息:
file floppy.flp
如果它有效,它应该产生这样的东西:
floppy.flp: , code offset 0x99+3, OEM-ID "mkfs.fat", root entries 224, sectors 2880 (volumes <=32 MB) , sectors/FAT 9, sectors/track 18, serial number 0x2d7e5a1a, unlabeled, FAT (12 bit), followed by FAT
如果你得到类似的输出,它应该可以用 mount
命令挂载。
您可能已经注意到,EBPB/BPB 中的数据可用于在 FAT12 文件系统中导航。
关于linux - 创建包含引导加载程序和内核的可引导软盘时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39235799/
我正在使用 node.js 和 mocha 单元测试,并且希望能够通过 npm 运行测试命令。当我在测试文件夹中运行 Mocha 测试时,测试运行成功。但是,当我运行 npm test 时,测试给出了
我的文本区域中有这些标签 ..... 我正在尝试使用 replaceAll() String 方法替换它们 text.replaceAll("", ""); text.replaceAll("", "
早上好,我是 ZXing 的新手,当我运行我的应用程序时出现以下错误: 异常Ljava/lang/NoClassDefFoundError;初始化 ICOM/google/zxing/client/a
我正在制作一些哈希函数。 它的源代码是... #include #include #include int m_hash(char *input, size_t in_length, char
我正在尝试使用 Spritekit 在 Swift 中编写游戏。目的是带着他的角色迎面而来的矩形逃跑。现在我在 SKPhysicsContactDelegate (didBegin ()) 方法中犯了
我正在尝试创建一个用于导入 CSV 文件的按钮,但出现此错误: actionPerformed(java.awt.event.ActionEvent) in cannot implement
请看下面的代码 public List getNames() { List names = new ArrayList(); try { createConnection(); Sta
我正在尝试添加一个事件以在“dealsArchive”表中创建一个条目,然后从“deals”表中删除该条目。它需要在特定时间执行。 这是我正在尝试使用的: DELIMITER $$ CREATE EV
我试图将两个存储过程的表结果存储到 phpmyadmin 例程窗口中的单个表中,这给了我 mariadb 语法错误。单独调用存储过程给出了结果。 存储过程代码 BEGIN CREATE TABLE t
我想在 videoview 中加载视频之前有一个进度条。但是我收到以下错误。我还添加了所有必要的导入。 我在 ANDROID 中使用 AIDE 这是我的代码 public class MainActi
我已经使用了 AsyncTask,但我不明白为什么在我的设备 (OS 4.0) 上测试时仍然出现错误。我的 apk 构建于 2.3.3 中。我想我把代码弄错了,但我不知道我的错误在哪里。任何人都请帮助
我在测试 friend 网站的安全性时,通过在 URL 末尾添加 ' 发现了 SQL 注入(inject)漏洞该网站是用zend框架构建的我遇到的问题是 MySQL -- 中的注释语法不起作用,因此页
我正在尝试使用堆栈溢出答案之一的交互式信息窗口。 链接如下: interactive infowindow 但是我在代码中使用 getMap() 时遇到错误。虽然我尝试使用 getMapAsync 但
当我编译以下代码时出现错误: The method addMouseListener(Player) is undefined for the type Player 代码: import java.
我是 Android 开发的初学者。我正在开发一个接收 MySql 数据然后将其保存在 SQLite 中的应用程序。 我将 Json 用于同步状态,以便我可以将未同步数据的数量显示为要同步的待处理数据
(这里是Hello world级别的自动化测试人员) 我正在尝试下载一个文件并将其重命名以便于查找。我收到一个错误....这是代码 @Test public void allDownload(
我只是在写另一个程序。并使用: while (cin) words.push_back(s); words是string的vector,s是string。 我的 RAM 使用量在 4 或 5
我是 AngularJS 的新手,我遇到了一个问题。我有一个带有提交按钮的页面,当我单击提交模式时必须打开并且来自 URL 的数据必须存在于模式中。现在,模式打开但它是空的并且没有从 URL 获取数据
我正在尝试读取一个文件(它可以包含任意数量的随机数字,但不会超过 500 个)并将其放入一个数组中。 稍后我将需要使用数组来做很多事情。 但到目前为止,这一小段代码给了我 no match for o
有些人在使用 make 命令进行编译时遇到了问题,所以我想我应该在这里尝试一下,我已经在以下操作系统的 ubuntu 32 位和挤压 64 位上尝试过 我克隆了 git 项目 https://gith
我是一名优秀的程序员,十分优秀!