Compare commits

...

11 Commits
master ... exp

Author SHA1 Message Date
  Jørn Guldberg 398d1ad57c More work on vbr 5 years ago
  Jørn Guldberg d3603461dd Ready to clean up exp branch 5 years ago
  Jørn Guldberg 03b56e9202 update vbr 5 years ago
  Jørn Guldberg d011fd2548 Update to vbr 5 years ago
  Jørn Guldberg 6c507a3d9d Updated vbr to new calling convenstion to disk 5 years ago
  Jørn Guldberg bfd02a0f74 Update: vbr.nasm 5 years ago
  Jørn Guldberg afc9f026b7 Save work 5 years ago
  Jørn Guldberg 81ce3ecf36 Big changes still in progress 5 years ago
  Jørn Guldberg d76483a08c Refactor started for implementing updated file system 5 years ago
  Jørn Guldberg 2355ce19fb New bootloader confirmed, vbr updated, updated filesystem needed 5 years ago
  Jørn Guldberg 2e4dfb01b7 Bootloader and vbr update 5 years ago
5 changed files with 339 additions and 265 deletions
Split View
  1. +28
    -10
      bootloader.nasm
  2. +88
    -3
      filesystems/lsfs/lsfs.nasm
  3. +32
    -9
      kernel.nasm
  4. BIN
      vbr
  5. +191
    -243
      vbr.nasm

+ 28
- 10
bootloader.nasm View File

@ -55,16 +55,25 @@ start:
call print ; Call our string-printing routine
;This goes first as to now overwrite %ah and %al.
mov ax, 0x0050
mov es, ax ;Section to write into
mov ah, 0x2 ;Read sectors from drive
mov al, 0x08 ;Number of sectors to read (31 * 512 = 15872 bytes)
mov ch, 0x0 ;Low 8 bits of cylinder
mov cl, 0x11 ;First sector to read (bits 0-5), upper bits of cylinder (bits 6-7)
mov dh, 0x0 ;Head number
mov dl, [disk_identifier] ;Drive number
mov bx, 0x0000 ;Offset into section
int 0x13 ;Low level disk services
;mov ax, 0x0050
;mov es, ax ;Section to write into
;mov ah, 0x2 ;Read sectors from drive
;mov al, 0x08 ;Number of sectors to read (31 * 512 = 15872 bytes)
;mov ch, 0x0 ;Low 8 bits of cylinder
;mov cl, 0x11 ;First sector to read (bits 0-5), upper bits of cylinder (bits 6-7)
;mov dh, 0x0 ;Head number
;mov dl, [disk_identifier] ;Drive number
;mov bx, 0x0000 ;Offset into section
;int 0x13 ;Low level disk services
mov WORD [DAPACK.lba_addr_dw_low], 2048
mov WORD [DAPACK.blkcnt], 0x1f
mov WORD [DAPACK.db_addr_segment], 0x50
mov WORD [DAPACK.db_addr_offset], 0x0000
mov si, DAPACK ; address of "disk address packet"
mov ah, 0x42 ; READ
mov dl, [disk_identifier]
int 0x13
jnc notcarry
mov si, error_str
@ -159,6 +168,15 @@ data:
success_str db 'Success', 0
disk_identifier db 0
DAPACK:
.dap_Size: db 0x10 ; This is always 16 bytes (0x10)
.rev_byte: db 0x0 ; reserved byte, should always be zero
.blkcnt: dw 0x0 ; int 13 resets this to # of blocks actually read/written
.db_addr_offset: dw 0x0 ; memory buffer destination address (0:7c00)
.db_addr_segment: dw 0x0 ; in memory page zero
.lba_addr_dw_low: dd 0x0 ; put the lba to read in this spot
.lba_addr_dw_high: dd 0x0 ; more storage bytes only for big lba's ( > 4 bytes )
; Pad to 510 bytes (boot sector size minus 2) with 0s, and finish with the two-byte standard boot signature
times 446-($-$$) db 0 ; First partion entry
db 0x80 ; active partition

