Skip to content

Commit 72ae5b8

Browse files
acomodo msg error
1 parent e6d996b commit 72ae5b8

4 files changed

Lines changed: 37 additions & 29 deletions

File tree

.gdb_history

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
b *0x8000
2-
continue
3-
dashboard
4-
disas 0x8153 0x8200
5-
disas 0x8153, 0x8200
6-
disas 0x8153, 0x81F0
71
si
82
quir
93
quit
@@ -254,3 +248,9 @@ quit
254248
b *0x8000
255249
continue
256250
quit
251+
b *0x8000
252+
continue
253+
print/x $ef;ags
254+
print/x $eflags
255+
print/x $cr0
256+
quit

asm/bios/mbr.asm

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,13 @@ entry:
5959

6060

6161
;;==============================================================================
62-
;; errors
62+
;; failure | abort boot with error notification
63+
;;==============================================================================
64+
;; Argument:
65+
;; -- si: string.
6366
;;==============================================================================
6467

65-
notify_ext_not_supported:
66-
mov si, msg_no
68+
failure:
6769
call print
6870

6971
.halt:
@@ -105,12 +107,12 @@ diskcpy:
105107
;;==============================================================================
106108

107109
cpySec:
110+
push ax ;; Reg is overriden by bios in 0x42 service return.
108111
push dx
109112
push si
110113
push di
111114

112115
.cpy:
113-
push ebx ;; Backup sectorNumber.
114116
mov di, sp ;; Base of disk address packet.
115117

116118
;; Build disk address packet.
@@ -123,34 +125,33 @@ cpySec:
123125

124126
mov si, sp
125127
mov dl, [drvNum]
126-
mov ah, 42h ;; Extended read.
128+
mov ah, 0x42 ;; Extended read.
127129
int 0x13
128130

129-
mov sp, di ;; Clean stack.
130-
pop ebx
131-
132-
jnc read_ok ; jump if no error
131+
mov sp, di ;; Clean stack.
133132

134-
push ax
135-
xor ah, ah ; else, reset and retry
136-
int 0x13
137-
pop ax
138-
jmp .cpy
133+
;;jnc .success ;; Check for errors.
139134

140-
read_ok:
141-
add ebx, 1 ; increment next sector with carry
142-
add cx, 512 ; Add bytes per sector
143-
jnc no_incr_es ; if overflow...
135+
.failure:
136+
mov si, msg_err ;; TO-DO: retry before failure. Can also report error co
137+
;; de in ah.
138+
jmp failure
139+
140+
.success:
141+
add ebx, 1 ;; increment next sector with carry
142+
add cx, 512 ;; Add bytes per sector
143+
jnc no_incr_es ;; if overflow...
144144

145145
incr_es:
146146
mov dx, es
147-
add dh, 0x10 ; ...add 1000h to ES
147+
add dh, 0x10 ;; ...add 1000h to ES
148148
mov es, dx
149149

150150
no_incr_es:
151151
pop di
152152
pop si
153153
pop dx
154+
pop ax
154155

155156
ret
156157

@@ -170,13 +171,19 @@ extensionTest:
170171
mov bx, 55aah ;; Required signature.
171172
mov dl, [drvNum]
172173
int 0x13
173-
jc notify_ext_not_supported
174+
jc .unsupported
174175
cmp bx, 0xaa55
175-
jne notify_ext_not_supported
176+
jne .unsupported
176177

177178
mov si, msg_ok
178179
call print
180+
jmp .fin
181+
182+
.unsupported:
183+
mov si, msg_no
184+
jmp failure
179185

186+
.fin:
180187
ret
181188

182189

@@ -210,8 +217,9 @@ print:
210217
msg_extSupport: db "Verifying bios ext support..", 0
211218
msg_no: db " no", 13, 10, 0
212219
msg_load: db "Reading disk..", 0
213-
msg_ok: db " ok", 13, 10, 0
214-
msg_halt: db "Sys halted", 0
220+
msg_err: db " [error]", 13, 10, 0
221+
msg_ok: db " [ok]", 13, 10, 0
222+
msg_halt: db "System halted", 0
215223

216224
drvNum: db 0x00
217225

obj/mbr.o

160 Bytes
Binary file not shown.

out/mbr.sys

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)