stuff and things
This commit is contained in:
commit
4b85060139
3 changed files with 146 additions and 0 deletions
90
boot.asm
Executable file
90
boot.asm
Executable file
|
@ -0,0 +1,90 @@
|
|||
format binary
|
||||
org 0x7c00
|
||||
use16
|
||||
|
||||
jmp short start
|
||||
nop
|
||||
|
||||
;; reserved for (E)BPB (which BIOS might scramble)
|
||||
;; you could also have one that *could* work
|
||||
times 0x3B db 0
|
||||
start:
|
||||
|
||||
;; setup segments
|
||||
;; setup stack
|
||||
;; trust nothing
|
||||
cld
|
||||
mov ax, 0
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
mov ss, ax
|
||||
mov sp, 0x7c00 ;stack down from our load address
|
||||
mov bp, sp
|
||||
|
||||
;; ensure VGA textmode
|
||||
mov ah, 0x00
|
||||
mov al, 0x03 ;Colour Text mode 3 80x25
|
||||
int 0x10
|
||||
|
||||
;; storeBootdiskNum
|
||||
mov [diskNum], dl
|
||||
|
||||
checkLBASupport:
|
||||
;; Set AH = 0x41
|
||||
;; BX = 0x55AA
|
||||
;; DL = drive
|
||||
;; INT 0x13
|
||||
|
||||
mov si, msg.lba
|
||||
mov ah, 0x41
|
||||
mov bx, 0x55AA
|
||||
int 0x13
|
||||
|
||||
jc msg.error
|
||||
test bx, 0xAA55
|
||||
jz msg.error
|
||||
test cx, cx
|
||||
jp msg.error
|
||||
|
||||
|
||||
getPartitionLBA:
|
||||
;; 1st partition entry at 0x1BE (16 bytes)
|
||||
;; LBA start 4bytes at 0x1BE + 0x08
|
||||
;; Sectors count 4bytes at 0x1BE + 0x0C
|
||||
|
||||
;; so uhmmmm, read those and use 'em to find next peace of data?
|
||||
;; Wait is my MBR one block that is read at once? Lol wait MBR
|
||||
;; is also part of my own current loaded memory!
|
||||
|
||||
|
||||
|
||||
nomoreThings:
|
||||
mov si, msg.nop
|
||||
jmp msg.ok
|
||||
endloop:
|
||||
nop
|
||||
jmp endloop
|
||||
|
||||
msg:
|
||||
.ok:
|
||||
mov ah, 0x20 ;greenblack
|
||||
jmp .prepare
|
||||
.error:
|
||||
mov ah, 0x47 ;redgray
|
||||
.prepare:
|
||||
mov bx, 0xb800
|
||||
mov es, bx
|
||||
mov edi, 0
|
||||
.loop:
|
||||
lodsb
|
||||
test al, al
|
||||
jz endloop
|
||||
stosw
|
||||
jmp .loop
|
||||
|
||||
.lba db "Inadequate LBA support: Ancient computor or floppy?", 0
|
||||
.nop db "Nothingtodo :'(", 0
|
||||
|
||||
;; Store some data
|
||||
diskNum db 0x00
|
Loading…
Add table
Add a link
Reference in a new issue