This commit is contained in:
Kartik K. Agaram 2021-03-01 22:41:13 -08:00
parent cfeb71c898
commit ce64fef18f
3 changed files with 18 additions and 5 deletions

View File

@ -143,6 +143,20 @@
cd 13 # int 13h, BIOS disk service
0f 82 9b 00 # jump-if-carry disk_error [label]
# load two more tracks of disk into addresses [0x27400, 0x37000)
b4 02 # ah <- 2 # read sectors from disk
# dl comes conveniently initialized at boot time with the index of the device being booted
b5 00 # ch <- 0 # cylinder 0
b6 02 # dh <- 2 # track 0
b1 01 # cl <- 1 # first sector, 1-based
b0 7e # al <- 126 # number of sectors to read = 2*63
# address to write sectors to = es:bx = 0x17800
bb 80 17 # bx <- 0x1780 [label]
8e c3 # es <- bx
bb 00 00 # bx <- 0
cd 13 # int 13h, BIOS disk service
0f 82 9b 00 # jump-if-carry disk_error [label]
# reset es
bb 00 00 # bx <- 0
8e c3 # es <- bx
@ -172,9 +186,8 @@
ea 00 7d 08 00 # far jump to initialize_32bit_mode after setting cs to the record at offset 8 in the gdt (gdt_code) [label]
# padding
# 76:
00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
# 8e:
00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

View File

@ -39,7 +39,7 @@ apps/hex < baremetal/boot.hex > boot.bin
cat boot.bin a.bin > disk.bin
dd if=disk.bin of=disk.img conv=notrunc
if [ `stat --printf="%s" disk.bin` -ge 129024 ] # 4 tracks * 63 sectors per track * 512 bytes per sector (keep this sync'd with boot.hex)
if [ `stat --printf="%s" disk.bin` -ge 193536 ] # 6 tracks * 63 sectors per track * 512 bytes per sector (keep this sync'd with boot.hex)
then
echo "disk.bin won't all be loaded on boot"
exit 1

View File

@ -33,7 +33,7 @@ dd if=/dev/zero of=disk.img count=20160 # 512-byte sectors, so 10MB
cat boot.bin a.bin > disk.bin
dd if=disk.bin of=disk.img conv=notrunc
if [ `stat --printf="%s" disk.bin` -ge 129024 ] # 4 tracks * 63 sectors per track * 512 bytes per sector (keep this sync'd with boot.hex)
if [ `stat --printf="%s" disk.bin` -ge 193536 ] # 6 tracks * 63 sectors per track * 512 bytes per sector (keep this sync'd with boot.hex)
then
echo "disk.bin won't all be loaded on boot"
exit 1