-
Notifications
You must be signed in to change notification settings - Fork 0
/
boot9.asm
50 lines (32 loc) · 994 Bytes
/
boot9.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
org 0x7c00 ;Store program/data at this point in memory (16 bit - 48 kB, 32 bit - 4 GB ...)
LOAD_ADDR EQU 0x9000 ;create a variable called LOAD_ADDR, this is where the kernel code is at
jmp entry
;ax is a 16-bit register
entry:
mov ax, 0
mov ss, ax ;reset ss register
mov ds, ax ;reset ds register
mov es, ax ;reset es register
mov si, ax
; jmp error
mov BX, LOAD_ADDR ;ES:BX buffer to store floppy disk read
mov CH, 1 ;cylinder to be read = 1
mov DH, 0 ;disk head to be read from = 0
mov CL, 1 ;sector to be read = 2
mov AH, 0x02 ;read floppy command
mov AL, 18 ;the number of sectors to be read
mov DL, 0x00 ;number of disks to read
readFloppy:
cmp byte [load_count], 0
je beginLoad
INT 0x13 ;interrupter BIOS for disk reading
inc CH
dec byte [load_count]
jc fin
jmp readFloppy
beginLoad:
jmp LOAD_ADDR
load_count db 2 ;we need to read two cylinders
fin:
HLT ;halt till key press
jmp fin