about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-06-12 21:41:50 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-06-12 21:41:50 -0700
commit242b83ed46c0fa376535c7ef0458df1fe0e28ac0 (patch)
treedc87ee8377f9afca3662f79b4399e744f5691598
parentb78bff9307de43e7d7f1dc66b4f367b3d3d81449 (diff)
downloadmu-242b83ed46c0fa376535c7ef0458df1fe0e28ac0.tar.gz
roll back previous commit
These helpers don't actually help render to buffers with geometries different
from video RAM.
-rw-r--r--101screen.subx35
-rw-r--r--103grapheme.subx35
2 files changed, 22 insertions, 48 deletions
diff --git a/101screen.subx b/101screen.subx
index 22ce490c..2aab293d 100644
--- a/101screen.subx
+++ b/101screen.subx
@@ -9,43 +9,30 @@ pixel-on-real-screen:  # x: int, y: int, color: int
     # . prologue
     55/push-ebp
     89/<- %ebp 4/r32/esp
-    #
-    (pixel-on-screen-buffer *Video-memory-addr *(ebp+8) *(ebp+0xc) *(ebp+0x10))
-$pixel-on-real-screen:end:
-    # . epilogue
-    89/<- %esp 5/r32/ebp
-    5d/pop-to-ebp
-    c3/return
-
-# 'buffer' here is not a valid Mu type: a naked address without a length.
-pixel-on-screen-buffer:  # buffer: (addr byte), x: int, y: int, color: int
-    # . prologue
-    55/push-ebp
-    89/<- %ebp 4/r32/esp
     # . save registers
     50/push-eax
     51/push-ecx
     # bounds checks
-    8b/-> *(ebp+0xc) 0/r32/eax
+    8b/-> *(ebp+8) 0/r32/eax
     3d/compare-eax-and 0/imm32
-    7c/jump-if-< $pixel-on-screen-buffer:end/disp8
+    7c/jump-if-< $pixel-on-real-screen:end/disp8
     3d/compare-eax-and 0x400/imm32/screen-width=1024
-    7d/jump-if->= $pixel-on-screen-buffer:end/disp8
-    8b/-> *(ebp+0x10) 0/r32/eax
+    7d/jump-if->= $pixel-on-real-screen:end/disp8
+    8b/-> *(ebp+0xc) 0/r32/eax
     3d/compare-eax-and 0/imm32
-    7c/jump-if-< $pixel-on-screen-buffer:end/disp8
+    7c/jump-if-< $pixel-on-real-screen:end/disp8
     3d/compare-eax-and 0x300/imm32/screen-height=768
-    7d/jump-if->= $pixel-on-screen-buffer:end/disp8
+    7d/jump-if->= $pixel-on-real-screen:end/disp8
     # eax = y*1024 + x
-    8b/-> *(ebp+0x10) 0/r32/eax
+    8b/-> *(ebp+0xc) 0/r32/eax
     c1/shift 4/subop/left %eax 0xa/imm8
-    03/add-> *(ebp+0xc) 0/r32/eax
-    # eax += location of frame buffer
     03/add-> *(ebp+8) 0/r32/eax
+    # eax += location of frame buffer
+    03/add-> *Video-memory-addr 0/r32/eax
     # *eax = color
-    8b/-> *(ebp+0x14) 1/r32/ecx
+    8b/-> *(ebp+0x10) 1/r32/ecx
     88/byte<- *eax 1/r32/CL
-$pixel-on-screen-buffer:end:
+$pixel-on-real-screen:end:
     # . restore registers
     59/pop-to-ecx
     58/pop-to-eax
diff --git a/103grapheme.subx b/103grapheme.subx
index 4364206f..269e3c02 100644
--- a/103grapheme.subx
+++ b/103grapheme.subx
@@ -18,19 +18,6 @@ draw-grapheme-on-real-screen:  # g: grapheme, x: int, y: int, color: int, backgr
     # . prologue
     55/push-ebp
     89/<- %ebp 4/r32/esp