+ 88
- 3
filesystems/lsfs/lsfs.nasm View File

@ -86,11 +86,34 @@ lsfs_get_fs_info:
ret
lsfs_read_file:
; INPUT ax = file index
; INPUT bx = filebuffer
%define local_file_name [bp]
%define local_file_name [bp]
%define local_file_name [bp]
%define local_file_name [bp]
%define local_file_name [bp]
%define local_file_name [bp]
%define local_next_path_name [bp - 256]
;INPUT
; ax = filename
; bx = pointer to buffer
; cx = buffer_size
; dx = offset in file
; es = segment to read in data
push bp
mov bp, sp
sub sp, 512
mov bx, local_next_path_name
pusha ; save all register state
; We need to find the data pointers for the file.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Find first path name to search for
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
push bx
mov dx, LSFS_magic_start_sector
@ -328,6 +351,20 @@ lsfs_create_file:
.new_file_data_pointer dw 0
times 222 db 0
lsfs_load_fsci_info:
mov dl, [global_disk_identifier]
mov WORD [DAPACK.lba_addr_dw_low], ax
mov WORD [DAPACK.blkcnt], 0x01
mov WORD [DAPACK.db_addr_segment], bx
mov WORD [DAPACK.db_addr_offset], FSCI
mov si, DAPACK ; address of "disk address packet"
mov ah, 0x42 ; READ
mov dl, [global_disk_identifier]
int 0x13
lsfs_list_files_command:
; This function takes the adress of the first sector of the disk
; which the OS has to know
@ -438,4 +475,52 @@ DAPACK:
.lba_addr_dw_low: dd 0x0 ; put the lba to read in this spot
.lba_addr_dw_high: dd 0x0 ; more storage bytes only for big lba's ( > 4 bytes )
FSCI:
.filesystem_information times 256 db 0 ; char
.master_table_index dw 0x00, 0x00 ; lsfs_sector_offset
.this_partition_offset_on_diskdw dw 0x00, 0x00 ; lsfs_sector_offset
.next_free_sector dw 0x00, 0x00 ; lsfs_sector_offset
.next_uniqe_id dw 0x00, 0x00; // both files and directories gets this. ; uint64_t
.next_sector_reuse_pointer dw 0x00, 0x00; ; lsfs_sector_offset
.last_sector_index_on_partition dw 0x00, 0x00; ; lsfs_sector_offset
.maximum_sectors_on_disk dw 0x00, 0x00; lsfs_sector_offset
.sector_size_on_disk dw 0x00, 0x00; lsfs_sector_offset
.not_used times 24 dw 0x00, 0x00; uint64_t
Master_Boot_record:
.code times 446 db 0 ; // The code for the bootloader uint8_t
.p1_active_partition db 0x80
.p1_start_CHS db 0x00, 0x00, 0x11;0x20, 0x21, 0x00
.p1_disk_type db 0x83
.p1_end_CHS db 0x8C, 0x3D, 0x0F
.p1_start_LBA db 0x10, 0x00, 0x00, 0x00
.p1_size db 0x00, 0xC8, 0x03, 0x00
; sector number for 2.nd SingOS -> 16480
.p2_active_partition db 0x80
.p2_start_CHS db 0x8C, 0x3E, 0x0F
.p2_disk_type db 0x83
.p2_end_CHS db 0xFF, 0xFF, 0xFF
.p2_start_LBA db 0x61, 0x40, 0x00, 0x00 ;0x00, 0xD0, 0x03, 0x00
.p2_size db 0x00, 0x28, 0x1C, 0x03
.p3_active_partition db 0x00
.p3_start_CHS db 0x00, 0x00, 0x00
.p3_disk_type db 0x00
.p3_end_CHS db 0x00, 0x00, 0x00
.p3_start_LBA db 0x00, 0x00, 0x00, 0x00
.p3_size db 0x00, 0x00, 0x00, 0x00
.p4_active_partition db 0x00
.p4_start_CHS db 0x00, 0x00, 0x00
.p4_disk_type db 0x00
.p4_end_CHS db 0x00, 0x00, 0x00
.p4_start_LBA db 0x00, 0x00, 0x00, 0x00
.p4_size db 0x00, 0x00, 0x00, 0x00
.mbr_signature dw 0xAA55 ; // Signature uint16_t
lsfs_global_is_suported db 0x1 ; 0 means is not supported, when SingOS i booted it will check if it is supported (int 0x13 extended read/write)

