NHellFire/dban

Better MBR code

Himotestaaja opened this issue · 2 comments

ORG 0x7C00 ; Bootcode

; get cursor position
; dh = row
; dl = column
mov ah,0x03
mov bh,0
int 0x10

; write string
mov ah,0x13
mov al,1 ; write mode (advance cursor, ASCII string)
mov bl,0xF ; attribute (white on black)
mov cx,output_len ; string length
push cs
pop es
mov bp,output ; string
int 0x10


; hang indefinitely
idle_loop:
hlt ; if there is nothing to do, then do nothing
jmp idle_loop ; and do it forever



output:
    db 0xA,0xD, "DBAN fingerprint"
    db 0xA,0xD, "Model: #MODEL# - Serial: #SERIAL#"
    db 0xA,0xD, "Wipe finished at: #DATE# - #RESULT#"
    db 0xA,0xD, "Method: #METHOD#"
output_len: equ $ - output



; Keep this at the end
; Will pad out to 510 Bytes, then add MBR signature
; Total length 512 Bytes
; As is, program is 135 Bytes (with signature)
; Allows 414 Bytes for generated text (placeholders are 37 Bytes)

times 510-($-$$) db 0
dw 0xAA55

Features:

  • Does not clear a screen. The screen may show other interesting messages.
  • HLT instruction reduces power consumption.
  • Tells the user where these messages are coming from.

Bug fix:

  • Does not leave DH and DL undefined state.

Thanks, I'll check this when I have time to.

Just tried it, my test system won't boot this. Also some systems clear the screen before booting anyway.