Re: boot sector




Benjamin David Lunt wrote:
<bob@xxxxxxxxxxxxxx> wrote in message
news:1164324758.361049.262160@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I've been looking at the code for my hard drive's boot sector, and I am
somewhat confused by this portion:

60 pusha
6A00 push byte +0x0
6A00 push byte +0x0
FF760A push word [bp+0xa]
FF7608 push word [bp+0x8]
6A00 push byte +0x0
68007C push word 0x7c00
6A01 push byte +0x1
6A10 push byte +0x10
B442 mov ah,0x42
8BF4 mov si,sp
CD13 int 0x13
61 popa

It appears to call this interrupt for an "EXTENDED READ":
http://www.ctyme.com/intr/rb-0708.htm

That page indicates the format of a disk address packet is as follows:

00h BYTE size of packet (10h or 18h)
01h BYTE reserved (0)
02h WORD number of blocks to transfer (max 007Fh for Phoenix EDD)
04h DWORD -> transfer buffer
08h QWORD starting absolute block number

The code says the size of packet is 0x10 with the line "push byte
+0x10". However, it seems to put a 1 in the reserved section with
"push byte +0x1" - or am I reading it wrong?

push byte 01

doesn't actually push a byte on to the stack. It pushes a sign
extended word onto the stack. All stack access with push and pop
is 16-bit (unless you use opsize, etc.)

Also, it doesn't appear to specify all 16 bytes of the disk address
packet. Is it planning to use the leftovers from the initial pusha
call?

If you count the push's, 8, then multiply by sizeof(word), that
is actually 16 bytes.

Since the push's go down in memory, sp will point to the first
of the data block pushed.

Now, what gets me is, why does the code popa without adding 16
to the sp register first?

Ben

Thanks, Benjamin.

It actually does two popa's in a row, but I only put in the first one.

Also, just to confirm, is the code reading 1 block? (a.k.a. 512 bytes)

.



Relevant Pages

  • Re: boot sector
    ... That page indicates the format of a disk address packet is as follows: ... The code says the size of packet is 0x10 with the line "push byte ... doesn't actually push a byte on to the stack. ... to the sp register first? ...
    (alt.lang.asm)
  • Re: Is it wise to push all-in early in a tournament?
    ... The best times to make a push play ... But why call when you can push and take down a nice pot when your opponent ... But remember that if this "big bet" is a significant portion of your stack, ... I consider it my goal in any tournament to do the latter as much as ...
    (rec.gambling.poker)
  • Re: Is it wise to push all-in early in a tournament?
    ... whether or not the rest of the table is splashing chips around. ... I may push more than I want to and you may be more conservative than ... Do I want to play this opponent after the flop? ... push at anytime and I may not want to risk my stack on a suckout when I ...
    (rec.gambling.poker)
  • Virtual machine: assembly instructions
    ... push; Push the address of the first variable onto the stack ... itof: convert integer to float ... If top+1 of int stack is less than top; push true else push false ...
    (comp.programming)
  • Re: Building Unification Table - tranforming prolog like notation into lisp notation
    ... |> problem comes from tranlating prolog notation into lisp notation. ... ;; Here is a quickly done stack based solution for the problem Slobodan ... (defstruct composite-term str indices) ... (push (cons (composite-term-str item) ...
    (comp.lang.lisp)