-    #
-    (draw-grapheme-on-screen-buffer *Video-memory-addr *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18))
-$draw-grapheme-on-real-screen:end:
-    # . epilogue
-    89/<- %esp 5/r32/ebp
-    5d/pop-to-ebp
-    c3/return
-
-# 'buffer' here is not a valid Mu type: a naked address without a length.
-draw-grapheme-on-screen-buffer:  # buffer: (addr byte), g: grapheme, x: int, y: int, color: int, background-color: int
-    # . prologue
-    55/push-ebp
-    89/<- %ebp 4/r32/esp
     # . save registers
     50/push-eax
     51/push-ecx
@@ -38,17 +25,17 @@ draw-grapheme-on-screen-buffer:  # buffer: (addr byte), g: grapheme, x: int, y:
     53/push-ebx
     56/push-esi
     # var letter-bitmap/esi = font[g]
-    8b/-> *(ebp+0xc) 6/r32/esi
+    8b/-> *(ebp+8) 6/r32/esi
     c1 4/subop/shift-left %esi 4/imm8
     81 0/subop/add %esi Font/imm32
     # if (letter-bitmap >= 0x9400) return  # characters beyond ASCII currently not supported
     81 7/subop/compare %esi 0x9400/imm32
-    7d/jump-if->= $draw-grapheme-on-screen-buffer:end/disp8
+    7d/jump-if->= $draw-grapheme-on-real-screen:end/disp8
     # var ycurr/edx: int = y*16
-    8b/-> *(ebp+0x14) 2/r32/edx
+    8b/-> *(ebp+0x10) 2/r32/edx
     c1 4/subop/shift-left %edx 4/imm8
     # var ymax/ebx: int = ycurr + 16
-    8b/-> *(ebp+0x14) 3/r32/ebx
+    8b/-> *(ebp+0x10) 3/r32/ebx
     c1 4/subop/shift-left %ebx 4/imm8
     81 0/subop/add %ebx 0x10/imm32
     {
@@ -56,11 +43,11 @@ draw-grapheme-on-screen-buffer:  # buffer: (addr byte), g: grapheme, x: int, y:
       39/compare %edx 3/r32/ebx
       7d/jump-if->= break/disp8
       # var xcurr/eax: int = x*8 + 7
-      8b/-> *(ebp+0x10) 0/r32/eax  # font-width - 1
+      8b/-> *(ebp+0xc) 0/r32/eax  # font-width - 1
       c1 4/subop/shift-left %eax 3/imm8
       05/add-to-eax 7/imm32
       # var xmin/ecx: int = x*8
-      8b/-> *(ebp+0x10) 1/r32/ecx
+      8b/-> *(ebp+0xc) 1/r32/ecx
       c1 4/subop/shift-left %ecx 3/imm8
       # var row-bitmap/ebx: int = *letter-bitmap
       53/push-ebx
@@ -74,12 +61,12 @@ draw-grapheme-on-screen-buffer:  # buffer: (addr byte), g: grapheme, x: int, y:
         # if LSB, draw a pixel in the given color
         {
           73/jump-if-not-CF break/disp8
-          (pixel-on-screen-buffer *(ebp+8) %eax %edx *(ebp+0x18))
-          eb/jump $draw-grapheme-on-screen-buffer:continue/disp8
+          (pixel-on-real-screen %eax %edx *(ebp+0x14))
+          eb/jump $draw-grapheme-on-real-screen:continue/disp8
         }
         # otherwise use the background color
-        (pixel-on-screen-buffer *(ebp+8) %eax %edx *(ebp+0x1c))
-$draw-grapheme-on-screen-buffer:continue:
+        (pixel-on-real-screen %eax %edx *(ebp+0x18))
+$draw-grapheme-on-real-screen:continue:
         # --x
         48/decrement-eax
         #
@@ -94,7 +81,7 @@ $draw-grapheme-on-screen-buffer:continue:
       #
       eb/jump loop/disp8
     }
-$draw-grapheme-on-screen-buffer:end:
+$draw-grapheme-on-real-screen:end:
     # . restore registers
     5e/pop-to-esi
     5b/pop-to-ebx