Just want to say hi + Need info specific to the stage im at
-
- Member
- Posts: 65
- Joined: Wed Nov 14, 2007 3:19 pm
Just want to say hi + Need info specific to the stage im at
Firstly I hope this is in the correct place! Here hopefully endeth my silly posts. Anyway I plan to be doing some major reading in the next few months at least. Approximately 1 year ago I really started major reading in the hope of getting a very small OS of the ground. It was hard to get the info, but I mananged to get my OS bootstrapped (No great achievement compared to what many of you have done but still )
I then messed with assembly language, started printing mere text to the screen and practiced putting stuff on and off the stack. My OS(Have a cheek even calling it this I know ) booted from a floppy disk. The next step was to get some c functions setup, but this is where it all fell over. Getting specific info on how to setup some limited c language commands was difficult, I found that there was many guides who basically showed how to bootstrap and at the end said C was easy to setup but none explained how this was done.
The above was to give people an idea of the stage Im at. Finally hi all , Im preparing to do alot more reading and be on the forums for a while.
This may be the wrong place but here are the current links I plan to read and go through:
http://www.osdev.org/osfaq2/
http://novian.web.ugm.ac.id/os.php
http://www.oberon.ethz.ch/
http://www.amd.com/us-en/Processors/Dev ... 44,00.html (This time around I realise im going to need these books +intel books even though they give me headaches lol)
http://my.execpc.com/~geezer/osd/alpha.htm
http://www.scilutions.co.uk/PCs.htm
http://linuxgazette.net/issue77/krishnakumar.html
If anyone can point me in the direction of other links preferably which take you through step by step getting some limited form of c installed it would be greatly appreciated as this is where I fell over last time. The plan is to use bochs to test my OS, where it was on a floppy disk last time I want to install it on a partitioned drive this time, get serious and get some memmory management and printing functions from c on, after really getting accustomed to this limited system using my limited c command then see about much later getting my head around getting into protected mode
Thanks! - (I need as much info as possible so any additions to the thread are welcome)
I then messed with assembly language, started printing mere text to the screen and practiced putting stuff on and off the stack. My OS(Have a cheek even calling it this I know ) booted from a floppy disk. The next step was to get some c functions setup, but this is where it all fell over. Getting specific info on how to setup some limited c language commands was difficult, I found that there was many guides who basically showed how to bootstrap and at the end said C was easy to setup but none explained how this was done.
The above was to give people an idea of the stage Im at. Finally hi all , Im preparing to do alot more reading and be on the forums for a while.
This may be the wrong place but here are the current links I plan to read and go through:
http://www.osdev.org/osfaq2/
http://novian.web.ugm.ac.id/os.php
http://www.oberon.ethz.ch/
http://www.amd.com/us-en/Processors/Dev ... 44,00.html (This time around I realise im going to need these books +intel books even though they give me headaches lol)
http://my.execpc.com/~geezer/osd/alpha.htm
http://www.scilutions.co.uk/PCs.htm
http://linuxgazette.net/issue77/krishnakumar.html
If anyone can point me in the direction of other links preferably which take you through step by step getting some limited form of c installed it would be greatly appreciated as this is where I fell over last time. The plan is to use bochs to test my OS, where it was on a floppy disk last time I want to install it on a partitioned drive this time, get serious and get some memmory management and printing functions from c on, after really getting accustomed to this limited system using my limited c command then see about much later getting my head around getting into protected mode
Thanks! - (I need as much info as possible so any additions to the thread are welcome)
-
- Member
- Posts: 65
- Joined: Wed Nov 14, 2007 3:19 pm
Just to add I do have SOME computer science experiance , I can do hex conversions etc and have some assembly lqanguage experiance , I have also got 2 addison wesley books which were 100% theory about threading, and context switching and the alike, I really need some applied info at this point. I just added this since Im currently reading the forum atm - just to get up to date with whats expected on here
From what I can gather I need to get gcc and a linker on my system . Anyway by tommrow I will have my system bootstrapped , I realise theres maybe much more I can do before putting c on but I really want just malloc and a cut down version of printf on for easier testing.
From what I can gather I need to get gcc and a linker on my system . Anyway by tommrow I will have my system bootstrapped , I realise theres maybe much more I can do before putting c on but I really want just malloc and a cut down version of printf on for easier testing.
It looks like a nice list to me
I can probably point you to my site: Clicky ...as it covers step by step developing a 32bit OS for beginners. Currently, it only covers setting up MSVC++ though, so please consider that.
Most members here does use GCC. (I personally used GCC, DJGPP, and MSVC++ successfully in OS dev--they all have their pros and cons.)
*edit:
Another good link
I hope this helps, and good luck
I can probably point you to my site: Clicky ...as it covers step by step developing a 32bit OS for beginners. Currently, it only covers setting up MSVC++ though, so please consider that.
Most members here does use GCC. (I personally used GCC, DJGPP, and MSVC++ successfully in OS dev--they all have their pros and cons.)
*edit:
Another good link
I hope this helps, and good luck
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
-
- Member
- Posts: 65
- Joined: Wed Nov 14, 2007 3:19 pm
Hi thanks very much for taking the time to reply, since posting I have come across
http://www.osdever.net/bkerndev/index.php
The thing is I know have the basic idea of how to get c functions in my os maybe tommrow I will get you folks just to che3ck the c code is ok? Its just the c code errored by default , 2 minor errors one being a missing semi colon, all it gives now are wqarning 0 errors but it would be good to get the 2 funtion checked.
Im going to try and boot my os up tommrow, and even though I am reading the aforementioned site I will check your own site as I need as much info and differant peoples angles as possible
Thanks very much for replying I should be good to go tommrow ) everything compiled and linked , its just a matter of running it of a bootable floppy
Cheers
http://www.osdever.net/bkerndev/index.php
The thing is I know have the basic idea of how to get c functions in my os maybe tommrow I will get you folks just to che3ck the c code is ok? Its just the c code errored by default , 2 minor errors one being a missing semi colon, all it gives now are wqarning 0 errors but it would be good to get the 2 funtion checked.
Im going to try and boot my os up tommrow, and even though I am reading the aforementioned site I will check your own site as I need as much info and differant peoples angles as possible
Thanks very much for replying I should be good to go tommrow ) everything compiled and linked , its just a matter of running it of a bootable floppy
Cheers
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
If you liked Brandon's kernel development tutorial, maybe you might try mine? http://www.jamesmolloy.co.uk. They're very similar, use GRUB and C for most things so should give you some idea of where you can go.
-
- Member
- Posts: 65
- Joined: Wed Nov 14, 2007 3:19 pm
Awsome folks, thanks so much for the links - tbh when I attempted this one year ago this was my greatest problem getting good info so the links are appreciated. I also didnt know that the faq2 was a dated version of the wiki. Im definately going to go through all these sites
I have heaps of purchased c books so I should hopefully be okay there, I have even been considering buying that indespensable hardware book and the reccomended compilers one but they are very expensive, I realise you get what you pay for but I remember paying over £100 for an assembly language book and It didnt have much practical info in it. Everywhere I go I see the books reccomended on this site get spoken of very highly so i will no doubt buy but it would be good to be able to get a site which shows you 2 or 3 chapters just so I have some idea of whether the books mostly threory or practice. Hehe maybe I will just bite the bullet and buy both : indespensable hardware + compilers book
Also are these warnings ok?
scrn.c:24: warning: passing argument 1 of 'memcpy' from incompatible pointer typ
e
scrn.c:24: warning: passing argument 2 of 'memcpy' from incompatible pointer typ
e
scrn.c:139: warning: pointer targets in passing argument 1 of 'strlen' differ in
signedness
heres the puts function in scrn.c
and heres the puts call in main.c
next heres the strl function in main.c
heres memcpy from main.c
finally heres where memcpy is called from the scroll function in scrn.c
Maybe those warnings are nothing to worry about but just thought I would ask as Im a little rusty with c , the last time I did it I made the classic begginer mistake of having to write my own bootloader plus do most in assembly , this time Im going to use the tools available to get me off the ground in some form of semi decent testing enviroment.
Im going to test this in 30 mins then check the other sites provided
Thanks!
I have heaps of purchased c books so I should hopefully be okay there, I have even been considering buying that indespensable hardware book and the reccomended compilers one but they are very expensive, I realise you get what you pay for but I remember paying over £100 for an assembly language book and It didnt have much practical info in it. Everywhere I go I see the books reccomended on this site get spoken of very highly so i will no doubt buy but it would be good to be able to get a site which shows you 2 or 3 chapters just so I have some idea of whether the books mostly threory or practice. Hehe maybe I will just bite the bullet and buy both : indespensable hardware + compilers book
Also are these warnings ok?
scrn.c:24: warning: passing argument 1 of 'memcpy' from incompatible pointer typ
e
scrn.c:24: warning: passing argument 2 of 'memcpy' from incompatible pointer typ
e
scrn.c:139: warning: pointer targets in passing argument 1 of 'strlen' differ in
signedness
heres the puts function in scrn.c
Code: Select all
void puts(unsigned char *text)
{
int i;
for (i = 0; i < strlen(text); i++)
{
putch(text[i]);
}
}
and heres the puts call in main.c
Code: Select all
puts("Hello World!\n");
Code: Select all
size_t strlen(const char *str)
{
size_t retval;
for(retval = 0; *str != '\0'; str++) retval++;
return retval;
}
Code: Select all
unsigned char * memcpy(unsigned char *dest, const unsigned char *src, int count)
{
/*add code here to copy 'count' bytes of data from src to dest then finally return
dest*/
const char *sp = (const char *)src;
char *dp = (char *)dest;
for(; count != 0; count--) *dp++ = *sp++;
return dest;
}
Code: Select all
void scroll(void)
{
unsigned blank, temp;
/* A blank is defined as a space... we need to give it
* backcolor too */
blank = 0x20 | (attrib << 8);
/* Row 25 is the end, this means we need to scroll up */
if(csr_y >= 25)
{
/* Move the current text chunk that makes up the screen
* back in the buffer by a line */
temp = csr_y - 25 + 1;
memcpy (textmemptr, textmemptr + temp * 80, (25 - temp) * 80 * 2);
/* Finally, we set the chunk of memory that occupies
* the last line of text to our 'blank' character */
memsetw (textmemptr + (25 - temp) * 80, blank, 80);
csr_y = 25 - 1;
}
}
Im going to test this in 30 mins then check the other sites provided
Thanks!
Those warnings are fine, but here's how to alleviate them:
Change that to 'const char*' or just 'char*', and the warning will go away. (With a C++ compiler only the first will work).void puts(unsigned char *text)
I assume textmemptr is signed? Change it to unsigned to get rid of the problem. Either that or it's a 'short *', in which case make sure you cast it to an (unsigned char *) when calling memcpy.memcpy (textmemptr, textmemptr + temp * 80, (25 - temp) * 80 * 2);
Better, I think, is to change the type of memcpy toJamesM wrote:I assume textmemptr is signed? Change it to unsigned to get rid of the problem. Either that or it's a 'short *', in which case make sure you cast it to an (unsigned char *) when calling memcpy.
Code: Select all
void * memcpy(void *dest, const void *src, int count).
-
- Member
- Posts: 65
- Joined: Wed Nov 14, 2007 3:19 pm
Thank you As it turns out I had to use a combination of what you both said just maybe 3 subtle changes but actually in brans tutorial at an extreme minority of parts if you follow it word for word you end up with an incorrect prototype for a function and It had me scratching my head a bit.
e.g
void *memcpy(void *dest, const void *src, size_t count){
}
^^ the main memcpy function
then another example of the same function in main (later on)
unsigned char *memcpy(unsigned char *dest, const unsigned char *src, int count)
{
/* Add code here to copy 'count' bytes of data from 'src' to
* 'dest', finally return 'dest' */
}
Obviously its still a great guide but just getting into the way of programming again things like that can cause headaches
On the plus side the only warning I get now is about main not retirning an int. So things are looking good , I hope you dont mind but I am going to submit the code for all my c source files.
SYSTEM.H FILE:----------------------------------------------
SYSTEM.H FILE END:----------------------------------------------
MAIN.C FILE--------------------------------------------------------
MAIN.C FILE END---------------------------------------------------
SCRN.H FILE:--------------------------------------------------------
SCRN.H FILE END---------------------------------------------------
START.ASM FILE:----------------------------------------------------
START.ASM FILE END------------------------------------------------
Going by the compile and linking results things should be okay but then again just because a compiler finds code fine doest mean its going to work hehe. Heres hoping! does that look ok to you folks? changes I had to make were:
change memcpy prototype
void * memcpy(void *dest, const void *src, int count).
change strlen function and prototype from unsigned char to char *
int strlen(char *str)
Inside the strlen function as it was using the term size_t retval; which was causing an error straight away, see strlen for my small change.
Hope this now works gonna try after grabbing something to eat! and will prob check those other sites
e.g
void *memcpy(void *dest, const void *src, size_t count){
}
^^ the main memcpy function
then another example of the same function in main (later on)
unsigned char *memcpy(unsigned char *dest, const unsigned char *src, int count)
{
/* Add code here to copy 'count' bytes of data from 'src' to
* 'dest', finally return 'dest' */
}
Obviously its still a great guide but just getting into the way of programming again things like that can cause headaches
On the plus side the only warning I get now is about main not retirning an int. So things are looking good , I hope you dont mind but I am going to submit the code for all my c source files.
SYSTEM.H FILE:----------------------------------------------
Code: Select all
#ifndef __SYSTEM_H
#define __SYSTEM_H
extern void *memcpy(void *dest, void *src, int count);
extern unsigned char *memset(unsigned char *dest, unsigned char val, int count);
extern unsigned short *memsetw(unsigned short *dest, unsigned short val, int count);
extern int strlen(char *str);
extern unsigned char inportb (unsigned short _port);
extern void outportb (unsigned short _port, unsigned char _data);
extern void cls();
extern void putch(unsigned char c);
extern void puts(char *str);
extern void settextcolor(unsigned char forecolor, unsigned char backcolor);
extern void init_video();
#endif
MAIN.C FILE--------------------------------------------------------
Code: Select all
#include<system.h>
void *memcpy(void *dest, void *src, int count)
{
/* Add code here to copy 'count' bytes of data from 'src' to
* 'dest', finally return 'dest' */
const char *sp = (const char *)src;
char *dp = (char *)dest;
for(; count != 0; count--) *dp++ = *sp++;
return dest;
}
unsigned char *memset(unsigned char *dest, unsigned char val, int count)
{
/* Add code here to set 'count' bytes in 'dest' to 'val'.
* Again, return 'dest' */
char *temp = (char *)dest;
for( ; count != 0; count--) *temp++ = val;
return dest;
}
unsigned short *memsetw(unsigned short *dest, unsigned short val, int count)
{
/* Same as above, but this time, we're working with a 16-bit
* 'val' and dest pointer. Your code can be an exact copy of
* the above, provided that your local variables if any, are
* unsigned short */
unsigned short *temp = (unsigned short *)dest;
for( ; count != 0; count--) *temp++ = val;
return dest;
}
int strlen(char *str)
{
/* This loops through character array 'str', returning how
* many characters it needs to check before it finds a 0.
* In simple words, it returns the length in bytes of a string */
//previous code was : size_t retval; which size_t was erroring as an unknown type
int retval;
retval = 0;
for(retval = 0; *str != '\0'; str++) retval++;
return retval;
}
/* We will use this later on for reading from the I/O ports to get data
* from devices such as the keyboard. We are using what is called
* 'inline assembly' in these routines to actually do the work */
unsigned char inportb (unsigned short _port)
{
unsigned char rv;
__asm__ __volatile__ ("inb %1, %0" : "=a" (rv) : "dN" (_port));
return rv;
}
/* We will use this to write to I/O ports to send bytes to devices. This
* will be used in the next tutorial for changing the textmode cursor
* position. Again, we use some inline assembly for the stuff that simply
* cannot be done in C */
void outportb (unsigned short _port, unsigned char _data)
{
__asm__ __volatile__ ("outb %1, %0" : : "dN" (_port), "a" (_data));
}
/* This is a very simple main() function. All it does is sit in an
* infinite loop. This will be like our 'idle' loop */
void main()
{
/* You would add commands after here */
__asm__ __volatile__ ("sti");
puts("Hello World!\n");
/* ...and leave this loop in. There is an endless loop in
* 'start.asm' also, if you accidentally delete this next line */
for (;;);
}
SCRN.H FILE:--------------------------------------------------------
Code: Select all
#include <system.h>
/* These define our textpointer, our background and foreground
* colors (attributes), and x and y cursor coordinates */
unsigned short *textmemptr;
int attrib = 0x0F;
int csr_x = 0, csr_y = 0;
/* Scrolls the screen */
void scroll(void)
{
unsigned blank, temp;
/* A blank is defined as a space... we need to give it
* backcolor too */
blank = 0x20 | (attrib << 8);
/* Row 25 is the end, this means we need to scroll up */
if(csr_y >= 25)
{
/* Move the current text chunk that makes up the screen
* back in the buffer by a line */
temp = csr_y - 25 + 1;
memcpy (textmemptr, textmemptr + temp * 80, (25 - temp) * 80 * 2);
/* Finally, we set the chunk of memory that occupies
* the last line of text to our 'blank' character */
memsetw (textmemptr + (25 - temp) * 80, blank, 80);
csr_y = 25 - 1;
}
}
/* Updates the hardware cursor: the little blinking line
* on the screen under the last character pressed! */
void move_csr(void)
{
unsigned temp;
/* The equation for finding the index in a linear
* chunk of memory can be represented by:
* Index = [(y * width) + x] */
temp = csr_y * 80 + csr_x;
/* This sends a command to indicies 14 and 15 in the
* CRT Control Register of the VGA controller. These
* are the high and low bytes of the index that show
* where the hardware cursor is to be 'blinking'. To
* learn more, you should look up some VGA specific
* programming documents. A great start to graphics:
* http://www.brackeen.com/home/vga */
outportb(0x3D4, 14);
outportb(0x3D5, temp >> 8);
outportb(0x3D4, 15);
outportb(0x3D5, temp);
}
/* Clears the screen */
void cls()
{
unsigned blank;
int i;
/* Again, we need the 'short' that will be used to
* represent a space with color */
blank = 0x20 | (attrib << 8);
/* Sets the entire screen to spaces in our current
* color */
for(i = 0; i < 25; i++)
memsetw (textmemptr + i * 80, blank, 80);
/* Update out virtual cursor, and then move the
* hardware cursor */
csr_x = 0;
csr_y = 0;
move_csr();
}
/* Puts a single character on the screen */
void putch(unsigned char c)
{
unsigned short *where;
unsigned att = attrib << 8;
/* Handle a backspace, by moving the cursor back one space */
if(c == 0x08)
{
if(csr_x != 0) csr_x--;
}
/* Handles a tab by incrementing the cursor's x, but only
* to a point that will make it divisible by 8 */
else if(c == 0x09)
{
csr_x = (csr_x + 8) & ~(8 - 1);
}
/* Handles a 'Carriage Return', which simply brings the
* cursor back to the margin */
else if(c == '\r')
{
csr_x = 0;
}
/* We handle our newlines the way DOS and the BIOS do: we
* treat it as if a 'CR' was also there, so we bring the
* cursor to the margin and we increment the 'y' value */
else if(c == '\n')
{
csr_x = 0;
csr_y++;
}
/* Any character greater than and including a space, is a
* printable character. The equation for finding the index
* in a linear chunk of memory can be represented by:
* Index = [(y * width) + x] */
else if(c >= ' ')
{
where = textmemptr + (csr_y * 80 + csr_x);
*where = c | att; /* Character AND attributes: color */
csr_x++;
}
/* If the cursor has reached the edge of the screen's width, we
* insert a new line in there */
if(csr_x >= 80)
{
csr_x = 0;
csr_y++;
}
/* Scroll the screen if needed, and finally move the cursor */
scroll();
move_csr();
}
/* Uses the above routine to output a string... */
void puts(char *text)
{
int i;
for (i = 0; i < strlen(text); i++)
{
putch(text[i]);
}
}
/* Sets the forecolor and backcolor that we will use */
void settextcolor(unsigned char forecolor, unsigned char backcolor)
{
/* Top 4 bytes are the background, bottom 4 bytes
* are the foreground color */
attrib = (backcolor << 4) | (forecolor & 0x0F);
}
/* Sets our text-mode VGA pointer, then clears the screen for us */
void init_video(void)
{
textmemptr = (unsigned short *)0xB8000;
cls();
}
START.ASM FILE:----------------------------------------------------
Code: Select all
; This is the kernel's entry point. We could either call main here,
; or we can use this to setup the stack or other nice stuff, like
; perhaps setting up the GDT and segments. Please note that interrupts
; are disabled at this point: More on interrupts later!
[BITS 32]
global start
start:
mov esp, _sys_stack ; This points the stack to our new stack area
jmp stublet
; This part MUST be 4byte aligned, so we solve that issue using 'ALIGN 4'
ALIGN 4
mboot:
; Multiboot macros to make a few lines later more readable
MULTIBOOT_PAGE_ALIGN equ 1<<0
MULTIBOOT_MEMORY_INFO equ 1<<1
MULTIBOOT_AOUT_KLUDGE equ 1<<16
MULTIBOOT_HEADER_MAGIC equ 0x1BADB002
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_AOUT_KLUDGE
MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
EXTERN code, bss, end
; This is the GRUB Multiboot header. A boot signature
dd MULTIBOOT_HEADER_MAGIC
dd MULTIBOOT_HEADER_FLAGS
dd MULTIBOOT_CHECKSUM
; AOUT kludge - must be physical addresses. Make a note of these:
; The linker script fills in the data for these ones!
dd mboot
dd code
dd bss
dd end
dd start
; This is an endless loop here. Make a note of this: Later on, we
; will insert an 'extern _main', followed by 'call _main', right
; before the 'jmp $'.
stublet:
extern _main
call _main
jmp $
; Shortly we will add code for loading the GDT right here!
; In just a few pages in this tutorial, we will add our Interrupt
; Service Routines (ISRs) right here!
; Here is the definition of our BSS section. Right now, we'll use
; it just to store the stack. Remember that a stack actually grows
; downwards, so we declare the size of the data before declaring
; the identifier '_sys_stack'
SECTION .bss
resb 8192 ; This reserves 8KBytes of memory here
_sys_stack:
Going by the compile and linking results things should be okay but then again just because a compiler finds code fine doest mean its going to work hehe. Heres hoping! does that look ok to you folks? changes I had to make were:
change memcpy prototype
void * memcpy(void *dest, const void *src, int count).
change strlen function and prototype from unsigned char to char *
int strlen(char *str)
Inside the strlen function as it was using the term size_t retval; which was causing an error straight away, see strlen for my small change.
Hope this now works gonna try after grabbing something to eat! and will prob check those other sites
-
- Member
- Posts: 65
- Joined: Wed Nov 14, 2007 3:19 pm
I havent fired the above code up yet , Im actually reading http://www.brokenthorn.com/Resources/OSDev2.html
I figure now that I know theres practical stuff to get c integrated I need to just go over the processes involved in starting the OS again. Im not usually one who relishes computer history but in the case of the above site , its actually interesting and lets me know where certain terms originated which aint a bad thing considering what Im attempting to learn .
Im basically going to follow all the provided sites word for word and see what I end up with and hopefully should pick differant things up as well as re-enforce concepts along the way.
edit::
I will let this thread die now but just to finally say the explination on this page http://www.brokenthorn.com/Resources/OSDev3.html regarding the boot signature , the statement times 510 - ($-$$) db 0 and a host of other stuff is excellant. Think Im going to stick with this site for the time being .
I figure now that I know theres practical stuff to get c integrated I need to just go over the processes involved in starting the OS again. Im not usually one who relishes computer history but in the case of the above site , its actually interesting and lets me know where certain terms originated which aint a bad thing considering what Im attempting to learn .
Im basically going to follow all the provided sites word for word and see what I end up with and hopefully should pick differant things up as well as re-enforce concepts along the way.
edit::
I will let this thread die now but just to finally say the explination on this page http://www.brokenthorn.com/Resources/OSDev3.html regarding the boot signature , the statement times 510 - ($-$$) db 0 and a host of other stuff is excellant. Think Im going to stick with this site for the time being .
-
- Member
- Posts: 65
- Joined: Wed Nov 14, 2007 3:19 pm
Not sure if its something ive done but I copied and pasted nearly everything and when I goto start simulation with bochs I get an error:
System bios must end at 0xfffff
I pretty confident the codes identical to the site and I have run a bootloader on bochs before its just the site uses its own config file and I want to also use a light weight config, anyway I already have a floppy a drive (Real one not emaulated) so I put b where in the tutorial it puts a, here are the parts Im thinking may be causing this error
Maybe:
The part where the tutorial says to run the following commands with part copy to copy certain floppy sectors to an emulated dloppy drive e.g
PARTCOPY Boot1.bin 0 3 -f0 0
PARTCOPY Boot1.bin 3E 1C2 -f0 3E
[I have a B: drive emulated so I put in
PARTCOPY Boot1.bin 0 3 -f1 0
PARTCOPY Boot1.bin 3E 1C2 -f1 3E
OR
next it says type up the following bochs config
and finally it could well be my boot code of course but I just copied an pasted whats on the site then copied to my emulated floppy b with the partcopy commands one and 2
boot1.asm
I actually like the way this guide is going as its just doing things small to start with but I feel a bit silly getting an error at bochs right of the bat when I had it working in the past , the site says check the code but Im pretty sure its ok ? Any ideas .....all my codes in this post
EDIT ok seemingly stuff in bochs has changed see
http://www.nabble.com/Strange-error-mes ... 01341.html
I because of the link altered my config file as below but now It loads quite a bit further but them I get no bootable device
romimage: file = BIOS-bochs-legacy , address=0xf0000
vgaromimage: file=VGABIOS-lgpl-latest # boot from floppy using our disk image -------------------------------
floppyb: 1_44=b:, status=inserted
boot: disk
boot: floppy
error: action=report
info: action=report
System bios must end at 0xfffff
I pretty confident the codes identical to the site and I have run a bootloader on bochs before its just the site uses its own config file and I want to also use a light weight config, anyway I already have a floppy a drive (Real one not emaulated) so I put b where in the tutorial it puts a, here are the parts Im thinking may be causing this error
Maybe:
The part where the tutorial says to run the following commands with part copy to copy certain floppy sectors to an emulated dloppy drive e.g
PARTCOPY Boot1.bin 0 3 -f0 0
PARTCOPY Boot1.bin 3E 1C2 -f0 3E
[I have a B: drive emulated so I put in
PARTCOPY Boot1.bin 0 3 -f1 0
PARTCOPY Boot1.bin 3E 1C2 -f1 3E
OR
next it says type up the following bochs config
Code: Select all
# ROM and VGA BIOS images ---------------------------------------------
romimage: file=BIOS-bochs-latest, address=0xf0000
vgaromimage: VGABIOS-lgpl-latest
# boot from floppy using our disk image -------------------------------
floppya: 1_44=b:, status=inserted # Boot from drive b
# logging and reporting -----------------------------------------------
log: OSDev.log # All errors and info logs will output to OSDev.log
error: action=report
info: action=report
boot1.asm
Code: Select all
;*********************************************
; Boot1.asm
; - A Simple Bootloader
;
; Operating Systems Development Tutorial
;*********************************************
org 0x7c00 ; We are loaded by BIOS at 0x7C00
bits 16 ; We are still in 16 bit Real Mode
Start:
cli ; Clear all Interrupts
hlt ; halt the system
times 510 - ($-$$) db 0 ; We have to be 512 bytes. Clear the rest of the bytes with 0
dw 0xAA55 ; Boot Signiture
EDIT ok seemingly stuff in bochs has changed see
http://www.nabble.com/Strange-error-mes ... 01341.html
I because of the link altered my config file as below but now It loads quite a bit further but them I get no bootable device
romimage: file = BIOS-bochs-legacy , address=0xf0000
vgaromimage: file=VGABIOS-lgpl-latest # boot from floppy using our disk image -------------------------------
floppyb: 1_44=b:, status=inserted
boot: disk
boot: floppy
error: action=report
info: action=report
Change this
to this
Code: Select all
romimage: file=BIOS-bochs-latest, address=0xf0000
Code: Select all
romimage: file=BIOS-bochs-latest
-
- Member
- Posts: 65
- Joined: Wed Nov 14, 2007 3:19 pm
Thanks , that way of doing things did indeed work I have also got quite a few differant pieces of code working , Im also speaking to one of the people who writes guides and there appears to be some issues with bochs when it comes to writing a bootloader to a virtual floppy drive. Hence why I have replied for a bit Ive been reading up . Some of bochs has changed since I last used it , but its minor , before I read the answer above I actually ended up with it working the same way but I was worried running bochs without the address = field would cause problems. Thankfully it hasnt this far and seems a sound solution so thanks for the response it at least lets me know Im on the write track ---- no pun intended hehe (Sorry lame joke its just Ive been reading about sectors and tracks lol)