ASM Man how do you do the last step??

Topics: Off Topic
Aug 5, 2012 at 9:49 PM

Alright so I feel like a complete noob when saying this, but I need some help, I looked around and could never really find my answer. Alright so I have this "boot.asm" file I have been working on. Heres the code

[BITS 16]
[ORG 0x0000] ;Mark the offset 0
jmp     START

START:
         ; boot code located at 0000:7C00
         ;adjust Segment registeres
          mov     ax, 0x07C0
          mov     ds, ax
          mov     es, ax
          mov     fs, ax
          mov     gs, ax

          ;Load String to "si" register and call "DisplayMessage" Procedure 
          mov     si, helloWorld
          call    DisplayMessage


HANG: ;Infinite Loop to hang
            jmp HANG

;Procedure For Display String on Screen
DisplayMessage:
          lodsb                                       ; load next character
          or      al, al                              ; test for NUL character
          jz      .DONE
          mov     ah, 0x0E                            ; BIOS teletype
          mov     bh, 0x00                            ; display page 0
          mov     bl, 0x07                            ; text attribute
          int     0x10                                ; Call BIOS interrupt
          jmp     DisplayMessage
     .DONE:
          ret

      helloWorld db "Hello World!", 0x00 ; String to Print

      times 510-($-$$) db 0
      dw 0AA55h ;Boot Signature

Now, how do I create a ISO, so that I may burn the ISO to a disk and then boot it, and have "Hello World" displayed? Sorry for my stupidness. Also, I know this is a boot loader, right? So you cant code your OS or Kernel here, how would you link the two? Thanks - Matt

 

I FEEL LIKE A RETARD. Oh well, thats how all beginners feel. XD Thanks for the help - Matt

Aug 5, 2012 at 11:14 PM
Edited Aug 5, 2012 at 11:20 PM

Cosmos is in protected mode so you can not use int 0x10 or any other bios interrupts. COSMOS believe uses a bootloader called 'syslinux' so a bootloader wouldn't be the place to start if you want to mix ASM and cosmos. X# is an assembly language so that would be were you should start if you want to mix assembly with cosmos. If you wanted to execute assembly code then you need to write an executable loader (OR simply copy the machine code into memory and call the address were it was loaded). The executable loader would require some X# to perform the jump to the programs code though. As far as linking use the extern keyword in assembly or C and a linker of course

Coordinator
Aug 6, 2012 at 7:54 AM
he's not trying to use cosmos....

civilwarrock: i think this is not the place to ask stuff like this.....


On Mon, Aug 6, 2012 at 12:14 AM, GruntXProductions <notifications@codeplex.com> wrote:

From: GruntXProductions

Cosmos is in protected mode so you can not use int 0x10 or any other bios interrupts. COSMOS believe uses a bootloader called 'syslinux' so a bootloader wouldn't be the place to start if you want to mix ASM and cosmos. X# is an assembly language so that would be were you should start if you want to mix assembly with cosmos. If you wanted to execute assembly code then you need to write an executable loader (OR simply copy the machine code into memory and call the address were it was loaded). The executable loader would require some X# to perform the jump to the programs code though. As far as linking use the extern keyword in assembly or C

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Aug 6, 2012 at 8:50 AM

Oh I misread his comment , I saw "So you cant code your OS or Kernel here, how would you link the two? Thanks - Matt" and assumed he ment link with cosmos because he was asking it here on the cosmos forum. 

Civilwarrock: Check out OS dev wiki 

Aug 6, 2012 at 8:56 AM
Edited Aug 6, 2012 at 9:00 AM
civilwarrock wrote:

Alright so I feel like a complete noob when saying this, but I need some help, I looked around and could never really find my answer. Alright so I have this "boot.asm" file I have been working on. Heres the code

 

[BITS 16]
[ORG 0x0000] ;Mark the offset 0
jmp     START

START:
         ; boot code located at 0000:7C00
         ;adjust Segment registeres
          mov     ax, 0x07C0
          mov     ds, ax
          mov     es, ax
          mov     fs, ax
          mov     gs, ax

          ;Load String to "si" register and call "DisplayMessage" Procedure 
          mov     si, helloWorld
          call    DisplayMessage


