diff --git a/html/baremetal/101screen.subx.html b/html/baremetal/101screen.subx.html index df52a5b8..038e8f78 100644 --- a/html/baremetal/101screen.subx.html +++ b/html/baremetal/101screen.subx.html @@ -15,8 +15,8 @@ body { font-size:12pt; font-family: monospace; color: #000000; background-color: a { color:inherit; } * { font-size:12pt; font-size: 1em; } .subxComment { color: #005faf; } -.LineNr { } .subxS1Comment { color: #0000af; } +.LineNr { } .subxFunction { color: #af5f00; text-decoration: underline; } .Constant { color: #008787; } --> diff --git a/html/baremetal/102keyboard.subx.html b/html/baremetal/102keyboard.subx.html index f841e696..cc092133 100644 --- a/html/baremetal/102keyboard.subx.html +++ b/html/baremetal/102keyboard.subx.html @@ -15,8 +15,8 @@ body { font-size:12pt; font-family: monospace; color: #000000; background-color: a { color:inherit; } * { font-size:12pt; font-size: 1em; } .subxComment { color: #005faf; } -.LineNr { } .subxS1Comment { color: #0000af; } +.LineNr { } .subxFunction { color: #af5f00; text-decoration: underline; } .Constant { color: #008787; } --> diff --git a/html/baremetal/103grapheme.subx.html b/html/baremetal/103grapheme.subx.html index b34168d6..13dc6073 100644 --- a/html/baremetal/103grapheme.subx.html +++ b/html/baremetal/103grapheme.subx.html @@ -14,9 +14,10 @@ pre { white-space: pre-wrap; font-family: monospace; color: #000000; background- body { font-size:12pt; font-family: monospace; color: #000000; background-color: #c6c6c6; } a { color:inherit; } * { font-size:12pt; font-size: 1em; } +.SpecialChar { color: #d70000; } .subxComment { color: #005faf; } -.LineNr { } .subxS1Comment { color: #0000af; } +.LineNr { } .subxFunction { color: #af5f00; text-decoration: underline; } .Constant { color: #008787; } --> @@ -54,76 +55,117 @@ if ('onhashchange' in window) {
https://github.com/akkartik/mu/blob/main/baremetal/103grapheme.subx- 1 draw-grapheme: # screen: (addr screen), g: grapheme, x: int, y: int, color: int - 2 # . prologue - 3 55/push-ebp - 4 89/<- %ebp 4/r32/esp - 5 # . save registers - 6 50/push-eax - 7 51/push-ecx - 8 52/push-edx - 9 53/push-ebx -10 56/push-esi -11 # var letter-bitmap/esi = font[g] -12 8b/-> *(ebp+0xc) 6/r32/esi -13 c1 4/subop/shift-left %esi 4/imm8 -14 8d/copy-address *(esi+0x8800) 6/r32/esi # font-start -15 # if (letter-bitmap >= 0x9000) return # characters beyond ASCII currently not supported -16 81 7/subop/compare %esi 0x9000/imm32 -17 7d/jump-if->= $draw-grapheme:end/disp8 -18 # edx = y -19 8b/-> *(ebp+0x14) 2/r32/edx -20 # var ymax/ebx: int = y + 16 -21 8b/-> *(ebp+0x14) 3/r32/ebx -22 81 0/subop/add %ebx 0x10/imm32 -23 { -24 # if (y >= ymax) break -25 39/compare %edx 3/r32/ebx -26 7d/jump-if->= break/disp8 -27 # eax = x + 7 -28 8b/-> *(ebp+0x10) 0/r32/eax -29 81 0/subop/add %eax 7/imm32 -30 # var xmin/ecx: int = x -31 8b/-> *(ebp+0x10) 1/r32/ecx -32 # var row-bitmap/ebx: int = *letter-bitmap -33 53/push-ebx -34 8b/-> *esi 3/r32/ebx -35 { -36 # if (x < xmin) break -37 39/compare %eax 1/r32/ecx -38 7c/jump-if-< break/disp8 -39 # shift LSB from row-bitmap into carry flag (CF) -40 c1 5/subop/shift-right-logical %ebx 1/imm8 -41 # if LSB, draw a pixel -42 { -43 73/jump-if-not-CF break/disp8 -44 (pixel *(ebp+8) %eax %edx *(ebp+0x18)) -45 } -46 # --x -47 48/decrement-eax -48 # -49 eb/jump loop/disp8 -50 } -51 # reclaim row-bitmap -52 5b/pop-to-ebx -53 # ++y -54 42/increment-edx -55 # next bitmap row -56 46/increment-esi -57 # -58 eb/jump loop/disp8 -59 } -60 $draw-grapheme:end: -61 # . restore registers -62 5e/pop-to-esi -63 5b/pop-to-ebx -64 5a/pop-to-edx -65 59/pop-to-ecx -66 58/pop-to-eax -67 # . epilogue -68 89/<- %esp 5/r32/ebp -69 5d/pop-to-ebp -70 c3/return + 1 draw-grapheme: # screen: (addr screen), g: grapheme, x: int, y: int, color: int + 2 # . prologue + 3 55/push-ebp + 4 89/<- %ebp 4/r32/esp + 5 # . save registers + 6 50/push-eax + 7 51/push-ecx + 8 52/push-edx + 9 53/push-ebx + 10 56/push-esi + 11 # TODO: support fake screen; we currently assume 'screen' is always 0 (real) + 12 # var letter-bitmap/esi = font[g] + 13 8b/-> *(ebp+0xc) 6/r32/esi + 14 c1 4/subop/shift-left %esi 4/imm8 + 15 8d/copy-address *(esi+0x8800) 6/r32/esi # font-start + 16 # if (letter-bitmap >= 0x9000) return # characters beyond ASCII currently not supported + 17 81 7/subop/compare %esi 0x9000/imm32 + 18 7d/jump-if->= $draw-grapheme:end/disp8 + 19 # edx = y + 20 8b/-> *(ebp+0x14) 2/r32/edx + 21 # var ymax/ebx: int = y + 16 + 22 8b/-> *(ebp+0x14) 3/r32/ebx + 23 81 0/subop/add %ebx 0x10/imm32 + 24 { + 25 # if (y >= ymax) break + 26 39/compare %edx 3/r32/ebx + 27 7d/jump-if->= break/disp8 + 28 # eax = x + 7 + 29 8b/-> *(ebp+0x10) 0/r32/eax + 30 81 0/subop/add %eax 7/imm32 + 31 # var xmin/ecx: int = x + 32 8b/-> *(ebp+0x10) 1/r32/ecx + 33 # var row-bitmap/ebx: int = *letter-bitmap + 34 53/push-ebx + 35 8b/-> *esi 3/r32/ebx + 36 { + 37 # if (x < xmin) break + 38 39/compare %eax 1/r32/ecx + 39 7c/jump-if-< break/disp8 + 40 # shift LSB from row-bitmap into carry flag (CF) + 41 c1 5/subop/shift-right-logical %ebx 1/imm8 + 42 # if LSB, draw a pixel + 43 { + 44 73/jump-if-not-CF break/disp8 + 45 (pixel *(ebp+8) %eax %edx *(ebp+0x18)) + 46 } + 47 # --x + 48 48/decrement-eax + 49 # + 50 eb/jump loop/disp8 + 51 } + 52 # reclaim row-bitmap + 53 5b/pop-to-ebx + 54 # ++y + 55 42/increment-edx + 56 # next bitmap row + 57 46/increment-esi + 58 # + 59 eb/jump loop/disp8 + 60 } + 61 $draw-grapheme:end: + 62 # . restore registers + 63 5e/pop-to-esi + 64 5b/pop-to-ebx + 65 5a/pop-to-edx + 66 59/pop-to-ecx + 67 58/pop-to-eax + 68 # . epilogue + 69 89/<- %esp 5/r32/ebp + 70 5d/pop-to-ebp + 71 c3/return + 72 + 73 cursor-position: # screen: (addr screen) -> _/eax: int, _/ecx: int + 74 # . prologue + 75 55/push-ebp + 76 89/<- %ebp 4/r32/esp + 77 # TODO: support fake screen; we currently assume 'screen' is always 0 (real) + 78 8b/-> *Default-next-x 0/r32/eax + 79 8b/-> *Default-next-y 1/r32/ecx + 80 $cursor-position:end: + 81 # . epilogue + 82 89/<- %esp 5/r32/ebp + 83 5d/pop-to-ebp + 84 c3/return + 85 + 86 set-cursor-position: # screen: (addr screen), x: int, y: int + 87 # . prologue + 88 55/push-ebp + 89 89/<- %ebp 4/r32/esp + 90 # . save registers + 91 50/push-eax + 92 # TODO: support fake screen; we currently assume 'screen' is always 0 (real) + 93 8b/-> *(ebp+0xc) 0/r32/eax + 94 89/<- *Default-next-x 0/r32/eax + 95 8b/-> *(ebp+0x10) 0/r32/eax + 96 89/<- *Default-next-y 0/r32/eax + 97 $set-cursor-position:end: + 98 # . restore registers + 99 58/pop-to-eax +100 # . epilogue +101 89/<- %esp 5/r32/ebp +102 5d/pop-to-ebp +103 c3/return +104 +105 == data +106 +107 Default-next-x: +108 0/imm32 +109 +110 Default-next-y: +111 0/imm32