about summary refs log tree commit diff stats
path: root/console.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-08-14 16:58:59 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-08-14 16:58:59 -0700
commitc6520d9694d3cee265833b9e857f5f693645caba (patch)
tree46b832bf1921d6f4687aab7a1ded3488c8ff8c5b /console.mu
parentcc835be2510ecea40a2382014d2e943cddb4ec29 (diff)
downloadmu-c6520d9694d3cee265833b9e857f5f693645caba.tar.gz
1994 - new primitive: 'create-array'
Not strictly necessary, but it might help me stage the introduction of
arrays and 'new'.
Diffstat (limited to 'console.mu')
0 files changed, 0 insertions, 0 deletions
/pre>
bb0e67a3 ^


7bf8adb8 ^
44131682 ^
6e36ce06 ^
0d12f667 ^

83c25a03 ^



44131682 ^

83c25a03 ^

422ebaf8 ^

83c25a03 ^

422ebaf8 ^
83c25a03 ^

bb0e67a3 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
                                   

                        
                                                   
         
                             
     
                                                           


                                                          
                                                                                  
                                      
                                                    

                             



                                                                                                                                 

                                                

                                                                                             

                              

                                                                                                        
 

                                                                                                        
 
# Drawing ASCII text incrementally.
#
# To build a disk image:
#   ./translate ex6.mu             # emits code.img
# To run:
#   qemu-system-i386 code.img
# Or:
#   bochs -f bochsrc               # bochsrc loads code.img
#
# Expected output: a box and text that doesn't overflow it

fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) {
  # drawing text within a bounding box
  draw-box-on-real-screen 0xf, 0x1f, 0x79, 0x51, 0x4
  var x/eax: int <- copy 0x20
  var y/ecx: int <- copy 0x20
  x, y <- draw-text-wrapping-right-then-down screen, "hello ",     0x10/xmin, 0x20/ymin, 0x78/xmax, 0x50/ymax, x, y, 0xa/fg, 0/bg
  x, y <- draw-text-wrapping-right-then-down screen, "from ",      0x10/xmin, 0x20/ymin, 0x78/xmax, 0x50/ymax, x, y, 0xa/fg, 0/bg
  x, y <- draw-text-wrapping-right-then-down screen, "baremetal ", 0x10/xmin, 0x20/ymin, 0x78/xmax, 0x50/ymax, x, y, 0xa/fg, 0/bg
  x, y <- draw-text-wrapping-right-then-down screen, "Mu!",        0x10/xmin, 0x20/ymin, 0x78/xmax, 0x50/ymax, x, y, 0xa/fg, 0/bg

  # drawing at the cursor in multiple directions
  draw-text-wrapping-down-then-right-from-cursor-over-full-screen screen, "abc", 0xa/fg, 0/bg
  draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, "def", 0xa/fg, 0/bg

  # test drawing near the edge
  x <- draw-text-rightward screen, "R", 0x7f/x, 0x80/xmax=screen-width, 0x18/y, 0xa/fg, 0/bg
  draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, "wrapped from R", 0xa/fg, 0/bg

  x <- draw-text-downward screen, "D", 0x20/x, 0x2f/y, 0x30/ymax=screen-height, 0xa/fg, 0/bg
  draw-text-wrapping-down-then-right-from-cursor-over-full-screen screen, "wrapped from D", 0xa/fg, 0/bg
}