flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Creating a bootloader. |
Author |
|
Dex4u 21 Feb 2006, 18:22
Yes you should get bootprog.zip from here: http://alexfru.chat.ru/epm.html#bootprog
Not only is it a great bootloader (eg: will load any bin, com, exe file, from anywere on a floppy, by a certain name), but it comes with welcommented asm code. |
|||
21 Feb 2006, 18:22 |
|
calpol2004 21 Feb 2006, 19:38
not really what im looking for. Reason i wanted to get into OS construction so all the code would be mine. no dependencies on anything (except of course the BIOS). i'll take a look at it's source maybe find out how i need to load the kernel properly. btw when i try to switch to protected mode, is it possible to not switch to pmode in the bootloader and wait until the kernel is loaded then do it then in the kernel? i want to do this because when i switch to protected mode in the bootloader all the text i had written in real mode never appears on the screen, this may be because i put "use32" after i've switched to protected, doesn't seem to like me declaring this half way through the code (works if i take this line out, though not sure if it properly enters protected mode). Though i think i have to put "use32" for the 32bit registers to become available (correct me if i'm wrong). any idea to what im doing wrong?
|
|||
21 Feb 2006, 19:38 |
|
Dex4u 22 Feb 2006, 00:44
Your bootloader can load a pmode kernel or a kernel that starts in realmode and then goes to pmode, thats up to you, but if you want to load your kernel over 1mb you will need to use unrealmode or pmode.
My kernel starts in realmode and then goes to pmode. Enter pmode simple example. Code: ;************************************; \\|//; (@ @); Dex4u;; Assemble with fasm; c:\fasm Testboot.asm Testboot.bin;;************************************org 0x7C00use16;****************************; Realmode startup code.;****************************start: xor ax,ax mov ds,ax mov es,ax mov ss,ax mov sp,0x7C00;*****************************; Setting up, to enter pmode.;***************************** cli lgdt [gdtr] mov eax, cr0 or al,0x1 mov cr0,eax jmp 0x10: protected;*****************************; We are entering Pmode. ;*****************************use32protected: mov ax,0x8 mov ds,ax mov es,ax mov ss,ax mov esp,0x7C00;*****************************; Turn floppy off (if space).;***************************** mov dx,3F2h mov al,0 out dx,al;*****************************; Print a P if we enter Pmode. ;***************************** mov byte [es:0xB8000], 'P' jmp $;*************************************; GDT.;*************************************gdt: dw 0x0000, 0x0000, 0x0000, 0x0000sys_data: dw 0xFFFF, 0x0000, 0x9200, 0x00CFsys_code: dw 0xFFFF, 0x0000, 0x9800, 0x00CFgdt_end:gdtr: dw gdt_end - gdt - 1 dd gdt;*************************************; Make program 510 byte's + 0xaa55;*************************************times 510- ($-start) db 0dw 0xaa55 |
|||
22 Feb 2006, 00:44 |
|
calpol2004 22 Feb 2006, 13:12
exactly the kind of thing i was lookin for.. ill let you know how i get on with implementing it.
|
|||
22 Feb 2006, 13:12 |
|
calpol2004 23 Feb 2006, 19:00
your pmode example worked great, now i've just about got my head around loading a kernel from a FAT12 file system though im having trouble with virtual pc 2004. so far i've just been using a simple tool (someone on this forum made it, don't remember who ) that copies my .bin bootsector to the floppy image (can't add files if i tried id overwrite my bootsector ). However because my kernel will be loaded from a file on a floppy, i need to be able to copy my kernel file and my bootsector to the virtual floppy disk. I'm unable to find a utility that is able to do this. WinImage can copy files to images but has poor functionality for adding my bootloader to the bootsector. Anyone know any tools which can do this?
|
|||
23 Feb 2006, 19:00 |
|
Dex4u 23 Feb 2006, 19:42
If you go here: http://bos.asmhackers.net/downloads.php
and get "BOS version 0.04, with source" and read the bach file, which shows the commands to get round that problem, using "partcopy.exe". |
|||
23 Feb 2006, 19:42 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.