cpu -> bios -> floppy(first sector to 0x7c00, and pc to 0x7c00)
0x7c00会加载第一扇区,到0x7dff。所以0x7e00到0x9fbff没有人用 18个扇区换柱面
这里的软盘是10个柱面,每个柱面18个扇区
每个扇区为512个字节
nasm EQU used to define constant.
putLoop:
mov al, [si] ; just check '\0'
cmp al, 0
je fi ; this is the dnd
mov ah, 0xe ; ah is the color
int 0x10 ; 0x10 is put a char to screen, bx, is the color, al is the charactor
add si, 1
jmp putLoop
; will read to [es:bx]
mov ax, 0x7e00 ; jiazai 加载地址
mov es, ax ; read dest memory location
mov bl, 0 ; 1st floppy disk ( "drive A:" )
mov ah, 2 ; Read Sectors From Drive
; sector 扇面
; cylinder 柱面
; Register CX contains both the cylinder number (10 bits, possible values are 0 to 1023)
; and the sector number (6 bits, possible values are 1 to 63).
; Cylinder and Sector bits are numbered below:
; CX = ---CH--- ---CL---
; cylinder : 76543210 98
; sector : 543210
mov cx, 0 ; , start from 1, value 1 to 63
mov ch, 0 ; 柱面
mov cl, 0 ; 扇区
mov dh, 0 ; head 0 or 1
mov dl, 0 ; Devier, but for now, I don't know what's this
mov al, 1 ; setors to read count
mov bx, 0
int 0x13 ; 磁盘读写方法
jc error ; carry is has error
文件名写到0x002600 文件内容写到0x004200
柱面0磁头0扇区1
The content is write to floopy offset 0x004200. the ipl load floppy at location 0x8000, so we need jump to 0xc200
0x7c00 - 0x7dff(521 byte) is the boot location, bios will read the floppy first secotr to here, and jmp to here!
0x8000 + 0x4200 = 0xc200