about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2021-01-27 21:16:36 -0800
committerKartik Agaram <vc@akkartik.com>2021-01-27 21:16:36 -0800
commitca5ac5154e7a2fddb978ba14e83818498bdfb377 (patch)
treef189c7f4bdd543149635f482e9705cef075119d9
parent2c2ba73f656b0e7f821915ba79d1d8e7c7bf4fd1 (diff)
downloadmu-ca5ac5154e7a2fddb978ba14e83818498bdfb377.tar.gz
7671
Make some room for a mouse handler.
-rw-r--r--baremetal/101screen.subx2
-rw-r--r--baremetal/boot.hex101
-rw-r--r--baremetal/ex2.hex2
-rw-r--r--baremetal/ex2.subx2
-rw-r--r--baremetal/ex3.hex2
5 files changed, 56 insertions, 53 deletions
diff --git a/baremetal/101screen.subx b/baremetal/101screen.subx
index cac9593e..46cee777 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-> *0x8128 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 47c7d42f..4261ecfe 100644
--- a/baremetal/boot.hex
+++ b/baremetal/boot.hex
@@ -38,7 +38,7 @@
 # padding), and then we jump into a better notation. The rest of the stack
 # (really only in a couple of slightly higher-level places) only needs to know
 # a few magic constants:
-#   Video memory: start is stored at 0x7f28
+#   Video memory: start is stored at 0x8128
 #   Keyboard buffer: starts at 0x7ee0
 
 # Outline of this file with offsets and the addresses they map to at run-time:
@@ -54,10 +54,10 @@
 # -- 32-bit mode data
 #           2e0 (address 7ee0) <== keyboard buffer
 #           2f8 (address 7ef8) <== idt_descriptor
-#   offset  300 (address 7f00): video mode data (256 bytes)
-#           328 (address 7f28) <== start of video RAM stored here
-#   offset  400 (address 8000): interrupt descriptor table (1KB)
-#   offset  800 (address 8400): keyboard mappings (2KB)
+#   offset  500 (address 8100): video mode data (256 bytes)
+#           528 (address 8128) <== start of video RAM stored here
+#   offset  600 (address 8200): interrupt descriptor table (1KB)
+#   offset  a00 (address 8600): keyboard mappings (1.5KB)
 #   offset 1000 (address 8c00): bitmap font (2KB)
 #   offset 1800 (address 9400): entrypoint for applications (don't forget to adjust survey_baremetal if this changes)
 
@@ -148,7 +148,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 81  # di <- 0x7f00 (video mode info) [label]
   cd 10
 
 # 55:
@@ -377,24 +377,25 @@ e9 fd ff  # loop forever
 # $4:
 # 278:
   # - convert key to character
-  # if (shift) keyboard normal map += 0x100
+  # if (shift) use keyboard normal map
   81  # operate on rm32 and imm32
     3d  # 00/mod/indirect 111/subop/compare 101/rm32/use-disp32
     dc 7e 00 00  # disp32 = shift [label]
     00 00 00 00  # imm32
   74 08  # jump to $5 if = [label]
 # 284:
+  # otherwise use keyboard shift map
   # al <- *(keyboard shift map + eax)
   8a  # copy m8 at rm32 to r8
     80  # 10/mod/*+disp32 000/r8/al 000/rm32/eax
-    00 85 00 00  # disp32 [label]
+    00 87 00 00  # disp32 [label]
   eb 06  # jump to $6 [label]
 # $5:
 # 28c:
   # al <- *(keyboard normal map + eax)
   8a  # copy m8 at rm32 to r8
     80  # 10/mod/*+disp32 000/r8/al 000/rm32/eax
-    00 84 00 00  # disp32 [label]
+    00 86 00 00  # disp32 [label]
 # $6:
 # 292:
   # - if there's no character mapping, return
@@ -449,13 +450,49 @@ e9 fd ff  # loop forever
 # 2f8:
 # idt_descriptor:
   ff 03  # idt_end - idt_start - 1
-  00 80 00 00  # start = idt_start [label]
+  00 82 00 00  # start = idt_start [label]
 
 # padding
 # 2fe:
                                           00 00
 
-# offset 300 (address 0x7f00):
+# offset 300
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 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 400
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 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 500 (address 0x8100):
 # video mode info {{{
   00 00  # attributes
   00  # winA
@@ -510,7 +547,7 @@ e9 fd ff  # loop forever
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 # }}}
 
-# offset 400 (address 0x8000):
+# offset 600 (address 0x8200):
 # interrupt descriptor table {{{
 # 128 entries * 8 bytes each = 1024 bytes (0x400)
 # idt_start:
@@ -675,7 +712,7 @@ e9 fd ff  # loop forever
 
 ## the rest of this file has data
 
-# offset 800 (address 0x8400):
+# offset a00 (address 0x8600):
 # translating keys to ASCII {{{
 # keyboard normal map:
 00
@@ -717,7 +754,7 @@ e9 fd ff  # loop forever
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 
-# 900:
+# offset b00:
 # keyboard shift map:
 00
 #  es
@@ -756,7 +793,7 @@ e9 fd ff  # loop forever
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 
-# a00:
+# c00:
 # keyboard ctrl map:
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
@@ -776,40 +813,6 @@ e9 fd ff  # loop forever
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 
 # padding (there might be more keyboard tables)
-# b00:
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-# c00:
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 # d00:
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
diff --git a/baremetal/ex2.hex b/baremetal/ex2.hex
index 439a0e03..171505e9 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 81 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..074d641e 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/-> *0x8128 1/r32/ecx
 
   # eax <- final pixel of video memory
   8d/copy-address *(ecx + 0x0bffff) 0/r32/eax  # 0xbffff = 1024*768 - 1
diff --git a/baremetal/ex3.hex b/baremetal/ex3.hex
index 694de37d..d3639948 100644
--- a/baremetal/ex3.hex
+++ b/baremetal/ex3.hex
@@ -16,7 +16,7 @@
 # eax <- LFB
 8b  # copy *rm32 to r32
   05  # 00/mod/indirect 000/r32/eax 101/rm32/use-disp32
-  28 7f 00 00 # disp32 [label]
+  28 81 00 00 # disp32 [label]
 
 # var read index/ecx: byte = 0
 31 c9  # ecx <- xor ecx;  11/direct 001/r32/ecx 001/rm32/ecx