flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Creating a Hello World OS? |
Author |
|
Dex4u 06 Jun 2006, 12:42
example1
C:\FASM TEST.ASM TEST.BIN put it on a floppy with rawrite. Code: org 0x7C00use16;****************************; Realmode startup code.;****************************start: xor ax,ax mov ds,ax mov es,ax mov ss,ax mov sp,0x7C00;*************************************; Print message.;************************************* mov ax,0xB800 mov es,ax lea si,[msg0] mov di,(80 * 1 + 2) * 2 mov cx,26 cld rep movsb jmp $ msg0 db " H E L L O W O R L D ! " ;*************************************; Make program 510 byte's + 0xaa55;*************************************times 510- ($-start) db 0dw 0xaa55 example2 With bios. C:\FASM TEST.ASM TEST.BIN put it on a floppy with rawrite. Code: org 0x7C00use16;****************************; Realmode startup code.;****************************start: xor ax,ax mov ds,ax mov es,ax mov ss,ax mov sp,0x7C00;*************************************; Print message.;************************************* mov si,msg0 call print jmp $;====================================================;; print. ;;====================================================;print: mov ah,0Eh ; Request displayagain1: lodsb ; load a byte into AL from DS:SI or al,al ; Or AL jz done1 ; Jump 0, to label done1 int 10h ; Call interrupt service jmp again1 ; Jump to label again1done1: ret ; Return msg0 db " Hello world! " ;*************************************; Make program 510 byte's + 0xaa55;*************************************times 510- ($-start) db 0dw 0xaa55 To make a cd bootable, some how make a bootable floppy image, click in your cd burn software make bootable and point it to the image you have made with the above code. I would also take a look at MiniDOS code, as its designed as a basic OS tut. |
|||
06 Jun 2006, 12:42 |
|
saigon 06 Jun 2006, 13:39
Thank you! I already looked at the MiniDOS thread before posting this one, it seems to be pretty good.
I have a question, though: For what do I need to do this? Code: ;************************************* ; Make program 510 byte's + 0xaa55 ;************************************* times 510- ($-start) db 0 dw 0xaa55 In both examples you posted, you wrote that code in the bottom, but I don't understand for what it is for. Also, do you know any manual or tutorial where I can learn about how creating an OS with assembly sources? It doesn't mind me if the sources aren't FASM. Thanks a lot! |
|||
06 Jun 2006, 13:39 |
|
WiESi 06 Jun 2006, 14:19
A bootloader has to have 512 bytes of size. The first instruction adds zeros to the program until it has 510 bytes. Also a bootloader has to end with 055h and 0aah. This is done by the second instruction.
|
|||
06 Jun 2006, 14:19 |
|
Dex4u 06 Jun 2006, 19:14
WiESi has answered the first ?, as for the second ? this may help
http://www.mega-tokyo.com/osfaq2/index.php/BabyStep But the best thing is to to get a bootloader like bootprog http://alexfru.chat.ru/epm.html#bootprog and assemble your OS as a com or exe, and start by making a realmode OS using bios int, before moving on to Pmode. Also you could help on someone else OS project to learn (MDos-R) http://osdev.mike21091.com/ Also theres lots of good doc on bubachs site http://bos.asmhackers.net/docs/ Hope this helps. |
|||
06 Jun 2006, 19:14 |
|
saigon 06 Jun 2006, 21:12
Thanks Dex!
|
|||
06 Jun 2006, 21:12 |
|
peter 07 Jun 2006, 01:18
Toy OS Series in Linux Gazette may be useful for you:
http://linuxgazette.net/issue77/krishnakumar.html http://linuxgazette.net/issue79/krishnakumar.html http://linuxgazette.net/issue82/raghu.html |
|||
07 Jun 2006, 01:18 |
|
The Lightning Stalker 07 Jun 2006, 21:12
Ahh, this may be just the thing I need to display an "insert disc 1" message and then press a key to reboot. This is for a ghost CD set.
|
|||
07 Jun 2006, 21:12 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.