HANG: ;Infinite Loop to hang
            jmp HANG

;Procedure For Display String on Screen
DisplayMessage:
          lodsb                                       ; load next character
          or      al, al                              ; test for NUL character
          jz      .DONE
          mov     ah, 0x0E                            ; BIOS teletype
          mov     bh, 0x00                            ; display page 0
          mov     bl, 0x07                            ; text attribute
          int     0x10                                ; Call BIOS interrupt
          jmp     DisplayMessage
     .DONE:
          ret

      helloWorld db "Hello World!", 0x00 ; String to Print

      times 510-($-$) db 0
      dw 0AA55h ;Boot Signature

 

Now, how do I create a ISO, so that I may burn the ISO to a disk and then boot it, and have "Hello World" displayed? Sorry for my stupidness. Also, I know this is a boot loader, right? So you cant code your OS or Kernel here, how would you link the two? Thanks - Matt

 

I FEEL LIKE A RETARD. Oh well, thats how all beginners feel. XD Thanks for the help - Matt

Also civilwarrock , that code accomplished nothing but printing "Hello , World" on the screen. Technically it isn't a bootloader since it does not load anything. Writing your own bootloader from scratch is hard process. You need to first read the device that your bootloader is on (Flash drive , CD drive , harddrive ect) and then load the kernel. The kernel can not be linked (Unless it is SUPER small) because your bootloader can be no larger than 512 bytes. I would recommend using a third party bootloader like GRUB or syslinux. 

Developer
Aug 6, 2012 at 11:13 AM
How does this have anything to do with Cosmos?

On 6 August 2012 17:56, GruntXProductions <notifications@codeplex.com> wrote:

From: GruntXProductions

civilwarrock wrote:

Alright so I feel like a complete noob when saying this, but I need some help, I looked around and could never really find my answer. Alright so I have this "boot.asm" file I have been working on. Heres the code

[BITS 16]
[ORG 0x0000] ;Mark the offset 0
jmp     START

START:
         ; boot code located at 0000:7C00
         ;adjust Segment registeres
          mov     ax, 0x07C0
          mov     ds, ax
          mov     es, ax
          mov     fs, ax
          mov     gs, ax

          ;Load String to "si" register and call "DisplayMessage" Procedure 
          mov     si, helloWorld
          call    DisplayMessage


HANG: ;Infinite Loop to hang
            jmp HANG

;Procedure For Display String on Screen
DisplayMessage:
          lodsb                                       ; load next character
          or      al, al                              ; test for NUL character
          jz      .DONE
          mov     ah, 0x0E                            ; BIOS teletype
          mov     bh, 0x00                            ; display page 0
          mov     bl, 0x07                            ; text attribute
          int     0x10                                ; Call BIOS interrupt
          jmp     DisplayMessage
     .DONE:
          ret

      helloWorld db "Hello World!", 0x00 ; String to Print

      times 510-($-$) db 0
      dw 0AA55h ;Boot Signature

Now, how do I create a ISO, so that I may burn the ISO to a disk and then boot it, and have "Hello World" displayed? Sorry for my stupidness. Also, I know this is a boot loader, right? So you cant code your OS or Kernel here, how would you link the two? Thanks - Matt

I FEEL LIKE A RETARD. Oh well, thats how all beginners feel. XD Thanks for the help - Matt

Also civilwarrock , that code accomplished nothing but printing "Hello , World" on the screen. Technically it isn't a bootloader since it does not load anything. Writing your own bootloader from scratch is hard process. You need to first read the device that your bootloader is on (Flash drive , CD drive , harddrive ect) and then load the kernel. The kernel can not be linked (Unless it is SUPER small) because your bootloader can be no smaller than 512 bytes. I would recommend using a third party bootloader like GRUB or syslinux.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Aug 6, 2012 at 4:57 PM

Alright so I will most likely use the boot loader everyone else uses, which is "syslinux". Now can someone show me how to write hello world in a test kernel and link it to the bootloader and boot from a thumb drive? If someone can do that, that would be awesome. Cause I haven't found the sources on osdev or anywhere else that shows how to do this. Thanks - Matt

Coordinator
Aug 6, 2012 at 5:09 PM
Have you had a look at osdev.org?
It shows you about everything there is to learn....


