From 691dd9cbd1f5a251509571040c35cf3befe059a5 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Tue, 29 Dec 2020 21:23:25 -0800 Subject: 7473 --- html/baremetal/101screen.subx.html | 106 +++++++++++++++++++++++++++++++++++++ html/baremetal/400.mu.html | 58 ++++++++++++++++++++ html/baremetal/boot.hex.html | 2 +- html/baremetal/mu-init.subx.html | 75 ++++++++++++++++++++++++++ 4 files changed, 240 insertions(+), 1 deletion(-) create mode 100644 html/baremetal/101screen.subx.html create mode 100644 html/baremetal/400.mu.html create mode 100644 html/baremetal/mu-init.subx.html diff --git a/html/baremetal/101screen.subx.html b/html/baremetal/101screen.subx.html new file mode 100644 index 00000000..17222bc1 --- /dev/null +++ b/html/baremetal/101screen.subx.html @@ -0,0 +1,106 @@ + + + + +Mu - baremetal/101screen.subx + + + + + + + + + + +https://github.com/akkartik/mu/blob/master/baremetal/101screen.subx +
+ 1 # Primitives for screen control.
+ 2 
+ 3 pixel:  # screen: (addr screen), x: int, y: int, color: int
+ 4     # . prologue
+ 5     55/push-ebp
+ 6     89/<- %ebp 4/r32/esp
+ 7     # . save registers
+ 8     50/push-eax
+ 9     51/push-ecx
+10     # ecx = screen
+11     8b/-> *(ebp+8) 1/r32/ecx
+12     81 7/subop/compare %ecx 0/imm32
+13     {
+14       75/jump-if-!= break/disp8
+15       # bounds checks
+16       8b/-> *(ebp+0xc) 0/r32/eax
+17       3d/compare-eax-and 0/imm32
+18       7c/jump-if-< $pixel:end/disp8
+19       3d/compare-eax-and 0x400/imm32/1024
+20       7d/jump-if->= $pixel:end/disp8
+21       8b/-> *(ebp+0x10) 0/r32/eax
+22       3d/compare-eax-and 0/imm32
+23       7c/jump-if-< $pixel:end/disp8
+24       3d/compare-eax-and 0x300/imm32/768
+25       7d/jump-if->= $pixel:end/disp8
+26       # eax = y*1024 + x
+27       8b/-> *(ebp+0x10) 0/r32/eax
+28       c1/shift 4/subop/left %eax 0xa/imm8
+29       03/add-> *(ebp+0xc) 0/r32/eax
+30       # eax += location of frame buffer
+31       03/add-> *0x7f28 0/r32/eax
+32       # *eax = color
+33       8b/-> *(ebp+0x14) 1/r32/ecx
+34       88/byte<- *eax 1/r32/CL
+35       # return
+36       eb $pixel:end/disp8
+37     }
+38     # TODO: fake screen
+39 $pixel:end:
+40     # . restore registers
+41     59/pop-to-ecx
+42     58/pop-to-eax
+43     # . epilogue
+44     89/<- %esp 5/r32/ebp
+45     5d/pop-to-ebp
+46     c3/return
+
+ + + diff --git a/html/baremetal/400.mu.html b/html/baremetal/400.mu.html new file mode 100644 index 00000000..a1149945 --- /dev/null +++ b/html/baremetal/400.mu.html @@ -0,0 +1,58 @@ + + + + +Mu - baremetal/400.mu + + + + + + + + + + +https://github.com/akkartik/mu/blob/master/baremetal/400.mu +
+1 sig pixel screen: (addr screen), x: int, y: int, color: int
+
+ + + diff --git a/html/baremetal/boot.hex.html b/html/baremetal/boot.hex.html index f21c8efc..915bca0b 100644 --- a/html/baremetal/boot.hex.html +++ b/html/baremetal/boot.hex.html @@ -71,7 +71,7 @@ if ('onhashchange' in window) { 17 # To run: 18 # qemu-system-i386 disk.img 19 # Or: - 20 # bochs -f apps/boot.bochsrc # boot.bochsrc loads disk.img + 20 # bochs -f baremetal/boot.bochsrc # boot.bochsrc loads disk.img 21 # 22 # Since we start out in 16-bit mode, we need instructions SubX doesn't 23 # support. diff --git a/html/baremetal/mu-init.subx.html b/html/baremetal/mu-init.subx.html new file mode 100644 index 00000000..1c17c54f --- /dev/null +++ b/html/baremetal/mu-init.subx.html @@ -0,0 +1,75 @@ + + + + +Mu - baremetal/mu-init.subx + + + + + + + + + + +https://github.com/akkartik/mu/blob/master/baremetal/mu-init.subx +
+ 1 # Initialize the minimal runtime for Mu programs.
+ 2 #
+ 3 # See translate_mu_baremetal for how this file is used.
+ 4 #
+ 5 # Mu baremetal programs start at a function called 'main' without inouts or outputs.
+ 6 
+ 7 == code
+ 8 
+ 9 # initialize stack
+10 bd/copy-to-ebp 0/imm32
+11 # no heap yet
+12 (main)
+13 
+14 # hang indefinitely
+15 {
+16   eb/jump loop/disp8
+17 }
+
+ + + -- cgit 1.4.1-2-gfad0