@comzyh
2015-12-06T14:54:08.000000Z
字数 2859
阅读 1631
未分类
dd if=/dev/my-device of=mbr bs=512 count=1
sudo dd if=mbr of=/dev/sdc seek=446 bs=1 count=64 skip=446
objdump -D -b binary -mi386 -Maddr16,data16
http://www.itzhai.com/assembly-int-10h-description.html
14、功能0EH
功能描述:在Teletype模式下显示字符
入口参数:AH=0EH
AL= 字符
BH=页码
BL=前景色(图形模式)
出口参数:无
41: ac lods %ds:(%si),%al
42: 3c 00 cmp 0x7,%bx
49: b4 0e mov 0x10
4d: eb f2 jmp 0x41
sudo apt-get install nasm qemu gcc
http://www.digitalthreat.net/2009/09/a-simple-bootloader/
https://zh.wikipedia.org/wiki/BIOS_%E4%B8%AD%E6%96%B7%E5%91%BC%E5%8F%AB
http://stackoverflow.com/questions/32682152/how-to-reboot-in-x86-assembly-from-16-bit-real-mode
[BITS 16][ORG 0x7C00]MOV SI, str_HelloWorldCALL PrintStringJMP WaitForKeyAndRestartPrintString:MOV AL, [SI]OR AL, ALJZ exit_printMOV AH, 0x0E ; Teletype ModeMOV BH, 0x00 ; Page zeroMOV BL, 0x07 ; Light GrayINT 0x10INC SIJMP PrintStringexit_print:RETWaitForKeyAndRestart:MOV AH, 0x00INT 0x16MOV SI, str_RestartingCALL PrintString;jmp 0xFFFFJMP rebootreboot:db 0x0eadw 0x0000dw 0xffffstr_HelloWorld db 'Hello World, press R key to restart', 0str_Restarting db 'Restarting', 0TIMES 510 - ($ - $$) DB 0db 0x55db 0xaa
0000000: be2b 7ce8 0200 eb12 8a04 08c0 740b b40e .+|.........t...0000010: b700 b307 cd10 46eb efc3 b400 cd16 be50 ......F........P0000020: 7ce8 e4ff eb00 ea00 00ff ff48 656c 6c6f |..........Hello0000030: 2057 6f72 6c64 2c20 7072 6573 7320 2052 World, press R0000040: 206b 6579 2074 6f20 7265 7374 6172 7400 key to restart.0000050: 5265 7374 6172 7469 6e67 0000 0000 0000 Restarting......0000060: 0000 0000 0000 0000 0000 0000 0000 0000 ................0000070: 0000 0000 0000 0000 0000 0000 0000 0000 ................0000080: 0000 0000 0000 0000 0000 0000 0000 0000 ................0000090: 0000 0000 0000 0000 0000 0000 0000 0000 ................00000a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................00000b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................00000c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................00000d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................00000e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................00000f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................0000100: 0000 0000 0000 0000 0000 0000 0000 0000 ................0000110: 0000 0000 0000 0000 0000 0000 0000 0000 ................0000120: 0000 0000 0000 0000 0000 0000 0000 0000 ................0000130: 0000 0000 0000 0000 0000 0000 0000 0000 ................0000140: 0000 0000 0000 0000 0000 0000 0000 0000 ................0000150: 0000 0000 0000 0000 0000 0000 0000 0000 ................0000160: 0000 0000 0000 0000 0000 0000 0000 0000 ................0000170: 0000 0000 0000 0000 0000 0000 0000 0000 ................0000180: 0000 0000 0000 0000 0000 0000 0000 0000 ................0000190: 0000 0000 0000 0000 0000 0000 0000 0000 ................00001a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................00001b0: 0000 0000 0000 0000 0000 0000 0000 0020 ...............00001c0: 2100 0cfe ffff 0008 0000 00f0 9e03 0000 !...............00001d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................00001e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................00001f0: 0000 0000 0000 0000 0000 0000 0000 55aa ..............U.