mov bx, 0 ; counter mov ah, 0x0E ; for teletype writing http://www.ctyme.com/intr/rb-0106.htm .print_char: mov al, [string + bx] ; character of string push bx ; storing counter in the stack mov bx, 0x0009 ; set page (no page) and color light blue (0x09) https://en.wikipedia.org/wiki/BIOS_color_attributes int 0x10 cmp al, 0 ; is this the end of the string? je .exit pop bx ; restoring from the stack inc bx jmp .print_char
.exit: ret hlt string db 'Wake up Neo...', 0
TIMES 510 - ($ - $$) db 0 ; Fill the rest of sector with 0 dw 0xaa55 ; MBR (Master Boot Record) magic numbers
利用qemu启动上述的程序,用于在启动窗口中打印Wake up Neo。。。,在脚本中,可以看到的现象是程序hang住,在对应的图形界面中,可以看到qemu窗口被打开,并在窗口中打印了`Wake up Neo...`