├── .gitignore ├── README.md ├── c05 ├── Makefile └── c05_mbr.asm ├── c06 └── c06_mbr.asm ├── c07 ├── Makefile └── c07_mbr.asm ├── c08 ├── Makefile ├── c08.asm └── c08_mbr.asm ├── c09 ├── c09_1.asm └── c09_2.asm ├── c11 ├── Makefile └── c11_mbr.asm ├── c12 ├── Makefile └── c12_mbr.asm ├── c13 ├── Makefile ├── c13.asm ├── c13_core.asm ├── c13_mbr.asm └── diskdata.txt ├── c14 ├── Makefile ├── c13.asm ├── c13_mbr.asm ├── c14_core.asm └── diskdata.txt └── c15 ├── Makefile ├── c13_mbr.asm ├── c15.asm ├── c15_core.asm └── diskdata.txt /.gitignore: -------------------------------------------------------------------------------- 1 | *.bin 2 | *.vhd 3 | *.lst 4 | *.img 5 | *.swp 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 代码在Mac上验证通过。由于原书是在Win上面编译的,这里也给一下Mac上编译的步骤。 2 | 3 | 首先使用nasm编译,编译的格式为bin格式,比如: 4 | 5 | ``` 6 | nasm -f bin c06_mbr.asm -o mbr.bin 7 | ``` 8 | 9 | 原书中使用自带的工具将上面生成的bin文件转换成VHD格式,实际上没有必要,可以使用VirtualBox自带的工具VBoxManage来生成,如: 10 | 11 | ``` 12 | VBoxManage convertfromraw mbr.bin myfile.vhd --format VHD 13 | ``` 14 | 15 | 这样在virtualbox中就可以加载这个生成的VHD文件看到效果了。 16 | 17 | -------------------------------------------------------------------------------- /c05/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ASMFILE=c05_mbr.asm 3 | 4 | all:$(ASMFILE) 5 | nasm -f bin $(ASMFILE) -o mbr.bin 6 | -rm myfile.vhd 7 | VBoxManage convertfromraw mbr.bin myfile.vhd --format VHD 8 | -------------------------------------------------------------------------------- /c05/c05_mbr.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichuang/x86-asm-book-source/fe501647df571a9cfdb197f3cca5d7e9a27ac0e8/c05/c05_mbr.asm -------------------------------------------------------------------------------- /c06/c06_mbr.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichuang/x86-asm-book-source/fe501647df571a9cfdb197f3cca5d7e9a27ac0e8/c06/c06_mbr.asm -------------------------------------------------------------------------------- /c07/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ASMFILE=c07_mbr.asm 3 | 4 | all:$(ASMFILE) 5 | nasm -f bin $(ASMFILE) -o mbr.bin 6 | -rm myfile.vhd 7 | VBoxManage convertfromraw mbr.bin myfile.vhd --format VHD 8 | -------------------------------------------------------------------------------- /c07/c07_mbr.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichuang/x86-asm-book-source/fe501647df571a9cfdb197f3cca5d7e9a27ac0e8/c07/c07_mbr.asm -------------------------------------------------------------------------------- /c08/Makefile: -------------------------------------------------------------------------------- 1 | 2 | all:c08_mbr.asm 3 | nasm -f bin c08_mbr.asm -o c08_mbr.bin 4 | nasm -f bin c08.asm -o c08.bin 5 | -rm myfile.vhd 6 | dd if=/dev/zero of=mbr.img count=10000 7 | dd if=c08_mbr.bin of=mbr.img conv=notrunc 8 | dd if=c08.bin of=mbr.img seek=100 conv=notrunc 9 | VBoxManage convertfromraw mbr.img myfile.vhd --format VHD 10 | -------------------------------------------------------------------------------- /c08/c08.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichuang/x86-asm-book-source/fe501647df571a9cfdb197f3cca5d7e9a27ac0e8/c08/c08.asm -------------------------------------------------------------------------------- /c08/c08_mbr.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichuang/x86-asm-book-source/fe501647df571a9cfdb197f3cca5d7e9a27ac0e8/c08/c08_mbr.asm -------------------------------------------------------------------------------- /c09/c09_1.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichuang/x86-asm-book-source/fe501647df571a9cfdb197f3cca5d7e9a27ac0e8/c09/c09_1.asm -------------------------------------------------------------------------------- /c09/c09_2.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichuang/x86-asm-book-source/fe501647df571a9cfdb197f3cca5d7e9a27ac0e8/c09/c09_2.asm -------------------------------------------------------------------------------- /c11/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ASMFILE=c11_mbr.asm 3 | 4 | all:$(ASMFILE) 5 | nasm -f bin $(ASMFILE) -o mbr.bin 6 | -rm myfile.vhd 7 | VBoxManage convertfromraw mbr.bin myfile.vhd --format VHD 8 | -------------------------------------------------------------------------------- /c11/c11_mbr.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichuang/x86-asm-book-source/fe501647df571a9cfdb197f3cca5d7e9a27ac0e8/c11/c11_mbr.asm -------------------------------------------------------------------------------- /c12/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ASMFILE=c12_mbr.asm 3 | 4 | all:$(ASMFILE) 5 | nasm -f bin $(ASMFILE) -o mbr.bin 6 | -rm myfile.vhd 7 | VBoxManage convertfromraw mbr.bin myfile.vhd --format VHD 8 | -------------------------------------------------------------------------------- /c12/c12_mbr.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichuang/x86-asm-book-source/fe501647df571a9cfdb197f3cca5d7e9a27ac0e8/c12/c12_mbr.asm -------------------------------------------------------------------------------- /c13/Makefile: -------------------------------------------------------------------------------- 1 | 2 | all:c13_mbr.asm 3 | nasm -f bin c13_mbr.asm -o mbr.bin 4 | nasm -f bin c13_core.asm -o core.bin 5 | nasm -f bin c13.asm -o c13.bin 6 | -rm myfile.vhd 7 | dd if=/dev/zero of=mbr.img count=10000 8 | dd if=mbr.bin of=mbr.img conv=notrunc 9 | dd if=core.bin of=mbr.img seek=1 conv=notrunc 10 | dd if=c13.bin of=mbr.img seek=50 conv=notrunc 11 | dd if=diskdata.txt of=mbr.img seek=100 conv=notrunc 12 | VBoxManage convertfromraw mbr.img c13.vhd --format VHD 13 | -------------------------------------------------------------------------------- /c13/c13.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichuang/x86-asm-book-source/fe501647df571a9cfdb197f3cca5d7e9a27ac0e8/c13/c13.asm -------------------------------------------------------------------------------- /c13/c13_core.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichuang/x86-asm-book-source/fe501647df571a9cfdb197f3cca5d7e9a27ac0e8/c13/c13_core.asm -------------------------------------------------------------------------------- /c13/c13_mbr.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichuang/x86-asm-book-source/fe501647df571a9cfdb197f3cca5d7e9a27ac0e8/c13/c13_mbr.asm -------------------------------------------------------------------------------- /c13/diskdata.txt: -------------------------------------------------------------------------------- 1 | The Intel386 Processor (1985) 2 | The Intel386 processor was the first 32-bit processor in the IA-32 architecture family. It introduced 32-bit registers for use both to hold operands and for addressing. The lower half of each 32-bit Intel386 register retains the properties of the 16-bit registers of earlier generations, permitting backward compatibility. The processor also provides a virtual-8086 mode that allows for even greater efficiency when executing programs created for 8086/8088 processors. [END] -------------------------------------------------------------------------------- /c14/Makefile: -------------------------------------------------------------------------------- 1 | 2 | all:c13_mbr.asm 3 | nasm -f bin c13_mbr.asm -o mbr.bin 4 | nasm -f bin c14_core.asm -o core.bin 5 | nasm -f bin c13.asm -o c13.bin 6 | -rm myfile.vhd 7 | dd if=/dev/zero of=mbr.img count=10000 8 | dd if=mbr.bin of=mbr.img conv=notrunc 9 | dd if=core.bin of=mbr.img seek=1 conv=notrunc 10 | dd if=c13.bin of=mbr.img seek=50 conv=notrunc 11 | dd if=diskdata.txt of=mbr.img seek=100 conv=notrunc 12 | VBoxManage convertfromraw mbr.img c14.vhd --format VHD 13 | -------------------------------------------------------------------------------- /c14/c13.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichuang/x86-asm-book-source/fe501647df571a9cfdb197f3cca5d7e9a27ac0e8/c14/c13.asm -------------------------------------------------------------------------------- /c14/c13_mbr.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichuang/x86-asm-book-source/fe501647df571a9cfdb197f3cca5d7e9a27ac0e8/c14/c13_mbr.asm -------------------------------------------------------------------------------- /c14/c14_core.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichuang/x86-asm-book-source/fe501647df571a9cfdb197f3cca5d7e9a27ac0e8/c14/c14_core.asm -------------------------------------------------------------------------------- /c14/diskdata.txt: -------------------------------------------------------------------------------- 1 | The Intel386 Processor (1985) 2 | The Intel386 processor was the first 32-bit processor in the IA-32 architecture family. It introduced 32-bit registers for use both to hold operands and for addressing. The lower half of each 32-bit Intel386 register retains the properties of the 16-bit registers of earlier generations, permitting backward compatibility. The processor also provides a virtual-8086 mode that allows for even greater efficiency when executing programs created for 8086/8088 processors. [END] -------------------------------------------------------------------------------- /c15/Makefile: -------------------------------------------------------------------------------- 1 | 2 | all:c13_mbr.asm 3 | nasm -f bin c13_mbr.asm -o mbr.bin 4 | nasm -f bin c15_core.asm -o core.bin 5 | nasm -f bin c15.asm -o c15.bin 6 | -rm myfile.vhd 7 | dd if=/dev/zero of=mbr.img count=10000 8 | dd if=mbr.bin of=mbr.img conv=notrunc 9 | dd if=core.bin of=mbr.img seek=1 conv=notrunc 10 | dd if=c15.bin of=mbr.img seek=50 conv=notrunc 11 | dd if=diskdata.txt of=mbr.img seek=100 conv=notrunc 12 | VBoxManage convertfromraw mbr.img c15.vhd --format VHD 13 | -------------------------------------------------------------------------------- /c15/c13_mbr.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichuang/x86-asm-book-source/fe501647df571a9cfdb197f3cca5d7e9a27ac0e8/c15/c13_mbr.asm -------------------------------------------------------------------------------- /c15/c15.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichuang/x86-asm-book-source/fe501647df571a9cfdb197f3cca5d7e9a27ac0e8/c15/c15.asm -------------------------------------------------------------------------------- /c15/c15_core.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichuang/x86-asm-book-source/fe501647df571a9cfdb197f3cca5d7e9a27ac0e8/c15/c15_core.asm -------------------------------------------------------------------------------- /c15/diskdata.txt: -------------------------------------------------------------------------------- 1 | The Intel386 Processor (1985) 2 | The Intel386 processor was the first 32-bit processor in the IA-32 architecture family. It introduced 32-bit registers for use both to hold operands and for addressing. The lower half of each 32-bit Intel386 register retains the properties of the 16-bit registers of earlier generations, permitting backward compatibility. The processor also provides a virtual-8086 mode that allows for even greater efficiency when executing programs created for 8086/8088 processors. [END] --------------------------------------------------------------------------------