测试原生x86程序,建立可引导的图像/驱动器 [英] Test native x86 programs, building bootable images/drives

查看:155
本文介绍了测试原生x86程序,建立可引导的图像/驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有下一个问题:我与NASM合作以及与一些本地和编译它是这样的:

I have the next problem: I'm working with NASM and building some native and compiling it on this way:

nasm -f bin source -o out

我得到我的原生程序的x86。

I'm getting my native program for x86.

而现在最有趣的,我怎么可以让它启动,然后进行测试呢?

And now the most interesting, how can I make it bootable and then test it?

由于我认为有3种方式启动(但对我来说,一切又失败:()

As I think there are 3 ways to make bootable ( but for me, all they has failed :( )


  • 使用mkbt实用程序(或其他柔软的类似于)将其写入软盘

  • 建筑ISO映像,并在它启动的编辑部门

  • 手工编写内存部门USB / SD卡或其他驱动程序

至于测试,任何时候都重新启动PC是非常糟糕的,所以最好以柔和的使用一些虚拟操作系统一样VBOX,VMWare的等。

As for testing, all times rebooting PC is very bad, so it's better to use some Virtual OS soft like Vbox, VMWare etc..

所以我用的VBox这一点。
构建ISO - 我用的CDBurnerXP

So I used VBox for this. For building ISO - I used CDBurnerXP.

使用cdburner我已经选配引导扇区为我的本地程序,然后选择VBOX新的ISO磁盘从中将我的程序启动。

With cdburner I have optioned bootable sector for my native program, then choose new ISO in Vbox as disk from which will my program boot.

结果总是空的屏幕,没有错误显示,只会什么都得不到......

The result is always empty screen, no errors are showed, just nothing...

我想,我有许多错误...

I think, that I have many errors...

使用mkbt,我不能把它写入USB驱动程序....我没有flooppy现在,所以我不能够写入图像到软盘,mkbt无法写入USB ...: (

Using mkbt, I can't write it to usb driver.... I don't have flooppy now, so I'm not able to write image to floppy, mkbt can't write to usb... :(

什么我错了?

我怎样才能解决我的问题?

How can I solve my problem?

推荐答案

只是这样做:结果
NASM -f斌-o BOOT.BIN boot.asm结果
QEMU -boot为了=一个-FDA BOOT.BIN

Just do this:
nasm -f bin -o boot.bin boot.asm
qemu -boot order=a -fda boot.bin

,你应该看到的消息。对于其他仿真你要垫的形象
1474560字节。

And you should see the message. For other emulators you'll want to pad the image to 1474560 bytes.

boot.asm:

        BITS 16
        ORG 0
        jmp 0x07c0:start

start:
        mov ax, cs
        mov ds, ax

        mov si, msg
        call print_string

hang:
        jmp hang

print_string:
        cld
        lodsb
        or al, al
        jz .done
        mov ah, 0x0E
        int 0x10
        jmp print_string
.done:
        ret

msg:    db 'Hello World!', 13, 10, 0

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

这篇关于测试原生x86程序,建立可引导的图像/驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