about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461