How to prepare floppy image for Bochs

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
yee1
Member
Member
Posts: 42
Joined: Sun Feb 10, 2013 4:02 pm

How to prepare floppy image for Bochs

Post by yee1 »

I have my code doing: move from real to protected mode with paging and some basic user interface (command line)
I am currently running it with dosbox :oops:

How to prepare floppy disk image for bochs and run it (using fat12 for example) ?
Are there any tutorials about this ?

I really don't know how to deal with bochs, it seems to be strange... is it possible there to debugg and view registers status, read operation memory (ram) ?

Hope to get some info about bochs but i am starting to have troubles with developing my os, and i need now to start debugging/view registers status/read operation memory, thank you!
User avatar
iansjack
Member
Member
Posts: 4711
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: How to prepare floppy image for Bochs

Post by iansjack »

I'd say that your first step should be to read the Bochs documentation. There seems little point in people repeating here what is adequately dealt with there.
Rew
Member
Member
Posts: 28
Joined: Mon Oct 29, 2012 2:26 pm

Re: How to prepare floppy image for Bochs

Post by Rew »

You are asking 2 different questions.

Bochs is able to load any standard bootable disk. Without knowing how you were loading your code in dosbox, I'll just give you the options to make this happen. (described in http://wiki.osdev.org/Bootloader)

1. Use a pre-established bootloader and have it load your kernel (Grub is one example of this. http://wiki.osdev.org/GRUB)
2. Write your own bootloader and install it to the boot sector of a floppy image. (http://wiki.osdev.org/Rolling_Your_Own_Bootloader)

There is a 3rd option as well. If you use QEMU, it can boot directly into any multiboot compliant application without a bootloader. While not a long term development option, it is rather beneficial in the early stages.


Your other question is about how to debug in bochs. iansjack so helpfully refered you to the bochs documentation. In there, you will find that bochs has several modes of debugging. The first mode uses a built in debugger that will pop up a window and you can interact with the memory, registers, etc. Another mode allows you to attach a gdb debugger to bochs and actually debug your application in code. The built in debugger is easier to setup and probably more relevant for the stage that you are at, while the "real" debugger is a better long term option but requires more setup with your IDE/compiler chain.

-http://wiki.osdev.org/Bochs#Bochs_debugging_facilities
-http://bochs.sourceforge.net/doc/docboo ... ugger.html
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: How to prepare floppy image for Bochs

Post by egos »

There are many tools to prepare floppy image. Usually I use my old mkfloppy sources. I'm working from time to time on new style mkfatxx (new style mkfat12 will replace old mkfloppy/mkfat12 soon). For example:

Code: Select all

include "mkfat12.inc"

; use predefined volume size and calculate fat size automatically
fixed_availablesectors=2*80*18

; reset default values of some parameters
fixed_rootsize=14 ; sectors
fixed_media=0F0h
fixed_spt=18
fixed_heads=2

file "boot.bin"

orgd
  stof "content/grub.pk","GRUB    PK"
  stof "content/menu.lst","MENU    LST"
  orgd "SYSTEM"
    stof "content/system/kernel.bin","KERNEL  BIN"
  find
find
If you have seen bad English in my words, tell me what's wrong, please.
Post Reply