On Mon, Aug 6, 2012 at 5:57 PM, civilwarrock <notifications@codeplex.com> wrote:

From: civilwarrock

Alright so I will most likely use the boot loader everyone else uses, which is "syslinux". Now can someone show me how to write hello world in a test kernel and link it to the bootloader and boot from a thumb drive? If someone can do that, that would be awesome. Cause I haven't found the sources on osdev or anywhere else that shows how to do this. Thanks - Matt

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Aug 6, 2012 at 5:17 PM
mterwoord wrote:
Have you had a look at osdev.org?
It shows you about everything there is to learn....


On Mon, Aug 6, 2012 at 5:57 PM, civilwarrock <notifications@codeplex.com> wrote:

From: civilwarrock

Alright so I will most likely use the boot loader everyone else uses, which is "syslinux". Now can someone show me how to write hello world in a test kernel and link it to the bootloader and boot from a thumb drive? If someone can do that, that would be awesome. Cause I haven't found the sources on osdev or anywhere else that shows how to do this. Thanks - Matt

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePolulex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


I have, but I never found my solution... I'm just bad at looking I think :). Thanks - Matt

Coordinator
Aug 6, 2012 at 5:29 PM
Start off by spending 1.5-2 hours reading up on the Introduction section of the osdev wiki: http://wiki.osdev.org/Main_Page


On Mon, Aug 6, 2012 at 6:17 PM, civilwarrock <notifications@codeplex.com> wrote:

From: civilwarrock

mterwoord wrote:
Have you had a look at osdev.org?
It shows you about everything there is to learn....


On Mon, Aug 6, 2012 at 5:57 PM, civilwarrock <notifications@codeplex.com> wrote:

From: civilwarrock

Alright so I will most likely use the boot loader everyone else uses, which is "syslinux". Now can someone show me how to write hello world in a test kernel and link it to the bootloader and boot from a thumb drive? If someone can do that, that would be awesome. Cause I haven't found the sources on osdev or anywhere else that shows how to do this. Thanks - Matt

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePolulex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


I have, but I never found my solution... I'm just bad at looking I think :). Thanks - Matt

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Developer
Aug 6, 2012 at 6:13 PM

Please take this to BonaFide, osdev forums, alt.os.development, this site is for Cosmos, not general OS dev.

Aug 6, 2012 at 6:21 PM
joshbeitler wrote:

Please take this to BonaFide, osdev forums, alt.os.development, this site is for Cosmos, not general OS dev.

No offence bro, but it is under "Off topic" for a reason :). - Matt

Developer
Aug 6, 2012 at 6:32 PM

Sorry, I'm reading this through email xD

Rant away!

Aug 6, 2012 at 6:33 PM

WHY DON"T I COME DOWN THERE AND HIT YOU IN YOUR BIG FAT HEAD

Developer
Aug 6, 2012 at 6:46 PM

Okay, I'm gonna tell you how I do it. You have one asm file right? I'm assuming you are using Linux. Assemble that into kernel.bin by using "nasm -f bin -o kernel.bin kernel.asm" (without quotes). Get GRUB and open up the archive. The files stage1 and stage2 should suffice for now. Create a pad file by doing "dd if=/dev/zero of=pad bs=1 count=750" (without quotes). Put these all in an img file by doing "cat stage1 stage2 pad kernel.bin > floppy.img" (again without quotes). You can now run this in qemu by doing "qemu -fda floppy.img" (Last time without quotes). If you would like to have a bootable cd that does not emulate a floppy disk, take a look at this tutorial: http://wiki.osdev.org/Bootable_El-Torito_CD_with_GRUB_Legacy

Aug 6, 2012 at 7:18 PM
ryann00b wrote:

WHY DON"T I COME DOWN THERE AND HIT YOU IN YOUR BIG FAT HEAD

Why don't I chop off your head and feed it to your dog you scum. Why don't you do the world a favor, and "Die". No one likes little kiddies who hack into codplex pages because they have nothing better to do, and I wouldn't threaten me, you won't last too long.

Aug 6, 2012 at 7:18 PM
scifiboi wrote:

