Page 1 of 3

boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 6:41 pm
by dronkit
[attachment deleted by admin]

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 6:55 pm
by Tom
your .org 0 should be .org 0x7C00

or it could be .org 7C00h

what ever youl like ( depending on you compiler/assembler )

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 6:58 pm
by dronkit
but i set cs to 07c0:0 so i can start at offset 0...

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 7:19 pm
by AlanO
:o holy hand grenade batman, nice job on that

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 7:28 pm
by dronkit
Thanks, i guess ;)

I'll appreciate the more an uncompressed comment, tho ;)

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 8:01 pm
by AlanO
heh, well, being as new as i am into the asm field (not just os stuf,f just asm in general) that tutorial really makes it easy to understand, and the comments are awesome. My comp sci teacher would be very very proud :-) he taught nothing but comments

"if your more than code isn't half green, it isn't done"
(msvc++ compiler comments at least) lol

thank you for posting that up there, its really helpful

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 8:12 pm
by dronkit
hehe thank you for taking the time to read it ;)

anyway, my real-world-code has comments no longer than 4 lines ;) i did this just enough well documented so i don't have to read everything back after 6 months without working on it ;)

and i think it's cool if it is good enough for others ;)

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 8:30 pm
by AlanO
hey, i gotta real quick question, i compiled the example and got an object, what do i do with it now?

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 8:32 pm
by dronkit
ld -Ttext 0x0 --oformat binary -o boot0 boot0.o

then

dd if=boot0 of=/dev/fd0 bs=512

;)

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 8:54 pm
by AlanO
hey, okay, i tested your bootloader but all that comes up is F> . And also, i used your getinput function inside of my kernel, i rearranged it so nasm would like it then i compiled and ran, and rebooted machine, so i still believe my bloader is in pmode?

how do i enter real mode to use my keyboard??

or is there another way?
thanks in advanced

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 8:57 pm
by AlanO
also i found this out,
; {} Documentation connected to specific source code sections:
;
;{0} I wasn't sure what to assume about the CPU state when the BIOS (or
; earlier boot) transfers control here. Probably interrupts are disabled and
; DS=0; But I didn't assume that. Assuming that could save a couple bytes
; of code.
;
;{1} Memory use:
; {A} The boot itself is at 0:7C00
; {B} The top of the stack is 0:800
; {C} The directory and FAT are both read in and accessed starting at 800:0
; {D} The image is read in, then copied to 1MB (physical)
; {E} The page tables are built at 9C000 physical
; {F} The image is mapped to FFF80000 linear
; {G} The page tables are mapped to FFFC0000 linear
; {H} The first 4Mb is mapped linear = physical
;
;{2} Most of this code runs in "big real mode". That allows the code to make
; int 13h (and other) BIOS calls, but also to access extended memory directly.

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 8:59 pm
by dronkit
what you see is:

F: debug, load from floppy, H = hard disk
>: jumped to second stage loader (i didn't give you any 2nd stage loader, so the first one did it job, it jumped to the second sector in the floppy disk which hanged your machine) ;)

my routine also uses bios, that's because that code is supposed to be run at boot time in real mode.

it's just a boot sector ;)

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 9:01 pm
by dronkit
Also, you have to have some things in mind:

if you're going to use memory about 1MB, you have to enable A20.

you have to read from port $0x60 to get keyboard scan codes, and not the bios (int $0x16)

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 9:02 pm
by gtsphere
so you would use the outportb and the inportb functions? i've came across those. and btw, i decided to register, heh

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 9:07 pm
by dronkit