From 490b26d0614f685990dcc9225c7826a34de77b48 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sun, 27 Dec 2020 10:57:44 -0800 Subject: 7426 --- html/baremetal/ex1.hex.html | 33 ++++++++-------- html/baremetal/ex2.hex.html | 96 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+), 16 deletions(-) create mode 100644 html/baremetal/ex2.hex.html (limited to 'html/baremetal') diff --git a/html/baremetal/ex1.hex.html b/html/baremetal/ex1.hex.html index bdfb696f..5fc1129c 100644 --- a/html/baremetal/ex1.hex.html +++ b/html/baremetal/ex1.hex.html @@ -53,22 +53,23 @@ if ('onhashchange' in window) {
  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 1280x1024 graphics mode.
- 4 #
- 5 # To convert to a disk image, first prepare a realistically sized disk image:
- 6 #   dd if=/dev/zero of=disk.img count=20160  # 512-byte sectors, so 10MB
- 7 # Load the disk image:
- 8 #   cat baremetal/boot.hex baremetal/ex1.hex  |./bootstrap run apps/hex  > a.bin
- 9 #   dd if=a.bin of=disk.img conv=notrunc
-10 # To run:
-11 #   qemu-system-i386 disk.img
-12 # Or:
-13 #   bochs -f apps/boot.bochsrc  # boot.bochsrc loads disk.img
-14 
-15 # address 0x8000
-16 e9 fb ff ff ff  # jump to address 0x8000
-17 
-18 # vim:ft=subx
+ 3 # On an emulator the window may get bigger to accomodate the higher-resolution
+ 4 # graphics mode.
+ 5 #
+ 6 # To convert to a disk image, first prepare a realistically sized disk image:
+ 7 #   dd if=/dev/zero of=disk.img count=20160  # 512-byte sectors, so 10MB
+ 8 # Load the disk image:
+ 9 #   cat baremetal/boot.hex baremetal/ex1.hex  |./bootstrap run apps/hex  > a.bin
+10 #   dd if=a.bin of=disk.img conv=notrunc
+11 # To run:
+12 #   qemu-system-i386 disk.img
+13 # Or:
+14 #   bochs -f apps/boot.bochsrc  # boot.bochsrc loads disk.img
+15 
+16 # main:  (address 0x8800)
+17 e9 fb ff ff ff  # jump to address 0x8800
+18 
+19 # vim:ft=subx
 
diff --git a/html/baremetal/ex2.hex.html b/html/baremetal/ex2.hex.html new file mode 100644 index 00000000..437dbb0d --- /dev/null +++ b/html/baremetal/ex2.hex.html @@ -0,0 +1,96 @@ + + + + +Mu - baremetal/ex2.hex + + + + + + + + + + +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 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   68 7d 00 00 # disp32
+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 <
+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
+35 
+36 # $break:
+37 e9 fb ff ff ff  # hang indefinitely
+38 
+39 # vim:ft=subx
+
+ + + -- cgit 1.4.1-2-gfad0