Okay, I'm gonna tell you how I do it. You have one asm file right? I'm assuming you are using Linux. Assemble that into kernel.bin by using "nasm -f bin -o kernel.bin kernel.asm" (without quotes). Get GRUB and open up the archive. The files stage1 and stage2 should suffice for now. Create a pad file by doing "dd if=/dev/zero of=pad bs=1 count=750" (without quotes). Put these all in an img file by doing "cat stage1 stage2 pad kernel.bin > floppy.img" (again without quotes). You can now run this in qemu by doing "qemu -fda floppy.img" (Last time without quotes). If you would like to have a bootable cd that does not emulate a floppy disk, take a look at this tutorial: http://wiki.osdev.org/Bootable_El-Torito_CD_with_GRUB_Legacy

Thanks scifiboi, I will have to do that, now maybe I can finally get that Hello World, working off me thumb drive! Thanks - Matt

Aug 6, 2012 at 7:38 PM
ryann00b wrote:

WHY DON"T I COME DOWN THERE AND HIT YOU IN YOUR BIG FAT HEAD

Lol really why don't you do something productive instead of making threats you little creature.

Aug 6, 2012 at 7:50 PM

HOW DARE YOU? HOW DARE BOTH OF YOU!!!!!! I shall purge you at once! I will cast you both into the mists below for daring such blasphemy!!!!!!!!!

Developer
Aug 6, 2012 at 8:06 PM
ryann00b wrote:

HOW DARE YOU? HOW DARE BOTH OF YOU!!!!!! I shall purge you at once! I will cast you both into the mists below for daring such blasphemy!!!!!!!!!

What the hell dude? gtfo of here.

Aug 6, 2012 at 8:09 PM
Edited Aug 6, 2012 at 8:10 PM
ryann00b wrote:

HOW DARE YOU? HOW DARE BOTH OF YOU!!!!!! I shall purge you at once! I will cast you both into the mists below for daring such blasphemy!!!!!!!!!

I think we have a "Pot Smoker" here. Lets respond to him a nicely fashion so he won't kill us all "HOW DO YOU SMOKE YOUR WEED YOU PATHETIC APE, DO YOU KNOW WHO YOUR TALKING TO TROLL???". There, I think that was simple enough. XD. TRolls, gonna troll.

Aug 6, 2012 at 8:11 PM
civilwarrock wrote:
ryann00b wrote:

HOW DARE YOU? HOW DARE BOTH OF YOU!!!!!! I shall purge you at once! I will cast you both into the mists below for daring such blasphemy!!!!!!!!!

I think we have a "Pot Smoker" here. Lets respond to him a nicely fashion so he won't kill us all "HOW DO YOU SMOKE YOUR WEED YOU PATHETIC APE, DO YOU KNOW WHO YOUR TALKING TO TROLL???". There, I think that was simple enough. XD. TRolls, gonna troll.

NO I DONT KNOW WHO I AM TALKING TO. WHO AM I TALKING TO?

Aug 6, 2012 at 8:14 PM
ryann00b wrote:
civilwarrock wrote:
ryann00b wrote:

HOW DARE YOU? HOW DARE BOTH OF YOU!!!!!! I shall purge you at once! I will cast you both into the mists below for daring such blasphemy!!!!!!!!!

I think we have a "Pot Smoker" here. Lets respond to him a nicely fashion so he won't kill us all "HOW DO YOU SMOKE YOUR WEED YOU PATHETIC APE, DO YOU KNOW WHO YOUR TALKING TO TROLL???". There, I think that was simple enough. XD. TRolls, gonna troll.

NO I DONT KNOW WHO I AM TALKING TO. WHO AM I TALKING TO?

Three words. "Your Worst Nightmare".

Aug 6, 2012 at 8:17 PM
civilwarrock wrote:
ryann00b wrote:
civilwarrock wrote:
ryann00b wrote:

HOW DARE YOU? HOW DARE BOTH OF YOU!!!!!! I shall purge you at once! I will cast you both into the mists below for daring such blasphemy!!!!!!!!!

I think we have a "Pot Smoker" here. Lets respond to him a nicely fashion so he won't kill us all "HOW DO YOU SMOKE YOUR WEED YOU PATHETIC APE, DO YOU KNOW WHO YOUR TALKING TO TROLL???". There, I think that was simple enough. XD. TRolls, gonna troll.

