boot0 step-by-step tutorial: Need comments

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.
dronkit

boot0 step-by-step tutorial: Need comments

Post by dronkit »

[attachment deleted by admin]
Tom

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

Post by Tom »

your .org 0 should be .org 0x7C00

or it could be .org 7C00h

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

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

Post by dronkit »

but i set cs to 07c0:0 so i can start at offset 0...
AlanO

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

Post by AlanO »

:o holy hand grenade batman, nice job on that
dronkit

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

Post by dronkit »

Thanks, i guess ;)

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

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

Post 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
dronkit

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

Post 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 ;)
AlanO

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

Post by AlanO »

hey, i gotta real quick question, i compiled the example and got an object, what do i do with it now?
dronkit

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

Post by dronkit »

ld -Ttext 0x0 --oformat binary -o boot0 boot0.o

then

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

;)
AlanO

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

Post 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
AlanO

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

Post 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.
dronkit

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

Post 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 ;)
dronkit

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

Post 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)
gtsphere

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

Post by gtsphere »

so you would use the outportb and the inportb functions? i've came across those. and btw, i decided to register, heh
Post Reply