Page 1 of 1
lba extended read: int 0x13, ah 0x42
Posted: Sat Oct 25, 2003 3:16 pm
by frank
I have problems with int 0x13, function 0x42.
It should read a sector from the disk. (using lba)
The only output which is right is sector 0.
Does anyone know what the problem might be?
offtopic: this program is located in the bootblock, it gets loaded by lilo.. there is more code but this is the part not working
Code: Select all
; Check if LBA (Logical Block Addressing)
; is supported.
mov ah,0x41
mov bx,0x55AA
mov dl,[disk]
int 0x13
cmp bx,0xAA55
jne no_lba
; Read using LBA (Logical Block Addressing)
; Using a standard bios interrupt
mov ah,0x42
mov dl,[disk]
lea si,[lbaadr]
int 0x13
cmp ah,0x00 ; check for error
jne showerr
lbaadr:
dw 0x0010 ; 2byte, reserved - size of packet.
dw 0x0001 ; WORD 2bytes nr of blocks read.
dw 0x00002000 ; DWORD 4bytes Transfer buffer
; dd 0x0000000034009605 ; QWORD 4bytes,32bit LBA address
dd 0x0000000000000000
Best,
Frank
Re:lba extended read: int 0x13, ah 0x42
Posted: Sat Oct 25, 2003 3:50 pm
by Candy
Code: Select all
lbaadr:
dw 0x0010 ; 2byte, reserved - size of packet.
dw 0x0001 ; WORD 2bytes nr of blocks read.
dw 0x00002000 ; DWORD 4bytes Transfer buffer
; dd 0x0000000034009605 ; QWORD 4bytes,32bit LBA address
dd 0x0000000000000000
The simplest thing I can see wrong here is that your comments do not match your code. Seeing you want the packet size to be 0x10, you would need a dw, another dw, a dd and a dq respectively. You have 3 dw's and a dd.
Suggestion:
Code: Select all
lbaadr:
dw 0x0010 ; 2byte, reserved - size of packet.
dw 0x0001 ; WORD 2bytes nr of blocks read.
dd 0x00002000 ; DWORD 4bytes Transfer buffer
; dq 0x0000000034009605 ; QWORD 4bytes,32bit LBA address
dq 0x0000000000000000
Re:lba extended read: int 0x13, ah 0x42
Posted: Sun Oct 26, 2003 2:58 am
by frank
ty, you were right.
I had to do some changes in it though.
I got the stuff working ;D
Code: Select all
; Read using LBA (Logical Block Addressing)
; Using a standard bios interrupt
mov ah,0x42
mov dl,[disk]
lea si,[lbaadr]
int 0x13
cmp ah,0x00 ; check for error
jne showerr
; LBA parameter block
lbaadr:
dw 0x0018 ; 2b reserved
dw 0x0001 ; 2b nr of blocks read.
dw 0x00002000 ; 4b 4bytes Transfer buffer
dw 0,0x00000001 ; 8b LBA
Re:lba extended read: int 0x13, ah 0x42
Posted: Sun Oct 26, 2003 2:32 pm
by frank
Hmmm it seems not to work right...
Reading sector 0,1 and 2 works fine.
When I read sector 10 it shows me empty data.
I wrote a small textfile (+/- 16bytes) to sector 9/10 and 11 using dd as root.
(which does not matter since lilo is only in the first sector of the disk and my first partition starts at sector 63)
But it shows me an empty data.
Code: Select all
; LBA parameter block
lbaadr:
dw 0x0018 ; 2b reserved
dw 0x0001 ; 2b nr of blocks read.
dw 0x2000 ; 4b 4bytes Transfer buffer
dw 0x0000,0x0010 ; 8b LBA
Re:lba extended read: int 0x13, ah 0x42
Posted: Sun Oct 26, 2003 3:07 pm
by Curufir
Am I totally missing something here?
Is LBA sector 16, not 10.
Could it really be this?
Re:lba extended read: int 0x13, ah 0x42
Posted: Thu Oct 30, 2003 8:31 am
by frank
Ok, I managed to read sector 63 and 10,1,2 etc
But when I try to read the first sector of my 4th partition it does not work..
( 4th partition sector is 34009605)
Code: Select all
; LBA parameter block
lbaadr:
db 0x10 ; 1b 00h reserved -> size
db 0x00 ; 1b 01h reserved
dw 0x0001 ; 2b 02h nr of blocks read.
dw 0x2000 ; 2b 04h 4bytes Transfer buffer
lbaa db 0x05,0xF2,0x06,0x02
Re:lba extended read: int 0x13, ah 0x42
Posted: Fri Oct 31, 2003 12:03 pm
by Nayxx
Warning with dimension of fields !
Code: Select all
lbaadr:
db 10h ; packet size (16 bytes)
db 0 ; reserved, must be 0
db 1 ; number of sectors to transfer
db 0 ; reserved, must be 0
dw 2000h ; Buffer's segment
dw 0000h ; Buffer's offset
dq 0000000034009605h ; 64-bit starting sector number
Re:lba extended read: int 0x13, ah 0x42
Posted: Sat Nov 01, 2003 4:30 pm
by frank
I got it working.
Lilo loads the partition boot sector.
My asm bootblock loads the mbr, reads the C bootblock (10 sectors atm), switches to pmode and jumps.
For anyone who is interested in the code:
http://frank.nedbsd.nl/xope-0.0.1Z.tar.gz
(btw, do not write make before editing the Makefile)
Best,
Frank