Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [BITS 16]
- [ORG 0x7C00]
- ;; jmp to code
- jmp 0x0000:start
- ;; FAT 12 Bios Parameter Block
- ;;%include "fat12_bpb.inc"
- ;; FAT 12 Bios Parameter Block
- OSName db " "
- BytesPerSector dw 512
- SectorsPerCluster db 1
- ReservedSectorCount dw 1
- NumFATs db 2
- RootEntriesCount dw 224
- TotalAmountOfSectors dw 2880
- MediaType db 0xF0
- FATSize dw 9
- SectorsPerTrack dw 18
- NumberOfHeads dw 2
- HiddenSectors dd 0
- TotalAmountOfSectors32 dd 0
- BootDriveNumber db 0
- WinNTReserved db 0
- ExtendedBootSignature db 0x29
- VolumeID dd 0
- VolumeLabel db " "
- FileSysType db "FAT12 "
- start:
- cli ;; Disable interrupts
- mov ax, 0x9000 ;; Stackaddress
- mov ss, ax ;; Stack = 0x9000
- xor sp, sp ;; Stackpointer = 0x0000
- sti ;; Enable interrupts
- ;; initialise segment registers
- xor ax, ax
- mov es, ax
- mov ds, ax
- ;; save bootdrive
- mov [BootDriveNumber], dl
- mov si, loadmessage
- call printstring
- ;; A never ending loop, yay. :D
- jmp $
- ;; TODO: Rest of stage 1
- ;;-------------------------------------------------------
- ;; Data
- ;;-------------------------------------------------------
- loadmessage db "Loading stage",13,10,0
- stage2_filename db "STAGE2 SYS"
- ;;-------------------------------------------------------
- ;; Functions
- ;;-------------------------------------------------------
- printstring:
- lodsb ;; Load Byte
- or al, al ;;
- jz short printstringd ;; 0-Byte? => stop
- mov ah, 0x0E ;; BIOS Function 0x0E
- mov bx, 0x0007 ;; Attribute-Byte
- int 0x10 ;; Write character
- jmp printstring
- printstringd:
- retn
- ;; TODO: Write FAT 12 functions
- ;; fill rest of sector with zeros
- times 510-($-$$) db 0
- ;; add boot signature
- dw 0xAA55
Advertisement
Add Comment
Please, Sign In to add comment