flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > About OS construction |
Author |
|
nihilist:P 26 May 2008, 17:35
Does your bootsector load the contents of the next sectors into RAM?
|
|||
26 May 2008, 17:35 |
|
fdxx 26 May 2008, 17:44
Boot.asm
Code: [BITS 16] [ORG 0x7C00] main: mov ax,0x000 mov ds,ax mov si, MSJ call PutStr jmp $ PutStr: mov ah,0x0E mov bh,0x00 mov bl,0x07 .nextchar lodsb or al,al jz .return int 0x10 jmp .nextchar .return ret MSJ db 'bootloader',13,10,0 times 510-($-$$) db 0 dw 0xAA55 |
|||
26 May 2008, 17:44 |
|
nihilist:P 26 May 2008, 18:12
You have to copy your kernel.bin to sector 1 and then load it using BIOS Interrupt 13h. Searching this forum you will find many examples for that.
Quote:
Many people have that problem... Where are you from? (I am from germany) PS: I am not really new but I forgot my password and lost the EMail-Adress I hat to create a new account...feeling sorry for that, really |
|||
26 May 2008, 18:12 |
|
fdxx 26 May 2008, 18:19
Thank you
ps: I am from Argentine |
|||
26 May 2008, 18:19 |
|
nihilist:P 26 May 2008, 19:10
This could help you:
Code: DriveInfo: .DriveNumber db 0 .Heads dd 0;2 .Cylinders dd 0;335 .SectPerTrack dd 0;2 ;************************************************************************** f_LBA_to_CHS: ;In: ECX = Sector Out: CH, CL, DH, DL push eax push ebx mov eax, ecx xor edx, edx div [DriveInfo.SectPerTrack] mov cl, dl ;Set the sector inc cl xor edx, edx div [DriveInfo.Heads] mov dh, dl ;Set the head mov ch, al ;set the cyl ;shl ah, 6 ;or ah, 11000000b ;and cl, ah pop ebx pop eax ret ;************************************************************************** f_read_sector: push ax push bx push cx push dx call f_LBA_to_CHS mov ax, 201h ;Service 2, Read 1 sector mov dl, [DriveInfo.DriveNumber] int 13h pop dx pop cx pop bx pop ax ret ;************************************************************************** f_read_driveinfo: mov dl, [DriveInfo.DriveNumber] mov ah, 8h int 13h mov byte [DriveInfo.Heads], dh inc [DriveInfo.Heads] mov byte [DriveInfo.Cylinders], ch inc [DriveInfo.Cylinders] and cl, 00111111b mov byte [DriveInfo.SectPerTrack], cl ;don't inc, coz ind of sect starts with 1 ret 3 functions I use for that purpose. f_read_driveinfo does what the name says... should be called once at the beginning. To read your 2nd sector just store 1 in ecx ant then call f_LBA_to_CHS first and then f_read_sector. Code: call f_read_driveinfo ;load next OS sectors LoadLoaders: mov ax, 50h mov es, ax xor bx, bx xor ecx, ecx .readloop: call f_read_sector add bx, 200h inc cx cmp cx, WORD [moskrnlsectend] jb LoadLoaders.readloop note: moskrnlsectend is the end-sector (count-1) to load. |
|||
26 May 2008, 19:10 |
|
edfed 26 May 2008, 19:37
this will help you very much
bootloader & bootwriter shell.com and comwriter for win9x & dos, execute comloader/bw05.com and shell/cw05.com ask for Xw05.com or seek on the forum |
|||
26 May 2008, 19:37 |
|
fdxx 26 May 2008, 20:18
Thanks!, very useful
|
|||
26 May 2008, 20:18 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.