|
-
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 $
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
|