binärdateien mit ld linken



  • Hallo,

    der untenstehende Code (für nasm) wird an Adresse 0x0900:0000 geladen. Es wird einfach nur der Keyboard Interrupt der IVT überschrieben. Wenn ich diesen Code mit "nasm -fbin -o intr.bin1 intr.s" übersetze und den Binärcode am Computeranfang lade, funktioniert alles einwandfrei. Nun will ich aber mehrer Objektdateien zu einer Binärdatei zusammenfügen, ich mache das mit "nasm -felf -o intr.o intr.s" und danach "ld -Ttext 0x0000 -x -s --oformat binary intr.o -o intr.bin2". Der Interrupt wird dann aber NICHT aufgerufen.
    Ein hexdump ergibt folgendes (das (*) scheint die Adresse der Funktion intr_01 zu sein) :

    intr.bin1:
    0000000 c88c d88e d08e cc81 ffff c031 c08e 24bb
    0000010 2600 87c7 0000 0021 (*) c381 0002 8c26 eb1f
    0000020 cffe
    0000022

    intr.bin2:
    0000000 8c66 8ec8 8ed8 66d0 cc81 ffff 3166 8ec0
    0000010 66c0 24bb 2600 6766 87c7 0000 0029 (*) 8166
    0000020 02c3 2600 8c67 eb1f cffe
    000002a

    Kann einer helfen? Danke.

    GLOBAL _start
    _start:
    mov ax, cs ; cs = 0x0900
    mov ds, ax
    mov ss, ax
    mov sp, 0xFFFF

    ; install interrupt handler
    xor ax, ax
    mov es, ax
    mov bx, 0x24 ; keyboard interrupt
    mov word [es:bx], intr_01
    add bx, 2
    mov word [es:bx], ds

    repeat:
    jmp repeat

    intr_01:
    ; code hier ist unwichtig
    iret



  • Funktioniert nun.


Anmelden zum Antworten