From 395f736d1ae339f9b633ae36e10b42fbca2d26f9 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Tue, 29 Dec 2020 19:28:56 -0800 Subject: 7464 --- html/baremetal/ex1.subx.html | 76 ++++++++++++++++++++++++++++++++++++ html/baremetal/ex2.subx.html | 93 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 169 insertions(+) create mode 100644 html/baremetal/ex1.subx.html create mode 100644 html/baremetal/ex2.subx.html (limited to 'html/baremetal') diff --git a/html/baremetal/ex1.subx.html b/html/baremetal/ex1.subx.html new file mode 100644 index 00000000..c4bbcfec --- /dev/null +++ b/html/baremetal/ex1.subx.html @@ -0,0 +1,76 @@ + + + + +Mu - baremetal/ex1.subx + + + + + + + + + + +https://github.com/akkartik/mu/blob/master/baremetal/ex1.subx +
+ 1 # The simplest possible program: just an infinite loop.
+ 2 # All is well if your computer clears screen and hangs without restarting.
+ 3 # On an emulator the window may get bigger to accomodate the higher-resolution
+ 4 # graphics mode.
+ 5 #
+ 6 # To build a disk image:
+ 7 #   ./translate_subx_baremetal baremetal/ex2.subx    # emits disk.img
+ 8 # To run:
+ 9 #   qemu-system-i386 disk.img
+10 # Or:
+11 #   bochs -f baremetal/boot.bochsrc  # boot.bochsrc loads disk.img
+12 
+13 == code
+14 
+15 $loop:
+16 e9/jump $loop/disp32
+17 
+18 # vim:ft=subx
+
+ + + diff --git a/html/baremetal/ex2.subx.html b/html/baremetal/ex2.subx.html new file mode 100644 index 00000000..ae4eb8a8 --- /dev/null +++ b/html/baremetal/ex2.subx.html @@ -0,0 +1,93 @@ + + + + +Mu - baremetal/ex2.subx + + + + + + + + + + +https://github.com/akkartik/mu/blob/master/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 # main:  (address 0x8800)
+11 
+12 == code
+13 
+14 # ecx <- start of video memory
+15 8b/-> 0/mod/indirect 5/rm32/use-disp32 0x7f28/disp32/video-memory  1/r32/ecx
+16 
+17 # eax <- final pixel of video memory
+18 8d/copy-address *(ecx + 0x0bffff) 0/r32/eax  # 0xbffff = 1024*768 - 1
+19 
+20 # for each pixel in video memory
+21 {
+22   39/compare %eax 1/r32/ecx
+23   7c/jump-if-< break/disp8
+24   # write its column number to it
+25   88/byte<- *eax 0/r32/AL
+26   48/decrement-eax
+27   eb/jump loop/disp8
+28 }
+29 
+30 # hang indefinitely
+31 {
+32   eb/jump loop/disp8
+33 }
+34 
+35 # vim:ft=subx
+
+ + + -- cgit 1.4.1-2-gfad0