https://github.com/akkartik/mu/blob/main/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 baremetal/boot.bochsrc  # boot.bochsrc loads disk.img
12 #
13 # Expected output:
14 #   html/baremetal.png
15 
16 # main:  (address 0x9000)
17 
18 # ecx <- LFB
19 8b  # copy *rm32 to r32
20   0d  # 00/mod/indirect 001/r32/ecx 101/rm32/use-disp32
21   28 7f 00 00 # disp32 [label]
22 
23 # eax <- LFB + 0xbffff (1024*768 - 1)
24 8d  # copy-address rm32 to r32
25   81  # 10/mod/*+disp32 000/r32/eax 001/rm32/ecx
26   ff ff 0b 00  # disp32
27 
28 # $loop:
29 # if (eax < ecx) break
30 39  # compare rm32 with r32
31   c8  # 11/mod/direct 001/r32/ecx 000/rm32/eax
32 7c 05  # break if < [label]
33 # *eax <- al
34 88  # copy r8 to m8 at r32
35   00  # 00/mod/indirect 000/r8/AL 000/rm32/eax
36 48  # decrement eax
37 eb f7  # loop to -9 bytes [label]
38 
39 # $break:
40 e9 fb ff ff ff  # hang indefinitely
41 
42 # vim:ft=subx