get drive geometry
This commit is contained in:
1 parent
fb6cc7a3be
commit
629fc3e826
3 files changed
+61
-24
No files matched your search
@@ -1,9 +1,17 @@
|
||||
; MEMORY LAYOUT
|
||||
; 0x0000 - 0x7000: stack
|
||||
; 0x7000 - 0x7c00: globals
|
||||
; 0x7000 - 0x7001: boot drive number
|
||||
; 0x7001 - 0x7002: number of hard disk drives
|
||||
; 0x7002 - 0x7003:
|
||||
; 0x7c00 - 0x7e00: boot sector
|
||||
|
||||
; BIOS puts our boot sector at 0000:7c00
|
||||
org 0x7c00
|
||||
; We're (probably) in real mode
|
||||
bits 16
|
||||
|
||||
; Disable interrupts, fuck knows what an interrupt would do right now
|
||||
; Disable interrupts
|
||||
cli
|
||||
|
||||
xor ax, ax
|
||||
@@ -11,41 +19,45 @@ bits 16
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
; Put the stack base at the address of our program text (stack will grow high->low away from it).
|
||||
; We're not doing anything with a stack right now but who knows we might want to later
|
||||
; Put stack base at 0x7000. Stack grows high->low, so we'll grow away from our program text at
|
||||
; 0x7c00. We reserve the range [0x7000,0x7c00) for globals.
|
||||
mov ss, ax
|
||||
mov sp, 0x7c00
|
||||
mov sp, 0x7000
|
||||
|
||||
; Segment for VGA (0xb800 * 16 = 0xb8000)
|
||||
mov ax, 0xb800
|
||||
mov fs, ax
|
||||
|
||||
mov di, 0x7000
|
||||
|
||||
; Store boot drive number
|
||||
mov ds:[di], dl
|
||||
|
||||
; Get drive geometry
|
||||
mov di, 0x00
|
||||
mov ah, 0x08
|
||||
int 0x13
|
||||
jb panic
|
||||
mov ds:[di + 1], dl
|
||||
|
||||
; Set VGA mode
|
||||
; https://mendelson.org/wpdos/videomodes.txt
|
||||
mov ah, 0x00
|
||||
mov al, 0x03
|
||||
mov ax, 0x0003
|
||||
int 0x10
|
||||
|
||||
; Reveal the true nature of jen
|
||||
xor bx, bx
|
||||
mov ax, 17
|
||||
loop:
|
||||
cmp ax, bx
|
||||
jle done
|
||||
lea si, [womble + bx]
|
||||
mov dh, [si]
|
||||
mov di, bx
|
||||
shl di, 1
|
||||
mov byte fs:[di], dh
|
||||
mov byte fs:[di + 1], 0x1f
|
||||
inc bx
|
||||
jmp loop
|
||||
|
||||
done:
|
||||
mov word fs:[0x0000], 0xc048
|
||||
mov word fs:[0x0002], 0xc069
|
||||
mov word fs:[0x0004], 0xc021
|
||||
hlt
|
||||
|
||||
womble:
|
||||
db "jen is a womble!"
|
||||
panic:
|
||||
mov ax, 0x0003
|
||||
int 0x10
|
||||
mov word fs:[0x0000], 0x4f46
|
||||
mov word fs:[0x0002], 0x4f41
|
||||
mov word fs:[0x0004], 0x4f49
|
||||
mov word fs:[0x0006], 0x4f4c
|
||||
hlt
|
||||
|
||||
; TODO: enable A20
|
||||
|
||||
|
||||
Reference in new issue
Block a user