-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootwrt.asm
71 lines (71 loc) · 1.75 KB
/
bootwrt.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
startwrite:
push cs cs
pop ds es
xor dx,dx
xor cx,cx
mov dl,80h
mov cl,1
mov bx,offset bufwrite
mov ax,201h
int 13h
add bx,1beh
mov si,bx
mov cx,4
lbootwrite:
cmp byte ptr ds:[si],80h
je elwr
add si,10h
loop lbootwrite
jmp err_wr
elwr:
mov ax,ds:[si]
mov word ptr ds:dx_,ax
mov ax,ds:[si][2]
mov word ptr ds:[cx_],ax
mov ax,3d00h
mov dx,offset filenn
int 21h
mov bx,ax
jc err_wr
mov ah,3fh
mov cx,200h
mov dx,offset bufwrite
int 21h
jc err_wr
cmp ax,cx
jnz err_wr
mov ah,3eh
int 21h
jc err_wr
mov cx,word ptr ds:[cx_]
mov dx,word ptr ds:[dx_]
mov bx,offset bufwrite
mov ax,301h
int 13h
jc fatal_wr
jmp okwrit_
exitwr:
ret
err_wr:
; mov dx,offset error_write
wr:
; push cs
; pop ds
; mov ah,09h
; int 21h
jmp exitwr
okwrit_:
; mov dx,offset ok_write
jmp wr
fatal_wr:
; mov dx,offset fatal
jmp wr
ok_write db 10,13,'Ok. $'
error_write db 10,13,'**** Error **** $'
fatal db 10,13,'***** Warning ! Fatal error. Don^t reboot ! ***** $'
filenn db 'boot.sec',0
cx_ dw ?
dx_ dw ?
bufwrite db 200h dup (?)
db '$'
;end startwrite