62 lines
2.1 KiB
NASM
62 lines
2.1 KiB
NASM
ORG 00h
|
|
BITS 16
|
|
root_buffer equ 24000h
|
|
data_buffer equ 26000h
|
|
|
|
start:
|
|
mov si, boot_message
|
|
call os_print_string
|
|
|
|
call disk_load_root ; Loads the root directory into disk_buffer
|
|
|
|
; Physical address = (segment * 16) + offset
|
|
mov si, file_name
|
|
call disk_load_file
|
|
|
|
call os_start_cli
|
|
hlt
|
|
|
|
halt:
|
|
jmp halt
|
|
|
|
boot_message: db 'OK] Kernel successfully loaded!\n\n', 0
|
|
file_name: db 'hello.cws', 0
|
|
|
|
; Define Fat12 header
|
|
bdb_oem: db 'MSWIN4.1' ; ignore
|
|
bdb_bytes_per_sector: dw 200h ; = 512d
|
|
bdb_sectors_per_cluster: db 01h ; sector = cluster
|
|
bdb_reserved_sectors: dw 01h
|
|
bdb_fat_count: db 02h ; We've got a fat1 and fat2
|
|
bdb_dir_entries_count: dw 0E0h ; Maximum number of root directory entries
|
|
bdb_total_sectors: dw 0B40h ; = 2880d
|
|
bdb_media_descriptor_type: db 0F0h ; ignore
|
|
bdb_sectors_per_fat: dw 09h
|
|
bdb_sectors_per_track: dw 12h ; = 18d
|
|
bdb_number_of_heads: dw 02h ; top and bottom of the floppy disk
|
|
bdb_hidden_sectors: dd 0 ; ignore
|
|
bdb_large_sector_count: dd 0 ; total sector count for fat32 (0 for fat12 or fat16)
|
|
|
|
; extended boot record
|
|
ebr_drive_number: db 0 ; ignore
|
|
db 0 ; ignore
|
|
ebr_signature: db 29h ; boot signature, indicates that the next three fields are present (0x29)
|
|
ebr_volume_id: db 12h, 34h, 56h, 78h ; unique id for volume tracking
|
|
ebr_volume_label: db 'CrawShaw OS' ; must be 11 bytes
|
|
ebr_system_id: db 'FAT12 ' ; must be 8 bytes
|
|
|
|
; ------------------------------------------------------------------
|
|
; FEATURES -- Code to pull into the kernel
|
|
%INCLUDE "source/kernel/features/text.asm"
|
|
%INCLUDE "source/kernel/features/keyboard.asm"
|
|
%INCLUDE "source/kernel/features/cli.asm"
|
|
%INCLUDE "source/kernel/features/power.asm"
|
|
%INCLUDE "source/kernel/features/strings.asm"
|
|
%INCLUDE "source/kernel/features/graphics.asm"
|
|
%INCLUDE "source/kernel/features/disk.asm"
|
|
%INCLUDE "source/kernel/features/math.asm"
|
|
; GAMES -- Games that I wrote for it
|
|
%INCLUDE "source/kernel/games/pong.asm"
|
|
|
|
|