在NASM中,您会看到类似this的内容:
msg: db "Hello world!",0 ; we need to explicitely put the zero byte here
times 510-($-$$) db 0 ; fill the output file with zeroes until 510 bytes are full
dw 0xaa55 ; magic number that tells the BIOS this is bootable
据我了解,这些是特定于编译器的“帮助程序”(NASM是此处的编译器)。
看起来as
编译器/程序有自己的助手,例如.asciz
,用于类似的事情:
msg: .asciz "Hello world!"
.fill 510-(.-init),1,0 # add zeroes to make it 510 bytes long
.word 0xaa55 # magic bytes that tell BIOS that this is bootable
是否有某种“低级”方式以与编译器无关的方式编写代码?也许以某种方式而不是使用这些帮助程序来编写指令吗?基本上,这些抽象是什么?如何使用较低层的抽象来编写它们?
非常,我想以一种较低级别的方式编写它,而不用绑定到特定的编译器,并且还要知道更深层次的实际情况。
与类似的东西一样
[bits 16] ; use 16 bits
[org 0x7c00] ; sets the start address
在哪里可以找到文档或有关如何在较低级别编写此文档的内容?