小编pad*_*wan的帖子

MZ(DOS,16位).EXE标头中的页数和最后页大小的重要性

我试图学习如何使用程序集(NASM)创建Dos .EXE文件,手动构建标头并将文件组装为二进制文件.我的页面选项有问题(页面总数和最后一页的字节数).无论我设置初始值多小,该程序都可以工作.

作为极端情况,即使设置1个1字节的页面,以下程序也会起作用:

;
; the smallest possible "Hello, World!" .EXE (DOS MZ) file
; assemble with:
; nasm -f bin -w+all -O0 smallest_hello_exe.asm -o ASM.EXE
;

bits 16
cpu 8086

;
; by setting cs:ip=-10h:100h instead of 0h:0h inside the .EXE header
; (identical assignments), we achieve the following two advantages:
; 1) ds==cs, so no "push cs pop ds" is needed in order for ds:dx
; to point to the message string
; 2) we can exit by …
Run Code Online (Sandbox Code Playgroud)

assembly dos 16-bit

5
推荐指数
1
解决办法
965
查看次数

标签 统计

16-bit ×1

assembly ×1

dos ×1