I am playing around with bootloader code. My code is supposed to print an 'A' on the top left corner of the display. I use NASM:
BITS 16
mov al, 0x41 ; hex code for 'A'
mov ebx, 0xB8000 ; text screen video memory
mov byte [ebx], al ; write 'A' into video memory
; hlt machine
end:
hlt
jmp end
; MBR signature
times 510-($-$$) db 0
db 0x55, 0xAA
My code is working so far, as I can run it with
nasm boot.asm -o boot.bin && qemu-system-x86_64 boot.bin
When I disassemble my boot.bin
file with objdump -D -b binary -mi386 boot.bin
I get the following output:
Disassembly of section .data:
00000000 <.data>:
0: b0 41 mov $0x41,%al
2: 66 bb 00 80 mov $0x8000,%bx
6: 0b 00 or (%eax),%eax
8: 67 88 03 mov %al,(%bp,%di)
b: f4 hlt
c: eb fd jmp 0xb
...
1fe: 55 push %ebp
1ff: aa stos %al,%es:(%edi)
I fully understand the output except the part or (%eax),%eax
.
What is the purpose of this instruction and why has NASM generated it?