NO I DONT KNOW WHO I AM TALKING TO. WHO AM I TALKING TO?

Three words. "Your Worst Nightmare".

YOU CAN NOT DO ANYTHING TO HURT ME!!!!!! I AM PRECINCT!!!!

Developer
Aug 6, 2012 at 8:21 PM
Edited Aug 6, 2012 at 8:21 PM

Children, at least take this to the IRC because I don't wanna wake up to 3,000 new emails from this discussion. (._. )

Aug 6, 2012 at 8:21 PM

Ryan scared? Gonna go cry for his mommy? Don't worry Ryan..... Well leave a scrap of you for your dog.

Aug 6, 2012 at 8:26 PM
scifiboi wrote:

Children, at least take this to the IRC because I don't wanna wake up to 3,000 new emails from this discussion. (._. )

I agree, Ryan go take a hike, and fall of the cliff while your at it. We don't need little kiddies here. Because I don't think you want to make a few 30 or more people all raging at you. Sorry, but you will lose.

Coordinator
Aug 6, 2012 at 9:11 PM
On 8/6/2012 3:26 PM, civilwarrock wrote:
> I agree, Ryan go take a hike, and fall of the cliff while your at it. We

Please don't feed trolls.
Developer
Aug 7, 2012 at 1:53 AM

This is why I suggested we have proper forum software like vbulletin

Developer
Aug 7, 2012 at 2:48 AM

I know!

On Aug 7, 2012 12:54 AM, "CMan332" <notifications@codeplex.com> wrote:

From: CMan332

This is why I suggested we have proper forum software like vbulletin

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Coordinator
Aug 7, 2012 at 7:55 AM
Huh? doesn't have to do anything with the software....

On Tue, Aug 7, 2012 at 3:48 AM, joshbeitler <notifications@codeplex.com> wrote:

From: joshbeitler

I know!

On Aug 7, 2012 12:54 AM, "CMan332" <notifications@codeplex.com> wrote:

From: CMan332

This is why I suggested we have proper forum software like vbulletin

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Aug 8, 2012 at 4:12 PM
CMan332 wrote:

This is why I suggested we have proper forum software like vbulletin

I agree, I wish I had that feature on my forums. The ryann guy came on and started stirring up some trouble. If we had a real forum, we could have ban ip, or the account itself. - Matt

Coordinator
Aug 8, 2012 at 4:13 PM

Yes said some thing. But best to just ignore him in public IMO...

Op 8 aug. 2012 17:12 schreef "civilwarrock" <notifications@codeplex.com> het volgende:

From: civilwarrock

CMan332 wrote:

This is why I suggested we have proper forum software like vbulletin

I agree, I wish I had that feature on my forums. The ryann guy came on and started stirring up some trouble. If we had a real forum, we could have ban ip, or the account itself. - Matt

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Coordinator
Aug 8, 2012 at 4:17 PM
On 8/8/2012 11:12 AM, civilwarrock wrote:
> I agree, I wish I had that feature on my forums. The ryann guy came on
> and started stirring up some trouble. If we had a real forum, we could
> have ban ip, or the account itself. - Matt

You can do it on CP too, just contact the CP admins.
Aug 8, 2012 at 5:11 PM
kudzu wrote:
On 8/8/2012 11:12 AM, civilwarrock wrote:
> I agree, I wish I had that feature on my forums. The ryann guy came on
> and started stirring up some trouble. If we had a real forum, we could
> have ban ip, or the account itself. - Matt

You can do it on CP too, just contact the CP admins.

Yeah I contacted them. He hacked my page, and hacked grunts site, got my password and all his user's passwords and information. Hes stirred up quite the trouble. Well see what codeplex does about it. Thanks - Matt

Aug 8, 2012 at 6:12 PM
Edited Aug 8, 2012 at 6:14 PM

Wait did you report it? I have a microsoft employee from codeplex trying to contact me , it is really weird but he will not say what he wants.

Aug 8, 2012 at 9:35 PM
GruntXProductions wrote:

Wait did you report it? I have a microsoft employee from codeplex trying to contact me , it is really weird but he will not say what he wants.

Yeah I did. So that would be him. Answer what he asks, so they can take care of Ryann. Thanks - Matt