-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbinloader.asm
159 lines (115 loc) · 2.11 KB
/
binloader.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
;;*******************************************************************
;;
;;
;; BootLoader do Bin S.O
;;
;; Carrega o Kernel do Bin S.O e a tabela de alocação de arquivos
;; do BinFS
;;
;;*******************************************************************
%define loc 0x1000 ;; Copiar Kernel
%define tabelabinfs 0x2000 ;; Copiar Tabela de alocação de arquivos do BinFS
%define drive 0x80 ;; Drive do Sistema
%define binkernel 3 ;; Setor onde se localiza o início do Kernel
%define setordatabela 2 ;; Setor onde se localiza a tabela
[bits 16]
[org 0]
jmp 0x7c0:inicio
inicio:
mov ax, cs
mov ds, ax
mov es, ax
mov al, 03h
mov ah, 0
int 10h
mov si, msg
call escrever
mov ax,0
int 16h
push ax
push bx
push cx
push dx
mov dx, 0
mov bh, 0
mov ah, 2
int 10h
mov ah, 6
mov al, 0
mov bh, 7
mov cx, 0
mov dh, 24
mov dl, 79
int 10h
mov ax, 3000
mov bx, 0
mov cx, ax
mov al, 182
out 43h, al
mov ax, cx
out 42h, al
mov al, ah
out 42h, al
in al, 61h
or al, 03h
out 61h, al
popa
pusha
in al, 61h
and al, 0FCh
out 61h, al
popa
pop dx
pop cx
pop bx
pop ax
mov ax, loc
mov es, ax
mov cl, binkernel
mov al, 3
call carregarsetor
mov ax, tabelabinfs
mov es, ax
mov cl, setordatabela
mov al, 1
call carregarsetor
jmp loc:0000
pronto:
jmp $
carregarsetor:
mov bx, 0
mov dl, drive
mov dh, 0
mov ch, 0
mov ah, 2
int 0x13
jc err
ret
err:
mov si, erro
call escrever
ret
escrever:
mov bp, sp
cont:
lodsb
or al, al
jz pnt
mov ah, 0x0e
mov bx, 0
int 10h
jmp cont
pnt:
mov sp, bp
ret
msg db "[ BinLoader - Gerenciador de Inicializacao do Bin S.O ]",10,13
db "*******************************************************",10,13
db "",10,13
db "Sistema Operacional Bin S.O carregado com sucesso.",10,13
db "",10,13
db "Pressione ENTER para continuar...",10,13
db "",10,13,0
erro db "Erro carregando. ",10,13,0
kerver db "0.1.1 Apollo",0
times 510 - ($-$$) db 0
dw 0xaa55