https://github.com/akkartik/mu/blob/main/baremetal/ex2.subx
 1 # Test out the video mode by filling in the screen with pixels.
 2 #
 3 # To build a disk image:
 4 #   ./translate_subx_baremetal baremetal/ex2.subx    # emits disk.img
 5 # To run:
 6 #   qemu-system-i386 disk.img
 7 # Or:
 8 #   bochs -f baremetal/boot.bochsrc  # boot.bochsrc loads disk.img
 9 #
10 # Expected output:
11 #   html/baremetal.png
12 
13 == code
14 
15 main:
16   # ecx <- start of video memory
17   8b/-> *0x7f28 1/r32/ecx
18 
19   # eax <- final pixel of video memory
20   8d/copy-address *(ecx + 0x0bffff) 0/r32/eax  # 0xbffff = 1024*768 - 1
21 
22   # for each pixel in video memory
23   {
24     39/compare %eax 1/r32/ecx
25     7c/jump-if-< break/disp8
26     # write its column number to it
27     88/byte<- *eax 0/r32/AL
28     48/decrement-eax
29     eb/jump loop/disp8
30   }
31 
32   # hang indefinitely
33   {
34     eb/jump loop/disp8
35   }