+ 32
- 9
kernel.nasm View File

@ -1,11 +1,42 @@
BITS 16
ORG 0x512
start_sing:
; loading essentials for SingOS to run
mov ax, 0x50
mov ds, ax
mov es, ax
; Setup stack
mov ax, 0x8fc0
mov ss, ax ; Set 'ss' to this location (the beginning of our stack region)
mov sp, 0xffff ; Set 'ss:sp' to the top of our 8K stack
mov bp, sp
mov [global_disk_identifier], dl ; saving disk_identifier, this is the number the disk that we are booting from.
; This number is set by the bios
;call lsfs_check_extended_support ; Check that the int 0x13 extended read and write is available
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; SYSTEM CALL TABLE STARTING AT POSITION 0x0050:0x0000
; To already support 64-bit, the entries is 64-bit
; But in 16-bit, the adresses is only 16-bit
; These are stored in the first 16-bits
; There is reserved 2 sectors to the table witch means that we have room for
; 128 System Calls
; |----|----------------------------------------------------------------------------|
; | 1 | Master Table| call [0x0050:0x0000] Pointer to the Master File Table |
; |----|----------------------------------------------------------------------------|
; | 2 | FILE SYSTEM | call [0x0050:0x0008] for arguments see under the file system |
; |----|----------------------------------------------------------------------------|
; | 3 | OS_LIB | call [0x0050:0x0016] for arguments see under the file system |
; |----|----------------------------------------------------------------------------|
; | 1 | FILE SYSTEM | call [0x0050:0x0000] for arguments see under the file system |
; |----|----------------------------------------------------------------------------|
; | 2 | OS_LIB | call [0x0050:0x0008] for arguments see under the file system |
; |----|----------------------------------------------------------------------------|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
jmp sing_loaded
;%include "mem_lib/mem_lib.nasm"
%include "lib/os_lib.nasm"
@ -297,11 +328,3 @@ data:
;GLOBAL_VSFS_START db 'VSFS v0.1' ; sector 257 reserved for file system information
%include "go32bit.nasm"
; times ((1<<13)-($-$$)) db 0 ; sector 258 to sector 2048 should be avaliable to the filesystem.
times ((1<<20)-($-$$) - 26) db 0 ; sector 258 to sector 2048 should be avaliable to the filesystem.
magic_string_end_of_SingOS_kernel db '** END OF KERNEL SingOS **'
times ((1<<23)-($-$$)) db 0

BIN
vbr View File


+ 191
- 243
vbr.nasm View File

