Loading a kernel

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
Anon

Loading a kernel

Post by Anon »

I have managed to get by boot sector to load
something of the disk.
I've made it read sector no 2.
If I have the code "db 0eah", "dw000f, "dw0ffff" or something like that.
It reads it and then reboots (it supposed to do that)
but when i put something else in there, it just shows these funny charaters on the screen.
What the hell am i doing wrong ?

An what the hell is as stack ?
and an idt ?
and all that other crap !
Could you use Turbo C++ to create an OS?
j.weeks

RE:Loading a kernel

Post by j.weeks »

>On 2001-10-01 21:07:52, Anon wrote:
>I have managed to get by boot sector to load
>something of the disk.
>I've made it read sector no 2.
>If I have the code "db 0eah", "dw000f, "dw0ffff" or something like that.

Something like that, eh? :)
db 0xea
dw 0x0000
dw 0xffff, perhaps?

Do you even know what that means?

>It reads it and then reboots (it supposed to do that)
>but when i put something else in there, it just shows these funny charaters on the screen.
>What the hell am i doing wrong ?

Any number of things, really. A little more information
might help. What are you trying to do? Print to the
screen? Are you sure you're reading your code
into the right place, and jumping to the right place?

Just because the computer rebooted when before doesn't
mean it was because of your asm.

>An what the hell is as stack ?
> and an idt ?
>and all that other crap !

Well hell, I don't know. f*ck, seems bloodly
rediculous to me... I mean sh*t!

Dude, honsetly, if you don't know what a stack is,
you're really not at the level you should be at for
writting an OS.

Check out some docs on assembly language programming,
or programming in general. And as for that
"other crap"... again, couldn't tell you...

>Could you use Turbo C++ to create an OS?

A 16-bit one, yes.

I suppose you could write a 32-bit one as well...
but it'd be a pain in the @$$, and incredibly
rediculous.

j.weeks
Ben Hsu

RE:Loading a kernel

Post by Ben Hsu »

uh, may I pardon to ask ..
I've got the bootsector written out and correctly
matching all the important issues like the
0xaa55 signature, alignment of DS to 0x7c00, and
proper BIOS console I/O functions written out, but
I've got the pointeless machine codes the boot disk
boots... I've used NASM and the GAS comes with GCC.
Both of these results not successful... I'm currently
trying out the as86 from a Linux machine. And from
my memory and I've got a binary code I wrote last year
I can successfully boot - but not this time... I use
'partcopy' and it didn't work out.
I've also recently tested my floppy diskettes, and
both Linux and Win2k reports bad sectors on the back
of the disk, would that be a cause for misprinting
of information?

THanks.

>On 2001-10-04 17:06:29, j.weeks wrote:
>>On 2001-10-01 21:07:52, Anon wrote:
>>I have managed to get by boot sector to load
>>something of the disk.
>>I've made it read sector no 2.
>>If I have the code "db 0eah", "dw000f, "dw0ffff" or something like that.
>
>Something like that, eh? :)
>db 0xea
>dw 0x0000
>dw 0xffff, perhaps?
>
>Do you even know what that means?
>
>>It reads it and then reboots (it supposed to do that)
>>but when i put something else in there, it just shows these funny charaters on the screen.
>>What the hell am i doing wrong ?
>
>Any number of things, really. A little more information
>might help. What are you trying to do? Print to the
>screen? Are you sure you're reading your code
>into the right place, and jumping to the right place?
>
>Just because the computer rebooted when before doesn't
>mean it was because of your asm.
>
>>An what the hell is as stack ?
>> and an idt ?
>>and all that other crap !
>
>Well hell, I don't know. f*ck, seems bloodly
>rediculous to me... I mean sh*t!
>
>Dude, honsetly, if you don't know what a stack is,
>you're really not at the level you should be at for
>writting an OS.
>
>Check out some docs on assembly language programming,
>or programming in general. And as for that
>"other crap"... again, couldn't tell you...
>
>>Could you use Turbo C++ to create an OS?
>
>A 16-bit one, yes.
>
>I suppose you could write a 32-bit one as well...
>but it'd be a pain in the @$$, and incredibly
>rediculous.
>
>j.weeks
Guest

RE:Loading a kernel

Post by Guest »

>On 2001-10-11 00:09:31, Ben Hsu wrote:
>uh, may I pardon to ask ..
>I've got the bootsector written out and correctly
>matching all the important issues like the
>0xaa55 signature, alignment of DS to 0x7c00,

If the boot code is [ORG 0] (the NASM default),
then 0x7C0 is the value you want to put in the
segment registers. If the code is [ORG 7C00h],
load the segment registers with zero.

Load ALL of the segment registers before using
them. This includes CS:

jmp 0:over2 ; or jmp 7C0h:over2
over2:
mov ax,cs
mov ds,ax
mov ss,ax
mov sp,ADR_STACK

>boots... I've used NASM and the GAS comes with GCC.

Making 16-bit code with GAS is no fun.

>I can successfully boot - but not this time... I use

Uh-oh, software rot :)

>both Linux and Win2k reports bad sectors on the back

Throw the disk out. Err, is it a floppy disk?
Post Reply