about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-12-27 08:33:22 -0800
committerKartik Agaram <vc@akkartik.com>2020-12-27 08:45:03 -0800
commit5095021f7778a7b11025f8492195ffd9be8cd870 (patch)
tree0999cf084275c7e0dbebff08537cf138ee123a2f
parent0e0b0c6edbe198d42725f03b6e83e75ea22f5429 (diff)
downloadmu-5095021f7778a7b11025f8492195ffd9be8cd870.tar.gz
7424 - baremetal: downsize graphics resolution
If it's large enough that I have doubts whether my top-of-the-line Mac
is showing the bottom of the screen inside an emulator, it's too large.

This way I also feel more confident that most modern hardware will support
this graphics mode, and that these programs will work for others.
-rw-r--r--baremetal/README.md2
-rw-r--r--baremetal/boot.hex4
-rw-r--r--baremetal/ex1.hex3
-rw-r--r--baremetal/ex2.hex4
4 files changed, 7 insertions, 6 deletions
diff --git a/baremetal/README.md b/baremetal/README.md
index 9932b662..4d1c2876 100644
--- a/baremetal/README.md
+++ b/baremetal/README.md
@@ -6,7 +6,7 @@ I'd like to eventually test these programs on real hardware, and to that end
 they are extremely parsimonious in the hardware they assume:
 
   0. Lots (more than 640KB/1MB[1]) of RAM
-  1. Pure-graphics video mode (1280x1024 pixels) in 256-color mode. At 8x8
+  1. Pure-graphics video mode (1024x768 pixels) in 256-color mode. At 8x8
      pixels per grapheme, this will give us 160x128 graphemes. But it's still
      an open question if it's reasonably widely supported by modern hardware.
      If it isn't, I'll downsize.
diff --git a/baremetal/boot.hex b/baremetal/boot.hex
index e8591dc7..5cb28127 100644
--- a/baremetal/boot.hex
+++ b/baremetal/boot.hex
@@ -30,7 +30,7 @@
 # Programs using this initialization:
 #   - can't use any syscalls
 #   - can't print text to video memory (past these boot sectors)
-#   - must only print raw pixels (256 colors) to video memory (resolution 1280x1024)
+#   - must only print raw pixels (256 colors) to video memory (resolution 1024x768)
 #   - must store their entry-point at address 0x8800
 
 ## 16-bit entry point
@@ -96,7 +96,7 @@
   # adjust video mode
   b4 4f  # ah <- 4f (VBE)
   b0 02  # al <- 02 (set video mode)
-  bb 07 41  # bx <- 0x0107 (graphics 1280x1024x256
+  bb 05 41  # bx <- 0x0105 (graphics 1024x768x256
             #               0x4000 bit = configure linear frame buffer in Bochs emulator; hopefully this doesn't hurt anything when running natively)
             # fallback mode: 0x0101 (640x480x256)
   cd 10  # int 10h, Vesa BIOS extensions
diff --git a/baremetal/ex1.hex b/baremetal/ex1.hex
index 39b458fa..d891b47e 100644
--- a/baremetal/ex1.hex
+++ b/baremetal/ex1.hex
@@ -1,6 +1,7 @@
 # The simplest possible program: just an infinite loop.
 # All is well if your computer clears screen and hangs without restarting.
-# On an emulator the window may get bigger to accomodate the 1280x1024 graphics mode.
+# On an emulator the window may get bigger to accomodate the higher-resolution
+# graphics mode.
 #
 # To convert to a disk image, first prepare a realistically sized disk image:
 #   dd if=/dev/zero of=disk.img count=20160  # 512-byte sectors, so 10MB
diff --git a/baremetal/ex2.hex b/baremetal/ex2.hex
index 78977c5f..c12f1d78 100644
--- a/baremetal/ex2.hex
+++ b/baremetal/ex2.hex
@@ -17,10 +17,10 @@
   0d  # 00/mod/indirect 001/r32/ecx 101/rm32/use-disp32
   68 7d 00 00 # disp32
 
-# eax <- LFB + 0x13ffff (1280*1024 - 1)
+# eax <- LFB + 0xbffff (1024*768 - 1)
 8d  # copy-address rm32 to r32
   81  # 10/mod/*+disp32 000/r32/eax 001/rm32/ecx
-  ff ff 13 00  # disp32
+  ff ff 0b 00  # disp32
 
 # $loop:
 # if (eax < ecx) break