Hlavní navigace

Názor k článku Vývoj her a grafických dem pro oslavovanou i nenáviděnou platformu PC (první kroky) od Noris - Dosbox neběží v termuxu, ale v termuxu běží...

  • Článek je starý, nové názory již nelze přidávat.
  • 2. 7. 2024 21:55

    Noris

    Dosbox neběží v termuxu, ale v termuxu běží qemu. Jenže jsem si s tím neporadil.

    Zkoušel jsem:

    #!/bin/sh
    
    # Vytvoření jednoduchého x86 assemblerového kódu
    cat << 'EOF' > test.asm
    section .text
       global _start     ;must be declared for linker (ld)
    
    _start:             ;tells linker entry point
       mov  edx,len     ;message lenght
       mov  ecx,msg     ;message to write
       mov  ebx,1       ;file descriptor (stdout)
       mov  eax,4       ;system call number (sys_write)
       int  0x80        ;call kernel
    
       mov  eax,1       ;system call number (sys_exit)
       int  0x80        ;call kernel
    
    section .data
    msg db 'Hello, world!', 0xa  ;our dear string
    len equ $ - msg     ;lenght of our dear string
    EOF
    
    # Překlad assemblerového kódu do objektového souboru ve formátu ELF
    nasm -f elf -o test.o test.asm
    
    # Slinkování objektového souboru do spustitelného souboru
    ld.lld -m elf_i386 -s -o test test.o
    
    # Spuštění programu v QEMU
    qemu-i386 test

    Ale dostávám:

    ~/W/asm/hello $ bash test.sh
    Error while loading /storage/emulated/0/DROPBOX/WORK/asm/hello/test: Exec format error
    ~/W/asm/hello $ file test
    test: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped

    A nevím si s tím rady.