|
Page 1 of 1
|
[ 8 posts ] |
|
Author |
Message |
prinzrainer
Joined: Sat Sep 26, 2009 4:29 am Posts: 15 Location: Philippines
|
int 0x13 extension
My OS development stopped for months because I'm stuck w/ my bootloader(I can't figure out why...maybe I'm just too dumb for this stuff )...and I'm busy w/ other things... Here's my progress.. Code: bits 16
jmp short boot nop SystemVersion db "SAIDOS " BytesPerSector dw 0x200 SectorsPerCluster db 2 ReservedSector dw 3 FATCount db 2 RootDirCount dw 0x20 SectorCount16 dw 19728 ;19728 19642 for data(9821 cluster) MediaDescriptor db 0xF8 SectorsPerFAT dw 40 ; 10240 clusters SectorsPerTrack dw 63 HeadCount dw 1 HiddenSectorCount dd 0 SectorCount32 dd 0
;FAT16 Drive db 0x80 FlagNT db 0 Signature db 0x29 SerialNumber dd 0x01020304 VolumeLabel db "NO NAME " SystemID db "FAT16 "
; VARIABLE bootx equ 0x7c00 datax equ 0x7b00 drv equ datax; byte
;DAP dap: db 0x10 db 0 dap_count db 0 db 0 dap_bfr dd 0 dap_lba dq 0
boot: cli xor ax,ax mov ds,ax mov ss,ax mov es,ax mov sp,0xFFFF
mov [drv],dl ; Save the drive number which it has booted from
mov si,bootx+msg_load call sys_print
; check if int 0x13 ext is present mov ah,0x41 mov bx,0x55aa int 0x13
jnc int13extok mov si,bootx+msg_noint13ext call sys_print jmp $
int13extok: mov si,bootx+msg_load2 call sys_print
mov ah,0x42 mov dl,[drv] mov si,bootx+dap mov byte[bootx+dap_count],1 mov dword[bootx+dap_bfr],0x00007e00 mov dword[bootx+dap_lba],0x0002 mov dword[bootx+dap_lba+4],0x0000 int 0x13
mov si,bootx+0x200 call sys_print
jmp $
sys_print: ;si - msg address push ax mov ah,0x0e ;display char and advance cursor printx: cmp byte[si],0 ;is byte[si] == 0? je printx_exit ;if TRUE terminate loop mov al,[si] ;display byte[si] int 0x10 ; inc si ;move to next character jmp printx ;loop printx_exit: ; pop ax ret
sys_read: ret
; DATA msg_load db "Sajia BOOTLOADER",0x0a,0x0d,0 msg_noint13ext db "ERROR: int 0x13 extension not available",0x0a,0x0d,0 msg_load2 db "[LOADING]",0x0a,0x0d,0
times 510 -($-$$) db 0 ; dw 0xAA55 ;boot signature next: ; ; ; sample db "HAHAHAHAHAHAHAHAHAHAHA",0
times 1024 -($-$$) db 0 ;
this should display: Sajia BOOTLOADER [LOADING] HAHAHAHAHAHAHAHAHAHAHA but I guess the code for loading sectors is not working (I'm using int 0x13 extension..does this feature works only in phoenix bios??)... I'm using bochs...
Last edited by prinzrainer on Sun Jan 24, 2010 1:49 am, edited 1 time in total.
|
Sat Jan 23, 2010 3:41 am |
|
|
Terry A. Davis
Joined: Tue Jan 19, 2010 11:51 pm Posts: 66
|
Re: int 0x13 extension
Umm... I didn't look closely, but it looks like you are setting all your segment registers to zero. You definitely don't want that, I think.
Edit: Nevermind, I just saw the 0x7c00 value. I donno, off hand. Just keep trying stuff until it works. That's the secret. Persistance. Eventually, you will be doing stuff with no one to help. All you can do is try different things, even crazy things, and get clues.
|
Sat Jan 23, 2010 5:39 am |
|
|
XanClic
Joined: Thu Jan 07, 2010 4:46 am Posts: 5
|
Re: int 0x13 extension
The extensions don't work on a floppy disk (I guess, you're using an FDD). You have to use the old CHS way there. And, btw, there's an "org" command which is capable of relocating all your code. Just use "org 0x7C00" before everything and this value will be added to all your labels.
|
Sat Jan 23, 2010 5:58 pm |
|
|
prinzrainer
Joined: Sat Sep 26, 2009 4:29 am Posts: 15 Location: Philippines
|
Re: int 0x13 extension
i'm using it in HD ( you can't have fat16 in FD )...yeah....i have a mistake in the code it is supposed to be Code: mov ah,0x42 mov dl,[drv] mov si,bootx+dap mov byte[bootx+dap_count],1 mov dword[bootx+dap_bfr],0x00007e00 mov dword[bootx+dap_lba],0x0002 mov dword[bootx+dap_lba+4],0x0000 int 0x13
rather than Code: mov ah,0x42 mov dl,[drv] mov si,bootx+dap mov byte[dap_count],1 mov dword[dap_bfr],0x00007e00 mov dword[dap_lba],0x0002 mov dword[dap_lba+4],0x0000 int 0x13
but still, there's an error...btw if I'll use PIO how can I know the port addresses of the drives?? suppose...the drive where the program booted is 80...how can I know it's port address (w/o using the int 0x13 fn 0x48 Extended Read Drive Parameters )?? you can add me in facebook,,mynameisrainer@yahoo.com...I really need help...
Last edited by prinzrainer on Wed Jan 27, 2010 11:01 pm, edited 1 time in total.
|
Sun Jan 24, 2010 1:48 am |
|
|
XanClic
Joined: Thu Jan 07, 2010 4:46 am Posts: 5
|
Re: int 0x13 extension
prinzrainer wrote: i'm using it in HD ( you can't have fat16 in FD ) Ah, sorry, missed that. I really suggest you to use org. It's very hard to calculate all the addresses correctly in the way you do. prinzrainer wrote: btw if I'll use PIO how can I know the port addresses of the drives?? suppose...the drive where the program booted is 80...how can I know it's port address (w/o using the int 0x13 fn 0x48 Extended Read Drive Parameters )?? Base port address for the first ATA drive is 0x1F0. For more information read that article (for example): http://wiki.osdev.org/IDE
|
Mon Jan 25, 2010 11:18 am |
|
|
prinzrainer
Joined: Sat Sep 26, 2009 4:29 am Posts: 15 Location: Philippines
|
Re: int 0x13 extension
solved it!! I did same mistake again....sector number start from 0....
|
Wed Jan 27, 2010 11:15 pm |
|
|
Love4Boobies
Joined: Sat Jul 25, 2009 11:26 am Posts: 81
|
Re: int 0x13 extension
The first sector is sector no. 1. Your code is full of non-sense packed in a packed in a 1024-byte sector instead of 512.
|
Sun Feb 21, 2010 9:51 pm |
|
|
prinzrainer
Joined: Sat Sep 26, 2009 4:29 am Posts: 15 Location: Philippines
|
Re: int 0x13 extension
i mean lba... it's a 512-byte sector though the file size 1024 bytes.. i use hex workshop to copy it to a disk image file...
|
Sun Feb 21, 2010 11:45 pm |
|
|
|
Page 1 of 1
|
[ 8 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 2 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|