|
-
Aug 16th, 2005, 02:27 AM
#1
Thread Starter
Member
help me out ?
I have two files, flat binaries, that I'm trying to load off a floppy. The first (my boot sector) loads fine. This one links to the bootstrap, which is never called it seems. The program freezes someplace while calling the bootstrap, and never goes on to actually call it. Anybody wanna have a look at this ?
This is my boot sector. The way I know it's not calling the other file is that, I've put a string to be read just before ".readSector", as a test, and it didn't show. So, something is happening between "LoadBootStrap" and ".readSector" ...
Code:
[BITS 16]
ORG 0x7C00
jmp START
Welcome db "AlexOS",13,10,0
Version db "CODENAME : Isabelle", 13,10, 13,10,13,10,0
InfoMessage db "Preparing to load Second Stage",13,10,0
WriteString:
; mov al,[si] ;; give memory address of the message to "al", which finds the letter corresponding to said address and moves it into "al",
;; letter by letter
; inc si ;; give si the address of the next letter
lodsb ;; does what the two operations above do, in a single clock cycle
or al,al ;; detect if al = al (which means, when al doesn't have anything else to put on)
jz Break ;; and jump to Break section when it's done
int 10h ;; call interrupt 10, which writes to video memory
jmp short WriteString
Break:
ret
LoadBootStrap:
mov ah, 0x02 ;Read Disk Sectors
mov al, 0x01 ;Read one sector only
mov ch, 0x00 ;Track 0
mov cl, 0x02 ;Sector 2
mov dh, 0x00 ;Head 0
mov dl, 0x00 ;Drive 0 (Floppy 1)
mov bx, 0x2000 ;Segment 0x2000
mov es, bx
mov bx, 0x0000 ;Start of Segment
.readsector
int 0x13 ;Call BIOS Read Disk Sectors function
jc .readsector ;If there was an error, try again
mov ax, 0x2000 ;If there was an error, try again
mov ds, ax
jmp 0x2000:0x0000 ;Jump to the Bootstrap
START:
xor ax,ax ; ax = 0
mov ds,ax ; give Data Segment (ds) position of 0x0000 in memory
mov ah,0Eh ; teletype mode, video driver
mov bh,0x00 ; get video page number (0 in this case)
mov si,Welcome ; write memory address of the message into SI
call WriteString
mov si,Version
call WriteString
mov si,InfoMessage
call WriteString
call LoadBootStrap
times 510-($-$$) db 0 ; writes 0's till the end of the file
dw 0xAA55 ; end of file
Here's the file it's supposed to read :
Code:
[BITS 16]
ORG 0
jmp start
BootLoaded db "Second Stage Loading completed.",13,10,0
WriteString:
; mov al,[si] ;; give memory address of the message to "al", which finds the letter corresponding to said address and moves it into "al",
;; letter by letter
; inc si ;; give si the address of the next letter
lodsb ;; does what the two operations above do, in a single clock cycle
or al,al ;; detect if al = al (which means, when al doesn't have anything else to put on)
jz Break ;; and jump to Break section when it's done
int 10h ;; call interrupt 10, which writes to video memory
jmp short WriteString ;; loop this operation until it is broken
Break:
ret ; returns control to the last function
start:
mov si,BootLoaded ; show message of success
call WriteString
jmp $
-
Aug 22nd, 2005, 08:24 AM
#2
Re: help me out ?
Try using something like this:
Code:
LoadBootStrap:
mov ah,02h
mov al,4
mov ch,0
mov cl,2
mov dh,0
mov dl,0
mov bx,0x1000
mov es,bx
mov bx,0x00
int 13h
I think you're reading each sector wrong.
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Aug 22nd, 2005, 08:26 AM
#3
Re: help me out ?
Also:
Do you plan on making you're OS graphical? Or DOS based? I never could get mine to do much more than a small chatter bot.
If you use my way above, chances are you'll need:
Instead of your jump. I haven't done this in a while, but it looks to me like what I said above, you are reading the sectors wrong.
chem
Last edited by chemicalNova; Aug 22nd, 2005 at 08:30 AM.
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Aug 22nd, 2005, 07:03 PM
#4
Thread Starter
Member
Re: help me out ?
thanks, but I got it figured out ... I was reading the sectors alright, but the second file had a problem, in which an infinite loop was occuring, so it halted. lol
Now it's working fine ... I just can,t get Pmode to work though ... grrrrrrrr
-
Aug 23rd, 2005, 01:49 AM
#5
Re: help me out ?
What sort of HDD are you using? Seems a bit odd the way you did it.
Oh well, as long as it works 
Pmode: Theres alot of people who post about this on another forum. I'm not sure if I'm allowed to post it here though :|
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|