https://github.com/akkartik/mu/blob/master/baremetal/ex2.hex
 1 # Test out the video mode by filling in the screen with pixels.
 2 #
 3 # To run, first prepare a realistically sized disk image:
 4 #   dd if=/dev/zero of=disk.img count=20160  # 512-byte sectors, so 10MB
 5 # Load the program on the disk image:
 6 #   cat baremetal/boot.hex baremetal/ex2.hex  |./bootstrap run apps/hex  > a.bin
 7 #   dd if=a.bin of=disk.img conv=notrunc
 8 # To run:
 9 #   qemu-system-i386 disk.img
10 # Or:
11 #   bochs -f apps/boot.bochsrc  # boot.bochsrc loads disk.img
12 
13 # main:  (address 0x8800)
14 
15 # ecx <- LFB
16 8b  # copy *rm32 to r32
17   0d  # 00/mod/indirect 001/r32/ecx 101/rm32/use-disp32
18   28 7f 00 00 # disp32 [label]
19 
20 # eax <- LFB + 0xbffff (1024*768 - 1)
21 8d  # copy-address rm32 to r32
22   81  # 10/mod/*+disp32 000/r32/eax 001/rm32/ecx
23   ff ff 0b 00  # disp32
24 
25 # $loop:
26 # if (eax < ecx) break
27 39  # compare rm32 with r32
28   c8  # 11/mod/direct 001/r32/ecx 000/rm32/eax
29 7c 05  # break if < [label]
30 # *eax <- al
31 88  # copy r8 to m8 at r32
32   00  # 00/mod/indirect 000/r8/AL 000/rm32/eax
33 48  # decrement eax
34 eb f7  # loop to -9 bytes [label]
35 
36 # $break:
37 e9 fb ff ff ff  # hang indefinitely
38 
39 # vim:ft=subx