4 Replies - 621 Views - Last Post: 13 September 2011 - 10:41 AM

#1 Dohrann_Matt  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 46
  • Joined: 22-February 11

Operating System VBR in x86 ASM

Posted 09 September 2011 - 12:09 PM

So I have to write the VBR for an operating system using x86 Assembly language. We were giving a codeblocks project with the majority starting OS, which basically just boots up to the VBR being loaded point and halts. Our job is to code the VBR to load 3 files we created onto the disk, then print the names of these files on the screen. So we have the basic VBR code:

	jmp x
.rep 64
	nop
.endr
x:
        mov $0x7c00, %esp   // register esp is stack pointer
        hlt



Out code will go under x:

We modified the makefile to include these 3 files, (they are just dummy files at the moment, it is leading up to loading .bin files/c files/etc. I believe), it was given to us, it is correct. I cannot quite wrap my head around how to acquire the files, write them to the disk, then print them. Tips are greatly appreciated.

Also, this is the code I have to grab data (the files) from a sector,
    mov $0x1f3, %dx     //Grabs sector
    out %al, %dx
    shr $1, %eax
    inc %dx
    out %al, %dx



Thanks D.I.C.,
Troubled Student

This post has been edited by Dohrann_Matt: 09 September 2011 - 12:09 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Operating System VBR in x86 ASM

#2 Aphex19  Icon User is offline

  • Born again Pastafarian.
  • member icon

Reputation: 614
  • View blog
  • Posts: 1,873
  • Joined: 02-August 09

Re: Operating System VBR in x86 ASM

Posted 09 September 2011 - 04:07 PM

What file system does the operating system use?
Was This Post Helpful? 0
  • +
  • -

#3 Dohrann_Matt  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 46
  • Joined: 22-February 11

Re: Operating System VBR in x86 ASM

Posted 09 September 2011 - 06:56 PM

View PostAphex19, on 09 September 2011 - 04:07 PM, said:

What file system does the operating system use?


I am unsure. Im emulating the processor using Qemu. Running everything in Windows. So I assume it is using Windows file system.
Was This Post Helpful? 0
  • +
  • -

#4 Aphex19  Icon User is offline

  • Born again Pastafarian.
  • member icon

Reputation: 614
  • View blog
  • Posts: 1,873
  • Joined: 02-August 09

Re: Operating System VBR in x86 ASM

Posted 11 September 2011 - 12:22 PM

Find out what file system (if any) the OS uses, that's the first step. You have a way to read your storage medium, so just ask your professor (if this is an assignment that is) what file system it uses and go from there.
Was This Post Helpful? 0
  • +
  • -

#5 Dohrann_Matt  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 46
  • Joined: 22-February 11

Re: Operating System VBR in x86 ASM

Posted 13 September 2011 - 10:41 AM

View PostAphex19, on 11 September 2011 - 12:22 PM, said:

Find out what file system (if any) the OS uses, that's the first step. You have a way to read your storage medium, so just ask your professor (if this is an assignment that is) what file system it uses and go from there.



It does not use a file system. Using Qemu as an emulator of the x86 processor, we need to code the VBR to load the kernel, which holds certain operations we know work correctly (it will print some message like, it works, or something). So the goal is to read sectors, find out where it is on the disk, load it, and transfer control to the kernel. Im unsure how to read sectors and load them, and transfer the control to the kernel file called asmKernel.s
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1