@ -1,167 +1,43 @@
ORG 0x7c00
BITS 16
%define DISK_SERVICE 0x0050:0x0256
%define KERNEL 0x0050:0x0512
%define KERNEL 0x0050:0x0000 ;0x0050:0x0512
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
jmp short vbr_lfsf
nop ; Used later as a FLAG byte for extended INT 13 Disk Func.'s (See instruction at: 7CADh).
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Disk description table, to make it a valid floppy
; Note: some of these values are hard-coded in the source!
; Values are those used by IBM for 1.44 MB, 3.5" diskette
; NOTE(jakob): From MikeOS
; Why do we need this... damn BIOS
;times 71 - ($-$$) db 0
OEMLabel db "SingOs " ; Disk label
; BytesPerSector dw 512 ; Bytes per sector
; SectorsPerCluster db 1 ; Sectors per cluster
; ReservedForBoot dw 1 ; Reserved sectors for boot record
; NumberOfFats db 2 ; Number of copies of the FAT
; RootDirEntries dw 224 ; Number of entries in root dir
; ; (224 * 32 = 7168 = 14 sectors to read)
; LogicalSectors dw 0x4000 ; Number of logical sectors
; MediumByte db 0xF0 ; Medium descriptor byte
; SectorsPerFat dw 9 ; Sectors per FAT
; SectorsPerTrack dw 18 ; Sectors per track (36/cylinder)
; Sides dw 2 ; Number of sides/heads
; HiddenSectors dd 0 ; Number of hidden sectors
; LargeSectors dd 0 ; Number of LBA sectors
; DriveNo dw 0 ; Drive No: 0
; Signature db 0 ; Drive signature: 41 for floppy
; VolumeID dd 0x00000000 ; Volume ID: any number
; VolumeLabel db "SingOs "; Volume Label: any 11 chars
; FileSystem db "VSFS " ; File system type: don't change!
vbr_lfsf:
; Volume Boot Record
; This will start SingOS from the disk
; The disk format has to be LessSimpleFileSystem
; Loading /kernel/kernel.bin which should contain the kernel for the system
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Ensure that the data segment and extra segment is set to 0x00
mov ax, 0x00
mov ds, ax
mov es, ax
; loading essentials for SingOS to run
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; SYSTEM CALL TABLE STARTING AT POSITION 0x0050:0x0000
; To already support 64-bit, the entries is 64-bit
; But in 16-bit, the adresses is only 16-bit
; These are stored in the first 16-bits
; There is reserved 2 sectors to the table witch means that we have room for
; 128 System Calls
; |----|----------------------------------------------------------------------------|
; | 1 | Master Table| call [0x0050:0x0000] Pointer to the Master File Table |
; |----|----------------------------------------------------------------------------|
; | 2 | FILE SYSTEM | call [0x0050:0x0008] for arguments see under the file system |
; |----|----------------------------------------------------------------------------|
; | 3 | OS_LIB | call [0x0050:0x0016] for arguments see under the file system |
; |----|----------------------------------------------------------------------------|
; | 1 | FILE SYSTEM | call [0x0050:0x0000] for arguments see under the file system |
; |----|----------------------------------------------------------------------------|
; | 2 | OS_LIB | call [0x0050:0x0008] for arguments see under the file system |
; |----|----------------------------------------------------------------------------|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov [vbr_disk_identifier], dl ; saving disk_identifier, this is the number the disk that we are booting from.
; This number is set by the bios
xor ax, ax
mov al, dl
; Setup stack
mov ax, 0x8fc0
mov ss, ax ; Set 'ss' to this location (the beginning of our stack region)
mov sp, 0xffff ; Set 'ss:sp' to the top of our 8K stack
mov bp, sp
mov al, [vbr_disk_identifier]
mov [global_disk_identifier], dl ; saving disk_identifier, this is the number the disk that we are booting from.
mov [vbr_lba_position_at_disk], ax ; From the MBR we need information of where we are located at the disk.
; If this fails, we could lookup our self, in the MBR where we are located.
;mov ax, 0x50
;mov cs, ax
;mov ds, ax
;mov ax, 0x8fc0
;mov ss, ax ; Set 'ss' to this location (the beginning of our stack region)
;mov sp, 0xffff ; Set 'ss:sp' to the top of our 8K stack
;mov bp, sp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; The system has to support int13 bios extended system calls, otherwise is SingOS not supporting the hardware.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov ah, 0x41 ;Set AH = 0x41
mov bx, 0x55aa ;BX = 0x55AA
mov dl, [vbr_disk_identifier] ;DL = disk_id
int 0x13 ;Issue an INT 0x13.
jc .is_not_supported
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; The system is suportted
; We are now loading the filesystem
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;mov WORD bx, [vbr_lba_position_at_disk]
mov WORD [DAPACK.lba_addr_dw_low], 89
mov WORD [DAPACK.blkcnt], 0x08 ; Read to sectors, that is what the space is for the buffer in svim
mov WORD [DAPACK.db_addr_segment], 0x50
mov WORD [DAPACK.db_addr_offset], 0x256
mov si, DAPACK ; address of "disk address packet"
mov ah, 0x42 ; READ
mov dl, [vbr_disk_identifier]
int 0x13
;call dumpax
;call DISK_SERVICE
mov [vbr_disk_identifier], dl
mov al, dl
;call DISK_SERVICE
;mov ax, 0
;mov ah, 0x10
;int 0x16
;mov ah, 0x0e
;mov al, 66 ; backspace
;int 0x10 ; print char
;call DISK_SERVICE
;mov ax, 0
;mov ah, 0x10
;int 0x16
;mov ah, 0x0e
;mov al, 66 ; backspace
;int 0x10 ; print char
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; The disk service is now loaded.
; Now we are going to load the Master table.
;
; We are now loading the filesystem
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov WORD [DAPACK.lba_addr_dw_low], 97
mov WORD [DAPACK.blkcnt], 0x1f
mov WORD [DAPACK.db_addr_segment], 0x50
mov WORD [DAPACK.db_addr_offset], 0x0512
mov si, DAPACK ; address of "disk address packet"
mov ah, 0x42 ; READ
mov dl, [vbr_disk_identifier]
int 0x13
;call dumpax
xor ax, ax
mov dl, [vbr_disk_identifier]
mov al, dl
;call dumpax
mov dl, [vbr_disk_identifier]
jmp KERNEL
nop
mov dl, [global_disk_identifier] ;DL = disk_id
int 0x13 ;Issue an INT 0x13.
jnc ext_disk_supported
; The System does support exented read write
mov si, vbr_lsfs_disk_error_msg
call 0x00:tmp_print
cli
hlt
.is_not_supported:
; The System does support exented read write
mov si, lsfs_disk_error_msg
;call print
;Routine for printing a 'ax' as hex
dumpax:
;Routine for printing a 'ax' as hex
tmp_dumpax:
pusha ; save registers
mov bx, ax
mov ah, 0xE ; Teletype output
@ -180,12 +56,150 @@ dumpax:
loop .loop
popa ; restore registers
ret
retf
tmp_print:
; Prints string in si
; IN si: zero terminated string to print
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;mov ax, 0x7e55
;mov ax, si
;call 0x00:tmp_dumpax
mov ah, 0xE ; Specify 'int 0x10' 'teletype output' function
; [AL = Character, BH = Page Number, BL = Colour (in graphics mode)]
.printchar:
lodsb ; Load byte at address SI into AL, and increment SI
test al, al
jz .done ; If the character is zero (NUL), stop writing the string
int 0x10 ; Otherwise, print the character via 'int 0x10'
jmp .printchar ; Repeat for the next character
.done:
retf
; loading essentials for SingOS to run
; starting by loading the rest of the VBR:
ext_disk_supported:
mov si, vbr_message
call 0x00:tmp_print
mov ax, 0x70
call 0x00:tmp_dumpax
;mov dl, [global_disk_identifier]
;mov ax, [vbr_LBA_address]
;mov WORD [DAPACK.lba_addr_dw_low], ax
;mov ax, [vbr_LBA_address]
;mov WORD [DAPACK.blkcnt], ax
;mov WORD [DAPACK.db_addr_segment], 0x0000
;mov WORD [DAPACK.db_addr_offset], 0x7e00 ; offset 512b
;mov si, DAPACK ; address of "disk address packet"
;mov ah, 0x42 ; READ
;mov dl, [global_disk_identifier]
;int 0x13
vbr_disk_identifier db 0
vbr_lba_position_at_disk dw 0
lsfs_disk_error_msg db 'The system does not support disk operations,', 13, 10, 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; The system is suportted
; We are now loading the kernel "/kernel/kernel.bin"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; INPUT
; ax = sector index for the FSCI that has to be loaded.
; bx = segment
;mov ax, [vbr_LBA_FSCI]
;mov bx, 0x00
;call lsfs_load_fsci_info;
;INPUT
; ax = filename
; bx = pointer to buffer
; cx = buffer_size
; dx = offset in file
; es = segment to read in data
;call lsfs_read_file
; RETURN
; ax preserved
; bx preserved
; cx preserved
; dx data read
; es = remember to restore es if this has to be saved.
mov ax, [vbr_LBA_address]
inc ax
call 0x00:tmp_dumpax
mov dl, [global_disk_identifier]
mov WORD [DAPACK.lba_addr_dw_low], ax
mov WORD [DAPACK.blkcnt], 0x10
mov WORD [DAPACK.db_addr_segment], 0x7e0
mov WORD [DAPACK.db_addr_offset], 0x00
mov si, DAPACK ; address of "disk address packet"
mov ah, 0x42 ; READ
mov dl, [global_disk_identifier]
int 0x13
mov ax, [vbr_LBA_FSCI]
call 0x00:tmp_dumpax
mov cx, [vbr_LBA_FSCI]
mov bx, ds
mov ax, 0x1
push cx
push bx
push ax
mov cx, 0x7e0
mov ds, cx
mov es, cx
call 0x7e0:0x00
add sp, 0x6 ; skip the paramerts
mov cx, 0x0
mov ds, cx
mov es, cx
call 0x0:tmp_dumpax
; Set the Parameter_Struct
mov ax, kernel_path
mov [Parameter_Struct.path], ax
mov WORD [Parameter_Struct.buffer_segment], 0x50
mov WORD [Parameter_Struct.buffer_address], 0x00
mov WORD [Parameter_Struct.buffer_size], 0xFFFF
mov WORD [Parameter_Struct.byte_offset_into_file], 0x00
call 0x0:tmp_dumpax
mov cx, Parameter_Struct
mov bx, ds
mov ax, 0x2
push cx
push bx
push ax
mov cx, 0x7e0
mov ds, cx
mov es, cx
call 0x7e0:0x00
add sp, 0x6 ; skip the paramerts
mov cx, 0x0
mov ds, cx
mov es, cx
call 0x0:tmp_dumpax
;mov dl, [global_disk_identifier]
;mov WORD [DAPACK.lba_addr_dw_low], 4177
;mov WORD [DAPACK.blkcnt], 0x20
;mov WORD [DAPACK.db_addr_segment], 0x50
;mov WORD [DAPACK.db_addr_offset], 0x0512
;mov si, DAPACK ; address of "disk address packet"
;mov ah, 0x42 ; READ
;mov dl, [global_disk_identifier]
;int 0x13
; ready to jump to the kernel
mov dl, [global_disk_identifier]
jmp KERNEL
nop
cli
hlt
DAPACK:
.dap_Size: db 0x10 ; This is always 16 bytes (0x10)
@ -196,97 +210,31 @@ DAPACK:
.lba_addr_dw_low: dd 0x0 ; put the lba to read in this spot
.lba_addr_dw_high: dd 0x0 ; more storage bytes only for big lba's ( > 4 bytes )
times 4096-($-$$) db 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; HERE START THE FILE SYSTEM
; This is the Master Table
; This is the fixed entries when the system is compilet
; DEFAULT SIZE IS 64 FILES
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Entry one:
;.filename:
db 'LSFS v0.1.4-exp', 13, 10, '(LessSimpelFileSystem)', 13, 10, 'Developed to SingOS', 13, 10, 'by Jorn Guldberg', 13, 10, 0 ; 66 chars + 8 bytes
times 175 db 0 ; 256 bytes file system informaiton
dw 24, 0x00, 0x00, 0x00 ; offset on disk asb LBA address
dw 23, 0x00, 0x00, 0x00 ; offset on disk asb LBA address
dw 2306, 0x00, 0x00, 0x00 ; Next free LBA partition index free
dw 0x04, 0x00, 0x00, 0x00 ; Next free uniqe ID
dw 0x00, 0x00, 0x00, 0x00 ; next_sector_reuse_pointer
dw 0xff, 0xff, 0xff, 0xff ; last_sector_index_on_partition
dw 0x00, 0x00, 0x00, 0x00 ; sectors_size_on_disk
times 200 db 0
;db 'File_System_Control_information', 0
;times 224 db 0
;.file_id:
;dw 0x0, 0x0, 0x0, 0x00 ; 64-bits
;.file_size
;dw 512, 0x0, 0x0, 0x0 ; 64-bits Should be the actual number of bytes.
;.ext_file_data 64-bits (Extended data about the file, timestamps etc.)
;dw 0x0, 0x0, 0x0, 0x0
;control_bits 64-bits
;dw 0x0, 0x0, 0x0, 0x0
;.file_data_pointers
;dw 88, 0x0, 0x0, 0x0
;times 216 db 0
; Entry Two:
db 'LessSimpelFileSystem.module', 0
times 228 db 0
;.file_id:
dw 0x01, 0x0, 0x0, 0x0
;.file_size
dw 4096, 0x0, 0x0, 0x0
;.ext_file_data 64-bits (Extended data about the file, timestamps etc.)
dw 0x0, 0x0, 0x0, 0x0
;control_bits 32-bits
db 0x0, 0x0, 0x0, 0x0
; entry kind
db 0x1 ; 1 is file
db 0x0, 0x0, 0x0
;.file_data_pointers
dw 89, 0x0, 0x0, 0x0
times 216 db 0
; Entry Three:
db 'kernel', 0
times 249 db 0
;.file_id:
dw 0x02, 0x0, 0x0, 0x0
;.file_size
dw 0x00, 0x10, 0x0, 0x0
;.ext_file_data 64-bits (Extended data about the file, timestamps etc.)
dw 0x0, 0x0, 0x0, 0x0
;control_bits 32-bits
db 0x0, 0x0, 0x0, 0x0
; entry kind
db 0x1 ; 1 is file
db 0x0, 0x0, 0x0
;.file_data_pointers
dw 97, 0x0, 0x0, 0x0
times 216 db 0
; Entry Three:
db 'First_Folder', 0
times 243 db 0
;.file_id:
dw 0x03, 0x0, 0x0, 0x0
;.file_size
dw 0x20, 0x00, 0x0, 0x0
;.ext_file_data 64-bits (Extended data about the file, timestamps etc.)
dw 0x0, 0x0, 0x0, 0x0
;control_bits 32-bits
db 0x0, 0x0, 0x0, 0x0
; entry kind
db 0x2 ; 1 is folder
db 0x0, 0x0, 0x0
;.file_data_pointers
dw 0x0, 0x0, 0x0, 0x0
times 216 db 0
times 4096 + (32768-($-$$)) db 0
Parameter_Struct:
.path dw 0x00 ; char*
.new_path dw 0x00 ; char*
.buffer_segment dw 0x00 ; int
.buffer_address dw 0x00 ; int
.buffer_size dw 0x00 ; int
.data_length dw 0x00 ; int
.byte_offset_into_file dw 0x00 ; int
.entry_kind dw 0x00 ; Table_Entry_Kind
global_disk_identifier db 0
vbr_message db 'VBR: Less Simple File System', 13, 10, 'Loading system', 13, 10, 0
vbr_lsfs_disk_error_msg db 'The system does not support disk operations,', 13, 10, 0
kernel_path db '/kernel/kernel.bin', 0
times 446-($-$$) db 0
vbr_size_in_bytes dw 0x00, 0x00, 0x00, 0x00 ; size of the VBR in secotrs (Such that we can load the rest of the VBR)
vbr_LBA_address dw 0x00, 0x00, 0x00, 0x00 ; Abselout LBA adress of this VBR, such that we know where to find the FSCI (offset 1MB)
vbr_LBA_FSCI dw 0x00, 0x00, 0x00, 0x00
times 510-($-$$) db 0
dw 0x1818; Signature, homemade, sshould it be 0xAA55?
; rest of VBR, which has to be loaded in the first part of the VBR
;%include "filesystems/lsfs/lsfs.nasm"
incbin "../lsfs_16-bit/disk.out"
; By specification the max size can be 1MB of the compiled file.

Loading…
Cancel
Save