Aktív témák

  • OddMan

    őstag

    válasz OddMan #22 üzenetére

    Közben rájöttem, hogy miért nem látom a floppy tartalmát.

    000h 446 Machine Code and Associated Data.
    1BEh 16 Partition 1 Information. //ezek a byte-ok nálam végig nullák. Ez volt a baj szerintem.
    1CEh 16 Partition 2 Information.
    1DEh 16 Partition 3 Information.
    1EEh 16 Partition 4 Information.
    1FEh 2 Boot Signature AA55h.

    Szal az első 446 byte a boot code és a következő 4x16 byte pedig a particíós táblák elhelyezkedése mérete és a boot flag állapota van itt tárolva.
    Aztán jön a lezáró AA55h .

    Láttam egy kódot a nasm-hoz a neten, de valamit nem értek benne.
    iderakom:

    ; 3.ASM
    ; Load a program off the disk and jump to it

    ; Tell the compiler that this is offset 0.
    ; It isn't offset 0, but it will be after the jump.
    [ORG 0]

    jmp 07C0h:start ; Goto segment 07C0 ;Ezt az első ugrást nem értem. ha elugrik a 07C00h:start címre, akkor ott nincsen semmi. A következő code sorok már nem tudnak lefutni, mivel azok a 00000:0000 címre lettek betöltve vagy nem? Szal szerintem ez így nem múködik. Valki segítsen!

    start:
    .|. the segment registers
    mov ax, cs
    mov ds, ax
    mov es, ax


    reset: ; Reset the floppy drive
    mov ax, 0 ;
    mov dl, 0 ; Drive=0 (=A)
    int 16h ;
    jc reset ; ERROR => reset again


    read:
    mov ax, 1000h ; ES:BX = 1000:0000
    mov es, ax ;
    mov bx, 0 ;

    mov ah, 2 ; Load disk data to ES:BX
    mov al, 5 ; Load 5 sectors
    mov ch, 0 ; Cylinder=0
    mov cl, 2 ; Sector=2
    mov dh, 0 ; Head=0
    mov dl, 0 ; Drive=0
    int 13h ; Read!

    jc read ; ERROR => Try again


    jmp 1000h:0000 ; Jump to the program


    times 510-($-$$) db 0
    dw 0AA55h

    ''A szíved szabad! Légy bátor és kövesd!''

Aktív témák