about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2021-01-24 12:23:16 -0800
committerKartik Agaram <vc@akkartik.com>2021-01-24 19:43:23 -0800
commit1c77be68d75d8134bea72305057eb9ce523e9748 (patch)
tree701c8a015f544550ed42050c0f60f08f2a78b746
parent0cf7cecedc463891c236e3c81a19cd24ce6efc70 (diff)
downloadmu-1c77be68d75d8134bea72305057eb9ce523e9748.tar.gz
7558
Bochs is still broken, but before we can fix it we need to make some
room in the boot sector. So we'll spend a few commits reorganizing
things.
-rw-r--r--baremetal/101screen.subx2
-rw-r--r--baremetal/boot.hex120
-rw-r--r--baremetal/ex2.hex2
-rw-r--r--baremetal/ex2.subx2
4 files changed, 63 insertions, 63 deletions
diff --git a/baremetal/101screen.subx b/baremetal/101screen.subx
index cac9593e..c2229a59 100644
--- a/baremetal/101screen.subx
+++ b/baremetal/101screen.subx
@@ -28,7 +28,7 @@ pixel-on-real-screen:  # x: int, y: int, color: int
     c1/shift 4/subop/left %eax 0xa/imm8
     03/add-> *(ebp+8) 0/r32/eax
     # eax += location of frame buffer
-    03/add-> *0x7f28 0/r32/eax  # unsafe
+    03/add-> *0x7e28 0/r32/eax  # unsafe
     # *eax = color
     8b/-> *(ebp+0x10) 1/r32/ecx
     88/byte<- *eax 1/r32/CL
diff --git a/baremetal/boot.hex b/baremetal/boot.hex
index 491e3718..b54aaa52 100644
--- a/baremetal/boot.hex
+++ b/baremetal/boot.hex
@@ -42,9 +42,9 @@
 #           1c8 (address 7dc8) <== keyboard buffer
 #           1f8 (address 7df8) <== idt_descriptor
 #           1fe (address 7dfe) boot sector marker (2 bytes)
-#   offset  200 (address 7e00): interrupt descriptor table (256 bytes)
-#   offset  300 (address 7f00): video mode data (256 bytes)
-#           328 (address 7f28) <== start of video RAM stored here
+#   offset  200 (address 7e00): video mode data (256 bytes)
+#           228 (address 7e28) <== start of video RAM stored here
+#   offset  300 (address 7f00): interrupt descriptor table (256 bytes)
 #   offset  400 (address 8000): keyboard mappings (2KB)
 #   offset  c00 (address 8800): bitmap font (2KB)
 #   offset 1400 (address 9000): entrypoint for applications (don't forget to adjust survey_baremetal if this changes)
@@ -145,7 +145,7 @@
   b4 4f  # ah <- 4f (VBE)
   b0 01  # al <- 01 (get video mode)
   b9 07 01  # cx <- 0x0107 (mode we requested)
-  bf 00 7f  # di <- 0x7f00 (video mode info) [label]
+  bf 00 7e  # di <- 0x7e00 (video mode info) [label]
   cd 10
 
 # 6c:
@@ -360,7 +360,7 @@ e9 fd ff  # loop forever
 # 1f8:
 # idt_descriptor:
   ff 00  # idt_end - idt_start - 1
-  00 7e 00 00  # start = idt_start [label]
+  00 7f 00 00  # start = idt_start [label]
 
 # 1fe:
 # final 2 bytes of boot sector
@@ -369,7 +369,61 @@ e9 fd ff  # loop forever
 ## sector 2
 # loaded by load_disk, not automatically on boot
 
-# offset 200 (address 0x7e00): interrupt descriptor table
+# offset 200 (address 0x7e00):
+# video mode info:
+  00 00  # attributes
+  00  # winA
+  00  # winB
+# 204
+  00 00  # granularity
+  00 00  # winsize
+# 208
+  00 00  # segmentA
+  00 00  # segmentB
+# 20c
+  00 00 00 00  # realFctPtr (who knows)
+# 210
+  00 00  # pitch
+  00 00  # Xres
+# 214
+  00 00  # Yres
+  00 00  # Wchar Ychar
+# 218
+  00  # planes
+  00  # bpp
+  00  # banks
+  00  # memory_model
+# 21c
+  00  # bank_size
+  00  # image_pages
+  00  # reserved
+# 21f
+  00 00  # red_mask red_position
+  00 00  # green_mask green_position
+  00 00  # blue_mask blue_position
+  00 00  # rsv_mask rsv_position
+  00  # directcolor_attributes
+# 228
+  00 00 00 00  # physbase <== linear frame buffer
+
+# 22c
+# reserved for video mode info
+                                    00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+
+# offset 300 (address 0x7f00): interrupt descriptor table
 # 32 entries * 8 bytes each = 256 bytes (0x100)
 # idt_start:
 
@@ -423,60 +477,6 @@ e9 fd ff  # loop forever
 00 00 00 00 00 00 00 00
 # idt_end:
 
-# offset 300 (address 0x7f00):
-# video mode info:
-  00 00  # attributes
-  00  # winA
-  00  # winB
-# 304
-  00 00  # granularity
-  00 00  # winsize
-# 308
-  00 00  # segmentA
-  00 00  # segmentB
-# 30c
-  00 00 00 00  # realFctPtr (who knows)
-# 310
-  00 00  # pitch
-  00 00  # Xres
-# 314
-  00 00  # Yres
-  00 00  # Wchar Ychar
-# 318
-  00  # planes
-  00  # bpp
-  00  # banks
-  00  # memory_model
-# 31c
-  00  # bank_size
-  00  # image_pages
-  00  # reserved
-# 31f
-  00 00  # red_mask red_position
-  00 00  # green_mask green_position
-  00 00  # blue_mask blue_position
-  00 00  # rsv_mask rsv_position
-  00  # directcolor_attributes
-# 328
-  00 00 00 00  # physbase <== linear frame buffer
-
-# 32c
-# reserved for video mode info
-                                    00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-
 ## the rest of this file has data
 
 # offset 400 (address 0x8000):
diff --git a/baremetal/ex2.hex b/baremetal/ex2.hex
index 439a0e03..f3c12260 100644
--- a/baremetal/ex2.hex
+++ b/baremetal/ex2.hex
@@ -18,7 +18,7 @@
 # ecx <- LFB
 8b  # copy *rm32 to r32
   0d  # 00/mod/indirect 001/r32/ecx 101/rm32/use-disp32
-  28 7f 00 00 # disp32 [label]
+  28 7e 00 00 # disp32 [label]
 
 # eax <- LFB + 0xbffff (1024*768 - 1)
 8d  # copy-address rm32 to r32
diff --git a/baremetal/ex2.subx b/baremetal/ex2.subx
index 57806e34..b1f42114 100644
--- a/baremetal/ex2.subx
+++ b/baremetal/ex2.subx
@@ -14,7 +14,7 @@
 
 main:
   # ecx <- start of video memory
-  8b/-> *0x7f28 1/r32/ecx
+  8b/-> *0x7e28 1/r32/ecx
 
   # eax <- final pixel of video memory
   8d/copy-address *(ecx + 0x0bffff) 0/r32/eax  # 0xbffff = 1024*768 - 1