![Smile :)](./images/smilies/icon_smile.gif)
I took the alignment out (Made my image 2kb), and am going to
try loading 50 sectors of my kernel. and post the results..
Code: Select all
ENTRY("0x00000000")
OUTPUT_FORMAT("binary")
SECTIONS
{
.text 0x1000 :
{
code = .; _code = .; __code = .;
*(.text)
}
.data :
{
data = .; _data = .; __data = .;
*(.data)
}
.rodata :
{
rodata = .; _rodata = .; __rodata = .;
*(.rodata)
}
.bss :
{
bss = .; _bss = .; __bss = .;
*(.bss)
}
end = .; _end = .; __end = .;
}
Code: Select all
;*******************************************************
; Read sectors from floppy into memory
; (ES:BX=>Buffer)
; CX=>Number of sectors to read
; AH=>Sector Number to begin reading from
; AL=>Head Number to begin reading from
;*******************************************************
LoadSectors:
pusha ; store registers...
mov dl, 12h
div dl
inc ah ; move to next sector (CL=sector number 1-63)
mov cl, ah
mov dh, al ; DH=head number
and dh, 01h
shr al, 1
mov ch, al
mov dl, 00h ; drive number (00h=floppy)
ReadSector:
mov ah, 02h
mov al, 01h ; number of sectors to read
int 13h
jc ReadSector ; CF is set if error by INT 13h
popa ; restore registers
add bx, 0200h
inc ax
loop LoadSectors ; loop until CX = 0
ret
;...This is in the main kernel code:
; load second stage to 0:1000h ----------------
LoadStage2:
mov ax, 0
mov es, ax
mov bx, 1000h ; load stage2 at offset es:1000h (0:1000h)
mov ax, 1 ; start reading from head 1 sector 0
mov cx, 50 ; read 50 sectors
call LoadSectors
Code: Select all
LoadSectors:
pusha ; store registers...
mov dl, 12h
div dl
; Increment next sector --------------------------
inc ah ; move to next sector (CL=sector number 1-63)
mov cl, ah
mov dh, al ; DH=head number
and dh, 01h
shr al, 1
mov ch, al
mov dl, 00h ; drive number (00h=floppy)
ReadSector:
mov ah, 02h
mov al, 01h ; number of sectors to read
int 13h
jc ReadSector ; CF is set if error by INT 13h
popa ; restore registers
add bx, 0200h
;----- Here I increment AX (AL) for next headnumber -------------
inc ax
; If I only inc ah here, I recieve panic message from Bosch
loop LoadSectors ; loop until CX = 0
ret
Combuster you should drop the attitude and show some respect. If you bother to re-read the whole thread, it's obvious neon DOES have a clue about what he's doing, at least in the sense of "debugging 101", after several days of nothing but fruitless debugging, would you feel nice to be told to "try actually debugging your code"?Combuster wrote:two things:
1: that message probably tells you HOW you screwed up
2: I bet you never tried debugging your code (bochs is your friend there)
If i had no respect i'd have flamed him for his stupidity instead of urging him to debug properly.mystran wrote:Combuster you should drop the attitude and show some respect. If you bother to re-read the whole thread, it's obvious neon DOES have a clue about what he's doing, at least in the sense of "debugging 101", after several days of nothing but fruitless debugging, would you feel nice to be told to "try actually debugging your code"?
Code: Select all
for(int i; i < foo; i++)
for(int j; j < bar; j++)
do_something(i,j);
Code: Select all
for(int i; i < foo; i++) {
for(int j; j < bar; j++) {
do_something(i,j);
}
}
Code: Select all
void main () {
_clrscr (WINCOL);
unsigned char* p="HELLO WORLDHELLO WORLDHELLO WORLDHELLO WORLDHELLO WORLD";
// *** ASSIGN FIRST 10 CHARS TO LETTER "H"
int i=0;
for (i=0; i<10; i++)
p[i]='H';
// *** PRINTS OUT "H" CHARACTER.
// Without the assignment (the above loop), it prints null
_printf (p);
__asm ("hlt");
}
Code: Select all
void _printf (char* format) {
_putch ('A'); // works
_putch (*format);
}