[openfirmware] r1681 - in cpu/x86/pc/olpc: . via

svn at openfirmware.info svn at openfirmware.info
Fri Jan 22 00:02:57 CET 2010


Author: wmb
Date: 2010-01-22 00:02:56 +0100 (Fri, 22 Jan 2010)
New Revision: 1681

Added:
   cpu/x86/pc/olpc/plot.fth
   cpu/x86/pc/olpc/strokes.fth
   cpu/x86/pc/olpc/via/drawboardtop.fth
Modified:
   cpu/x86/pc/olpc/via/drawboard.fth
Log:
Refactored and improved line-drawing tools, adding Bezier curves and other bells and whistles.


Added: cpu/x86/pc/olpc/plot.fth
===================================================================
--- cpu/x86/pc/olpc/plot.fth	                        (rev 0)
+++ cpu/x86/pc/olpc/plot.fth	2010-01-21 23:02:56 UTC (rev 1681)
@@ -0,0 +1,73 @@
+: plot0  ( -- x y )  0  screen-height 10 -  ;
+: clear-plot  ( width height -- )
+   2>r
+   bg  plot0  2r>    ( bg plot0-xy wh )
+   rot over - -rot   ( bg plot0-xy' wh )
+   fill-rectangle
+;
+
+variable ylim  variable ymin
+1 value stretch
+: clip-y  ( value -- value' )  ymin @ -  0 max  ylim @ min  ;
+: plot  ( xt xmin xmax xscale ymin ymax -- )
+   over - ylim !  ymin !  to stretch  ( xt xmin xmax )
+   over 3 pick execute clip-y  ( xt xmin xmax y-at-xmin )
+   plot0 2 pick -  moveto      ( xt xmin xmax y-at-xmin )
+   -rot  swap 1+  ?do          ( xt last )
+      i 2 pick execute clip-y  ( xt last value )
+      tuck -                   ( xt value delta )
+      stretch swap rline       ( xt value )
+   loop                        ( xt last )
+   2drop                       ( )
+;
+
+9 constant wave-scale
+1  d# 15 wave-scale - << 2+  constant wave-height
+
+: pitch*  ( #lines -- #pixels )  bytes/line *  ;
+: wave-top  ( -- adr )
+   screen-height wave-height 2* -  pitch*  frame-buffer-adr +
+;
+
+: wave0  ( -- )  screen-height wave-height -  ;
+
+: clear-waveform  ( -- )
+   bg
+   0  wave0 wave-height -  screen-width wave-height 2*
+   fill-rectangle
+;
+: waveform-start  ( -- )  0  wave0  moveto  ;
+: draw-wave  ( adr )
+   0 swap   ( last adr )
+   screen-width  0  do  ( last adr )
+      tuck <w@          ( adr last this-unscaled )
+      wave-scale >>a    ( adr last this )
+      tuck swap -       ( adr this distance )
+      1 swap rline      ( adr this )
+      swap wa1+         ( this adr )
+   loop                 ( last adr )
+   2drop
+;
+: waveform  ( adr -- )  clear-waveform  waveform-start  draw-wave  ;
+: vgrid  ( width height interval -- )
+   rot  0  ?do               ( height interval )
+      i plot0 nip  moveto    ( height interval )
+      0 2 pick negate rline  ( height interval )
+   dup +loop                 ( height interval )
+   2drop                     ( )
+;
+: hgrid  ( width height interval -- )
+   swap  0  ?do              ( width interval )
+      plot0 i -  moveto      ( width interval )
+      over 0  rline          ( width interval )
+   dup +loop                 ( width interval )
+   2drop                     ( )
+;
+dend
+
+\ : $call-screen  ( ? name$ -- ? )  stdout @ $call-method  ;
+: wave  ( adr -- )  " waveform" $call-screen  ;
+: clear-plot  ( width height -- )  " clear-plot"  $call-screen  ;
+: lineplot  ( xt xmin xmax xscale  ymin ymax  -- )  " plot" $call-screen  ;
+: vgrid  ( width height interval -- )  " vgrid" $call-screen  ;
+: hgrid  ( width height interval -- )  " hgrid" $call-screen  ;

Added: cpu/x86/pc/olpc/strokes.fth
===================================================================
--- cpu/x86/pc/olpc/strokes.fth	                        (rev 0)
+++ cpu/x86/pc/olpc/strokes.fth	2010-01-21 23:02:56 UTC (rev 1681)
@@ -0,0 +1,234 @@
+dev screen
+
+5 value fg
+h# f value bg
+
+: halve  ( n -- n/2 )  dup 1 and  swap u2/ +  ;
+
+defer (point)           ( x y -- )
+defer subpixel-(point)  ( xf yf -- )
+
+0 0 2value dot-offset
+: offsetat  ( x y -- )  to dot-offset  ;
+
+: draw-dot  ( x y -- )
+   dot-offset d+
+   bytes/line *  swap pixel+  frame-buffer-adr +  fg swap pixel!
+;
+: subpixel-draw-dot  ( xf yf -- )
+   swap halve swap halve
+   draw-dot
+;
+: single-drawing  ( -- )
+   ['] draw-dot to (point)
+   ['] subpixel-draw-dot to subpixel-(point)
+;
+single-drawing
+
+: subpixel-double-dot  ( x y -- )
+   over 1+  over     draw-dot
+   over 1+  over 1+  draw-dot
+   over     over 1+  draw-dot
+   draw-dot
+;
+: double-dot  ( x y -- )
+   swap 2* swap 2*     ( x' y' )
+   subpixel-double-dot
+;
+: double-drawing  ( -- )
+   ['] double-dot to (point)
+   ['] subpixel-double-dot to subpixel-(point)
+;
+
+variable curx  variable cury
+: moveto   ( x y -- )  cury !  curx !  ;
+: rmove    ( dx dy -- )  cury +!  curx +!  ;
+: rpoint  ( -- )  curx @ cury @ (point)  ;
+: pointat  ( x y -- )  moveto  rpoint  ;
+
+2variable bump  2variable nobump
+: bresenham  ( incr reload -- )
+   tuck dup 2/   ( reload incr reload delta )
+   swap  0  do               ( reload incr delta )
+      rpoint                ( reload incr delta )
+      over -  dup 0<  if     ( reload incr delta' )
+         2 pick +            ( reload incr delta' )
+         bump                ( reload incr delta var )
+      else                   ( reload incr delta )
+         nobump              ( reload incr delta var )
+      then                   ( reload incr delta )
+      2@  cury +!  curx +!   ( reload incr delta )
+   loop                      ( reload incr delta )
+   3drop   rpoint           ( )
+;
+
+: rline  ( dx dy -- )
+   dup 0<  if              ( dx dy- )
+      negate               ( dx |dy| )
+      over 0<  if          ( dx- |dy| )
+         swap negate swap  ( |dx| |dy| )
+         2dup <  if  0 -1  else  swap  -1 0  then  -1
+      else                 ( dx+ |dy| )
+         2dup <  if  0 -1  else  swap  1 0   then   1
+      then                 ( incr reload  nobump-xy  bump-x )
+      -1                   ( incr reload  nobump-xy  bump-xy )
+   else                    ( dx dy+ )
+      over 0<  if          ( dx- dy+ )
+         swap negate swap  ( |dx| dy )
+         2dup <  if  0 1  else  swap  -1 0  then   -1
+      else                 ( dx+ dy+ )
+         2dup <  if  0 1  else  swap   1 0  then    1
+      then                 ( incr reload  nobump-xy  bump-x )
+      1                    ( incr reload  nobump-xy  bump-xy )
+   then                    ( incr reload  nobump-xy  bump-xy )
+   bump 2!  nobump 2!      ( incr reload )
+   bresenham               ( )
+;
+
+0 [if]
+\ Divide-and-conquer line drawing.  Bresenham above is about twice
+\ as fast, but this is less code.
+: xy+  ( x1 y1 x2 y2 -- x3 y3 )  rot +  >r  +  r>  ;
+: (rxline)  ( x y dx dy -- )
+   2dup or  if                 ( x y dx dy )
+      swap 2/ swap 2/          ( x y dx/2 dy/2 )
+      2over 2over recurse      ( x y dx/2 dy/2 )
+      2swap 2over xy+ 2dup (point)  2swap  recurse  ( )
+   else                        ( x y dx dy )
+      4drop                    ( )
+   then                        ( )
+;
+: rxline  ( dx dy -- )  curx @  cury @  2swap  (rxline)  ;
+[then]
+
+: lineto  ( x y -- )  swap curx @ -  swap cury @ -  rline  ;
+
+: rbox  ( w h -- )
+   0 over rline         ( w h )  \ Up
+   over 0 rline         ( w h )  \ Right
+   0 swap negate rline  ( w )    \ Down
+   negate 0  rline      ( )      \ Left
+;
+: boxat  ( x y w h -- )  2swap moveto  rbox  ;
+
+1 [if]
+\ Test for line drawing
+d# 240 value gey0  d# 240 value gex0
+: godseye  ( -- )
+   gex0  0  do
+      i            gey0         moveto
+      gex0         gey0 i -     lineto
+      gex0 2* i -  gey0         lineto
+      gex0         gey0 i +     lineto
+      i            gey0         lineto
+   3 +loop
+;
+: godseye1  ( -- )
+   gex0  0  do
+      i  gey0       moveto
+      gex0 i -      i           ( x0-i i )
+      negate  2dup  rline       ( x0-i -i )
+      negate  2dup  rline       ( x0-i i )
+      swap negate swap          ( i-x0 i )
+              2dup  rline       ( x0-i -i )
+      negate        rline       ( )
+   3 +loop
+;
+[then]
+3 value subpixel-shift
+: >point  ( x y -- )  swap subpixel-shift lshift  swap subpixel-shift lshift  wljoin  ;
+
+: bezier-point  ( p -- )
+   lwsplit
+   swap subpixel-shift 1- rshift  swap subpixel-shift 1- rshift    ( x y )
+   subpixel-(point)                           ( )
+;
+
+: mid  ( p0 p1 -- mid )
+   +  lwsplit halve  swap halve swap wljoin
+;   
+: close-coord?  ( n0 n1 -- flag )  - abs 1 subpixel-shift lshift  <=  ;
+: close-point?   ( p0 p1 -- flag )
+   lwsplit  rot lwsplit   ( x1 y1 x0 y0 )
+   rot close-coord? -rot  close-coord? and
+;
+
+\ Bezier curve rendering by the midpoint method - see, for example,
+\ http://web.cs.wpi.edu/~matt/courses/cs563/talks/surface/bez_surf.html
+: bezier-steps  ( p0 p1 p2 p3 -- )
+   dup 4 pick close-point?  if  4drop exit  then
+   2over mid  >r      ( p0 p1 p2 p3                  r: p01 )
+   -rot tuck          ( p0 p3 p2 p1 p2               r: p01 )
+   mid >r             ( p0 p3 p2                     r: p01 p12 )
+   over mid           ( p0 p3  p23                   r: p01 p12 )
+   dup r@ mid         ( p0 p3  p23 p123              r: p01 p12 )
+   r> r@ mid          ( p0 p3  p23 p123 p012         r: p01 )
+   2dup mid           ( p0 p3  p23 p123 p012 p0123   r: p01 )
+   dup bezier-point   ( p0 p3  p23 p123 p012 p0123   r: p01 )
+
+   \ For convenience of stack manipulation, we calculate the right half "backwards"
+   \ This gives equivalent results due to the symmetry of the calculation 
+   tuck 2>r           ( p0  p3 p23 p123 p0123        r: p01 p012 p0123 )
+   recurse            ( p0                           r: p01 p012 p0123 )
+
+   2r> r> -rot        ( p0 p01 p012 p0123 )
+   recurse            ( )
+;
+: bezier  ( p0 p1 p2 p3 -- )
+   dup bezier-point  4 pick bezier-point  bezier-steps
+;
+
+: curveto  ( x1 y1 x2 y2 x3 y3 -- )
+   2>r                                     ( x1 y1 x2 y2 x3 y3  r: x3 y3 )
+   2r@  >point >r  >point >r  >point >r    ( r: x3 y3 p3 p2 p1 )
+   curx @ cury @ >point  r> r> r>          ( p0 p1 p2 p3 r: x3 y3 )
+   bezier                                  ( r: x3 y3 )
+   2r> cury !  curx !
+;
+: +curxy  ( dx dy -- x y )  swap curx @ +  swap cury @ +  ;
+: rcurve  ( dx1 dy1 dx2 dy2 dx3 dy3 -- )
+   2dup 2>r                         ( dx,y1 dx,y2 dx,y3  r: dx,y3 )
+   +curxy >point >r                 ( dx,y1 dx,y2        r: dx,y3 p3 )
+   +curxy >point >r                 ( dx,y1              r: dx,y3 p3 p2 )
+   +curxy >point >r                 ( p0                 r: dx,y3 p3 p2 p1 )
+   curx @ cury @ >point  r> r> r>   ( p0 p1 p2 p3        r: dx,y3 )
+   bezier                           (                    r: dx,y3 )
+   2r> cury +!  curx +!             ( )
+;
+
+0 value kappa  \ Control point offset for Bezier curve circle approximation
+\ See http://www.whizkidtech.redprince.net/bezier/circle/
+: rcircle  ( radius -- )  \ current point is the center
+   >r  curx @ r@ -  cury @  moveto        ( r: radius )
+   r@ d# 36195 * d# 16 rshift  to kappa   ( r: radius )
+   0 kappa          r@ kappa -  r@         r@ r@         rcurve   ( r: radius )
+   kappa 0          r@  kappa r@ -         r@ r@ negate  rcurve   ( r: radius )
+   0 kappa negate   kappa r@ -  r@ negate  r@ negate r@ negate  rcurve  ( r: r)
+   kappa negate 0   r@ negate  r@ kappa -  r@ negate r@  rcurve   ( r: radius )
+   curx @ r> +  cury @  moveto
+;
+: circleat  ( x y radius -- )  >r  moveto  r> rcircle  ;
+
+: set-fg  ( fg -- )  to fg  ;
+: set-bg  ( bg -- )  to bg  ;
+
+dend
+
+: set-fg  ( fg -- )  " set-fg" $call-screen  ;
+: set-bg  ( bg -- )  " set-bg" $call-screen  ;
+: rpoint  ( -- )  " rpoint" $call-screen  ;
+: pointat  ( x y -- )  " pointat" $call-screen  ;
+: moveto  ( x y -- )  " moveto" $call-screen  ;
+: lineto  ( x y -- )  " lineto" $call-screen  ;
+: curveto  ( x,y1 x,y2, x,y3 -- )  " curveto" $call-screen  ;
+: rmove    ( dx dy -- )  " rmove" $call-screen  ;
+: rline    ( dx dy -- )  " rline" $call-screen  ;
+: rcurve   ( dxy1 dxy2 dxy3 -- )  " rcurve" $call-screen  ;
+: rcircle  ( r -- )  " rcircle" $call-screen  ;
+: circleat  ( x y r -- )  " circleat" $call-screen  ;
+: rbox  ( w h -- )  " rbox" $call-screen  ;
+: boxat  ( x y w h -- )  " boxat" $call-screen  ;
+: offsetat  ( x y -- )  " offsetat" $call-screen  ;
+: clear-drawing  ( -- )  " erase-screen" $call-screen  ;
+: double-drawing  ( -- )  " double-drawing" $call-screen  ;
+: single-drawing  ( -- )  " single-drawing" $call-screen  ;

Modified: cpu/x86/pc/olpc/via/drawboard.fth
===================================================================
--- cpu/x86/pc/olpc/via/drawboard.fth	2010-01-21 22:59:33 UTC (rev 1680)
+++ cpu/x86/pc/olpc/via/drawboard.fth	2010-01-21 23:02:56 UTC (rev 1681)
@@ -1,15 +1,54 @@
-erase-screen
 decimal
+: headphones-logo
+   24 5 rmove  -6 0  -10 6  -10 13 rcurve
+   10 -13 rmove  6 0  10 6  10 13 rcurve
+   -16 4 rmove  -2 0  -3 -1  -3 -2 rcurve  0 -3  1 -3  3 -3 rcurve  0 5 rline   
+   12 -5 rmove  2 0  3 0  3 2  rcurve  0 3  -1 3  -3 3 rcurve  0 -5 rline
+;
+
+: led-symbol  ( x y -- )
+   moveto  5 5 rline  5 -5 rline  -5 -5 rline  -5 5 rline
+;
+: usb-logo
+   14 11  rmove
+   1 1  1 3  0 4  rcurve
+   -1 1  -2 1  -3 0  rcurve
+   -1 -1  -1 -3  0 -4  rcurve
+   1 -1  2 -1  3 0  rcurve
+
+   10 -4  rmove
+   1 -1  1 -2  0 -2  rcurve
+   0 -1  -1 -1  -1 0  rcurve
+   0 0  0 1  0 2  rcurve
+   0 0  1 0  1 0  rcurve
+
+   -12 6  rmove  18 0  rline  
+   5 0  rmove   -5 -2  rline  0 4  rline  5 -2  rline  
+   -7 6  rmove   2 0  rline  0 3  rline  -2 0  rline  0 -3  rline  
+   -11 -6  rmove
+   1 -2  2 -5  3 -6  rcurve
+   1 -2  2 -1  3 -1  rcurve
+
+   -2 7  rmove
+   2 2  2 5  4 7  rcurve
+   1 1  3 0  5 0  rcurve
+;
+: mic-logo
+   -4 0  -6 -3  -6 -5  rcurve
+   6 5  rmove   3 0  6 -3  6 -5  rcurve
+   -4 -8  rmove
+   0  8  rline  0  1  -1  2  -2  2  rcurve  -1 0  -2 -1  -2 -2  rcurve
+   0 -8  rline  0 -1   1 -2   2 -2  rcurve   1 0   2  1   2  2  rcurve
+   -2 13  rmove  0 3  rline   3 0  rmove  -7 0  rline  
+;
+
+: rantenna  ( -- )
+   -5 -5 rmove  10 10 rbox  5 5 rmove  rpoint  5 rcircle
+;
 : wlan-card
    362 6  75 74 boxat
-   \ Antenna 0
-   367 10  9 9 boxat
-   374 11 moveto 376 13 376 16 374 17 curveto 372 19 370 19 368 17 curveto 366 16 366 13 368 11 curveto 370 9 372 9 374 11 curveto
-   371 15 moveto 371 15 371 15 371 15 curveto 371 15 371 15 371 15 curveto 371 15 371 15 371 15 curveto 371 14 371 14 371 15 curveto
-   \ Antenna 1
-   423 10  9 9 boxat
-   431 11 moveto 432 13 432 16 431 17 curveto 429 19 426 19 424 17 curveto 422 16 422 13 424 11 curveto 426 9 429 9 431 11 curveto 
-   427 15 moveto 427 15 427 15 427 15 curveto 427 15 427 15 427 15 curveto 427 15 427 15 427 15 curveto 427 14 427 14 427 15 curveto 
+   10  9 rmove  rantenna
+   55  0 rmove  rantenna
 ;
 
 : board-outline 
@@ -22,22 +61,13 @@
 
 : mic-conn
   535 52  45 28 boxat
-  574 58  14 16 boxat
-  \ Logo
-  559 72 moveto 555 72 553 70 553 67 curveto
-  559 72 moveto 562 72 565 70 565 67 curveto 
-  561 59 moveto 561 67 lineto 561 68 560 69 559 69 curveto 558 69 557 68 557 67 curveto 557 59 lineto 557 58 558 58 559 58 curveto 560 58 561 58 561 59 curveto 
-  559 72 moveto 559 75 lineto 
-  562 75 moveto 555 75 lineto 
+  24 20 rmove  mic-logo
+  580 58   8 16 boxat
 ;
 : headphone-conn
   535 90  45 28 boxat
-  574 96  14 16 boxat
-  \ Logo
-  559 95 moveto 564 95 569 101 569 107 curveto 
-  559 95 moveto 553 95 549 101 549 107 curveto 
-  554 112 moveto 552 112 550 111 550 110 curveto 550 108 552 107 553 107 curveto 554 112 lineto 
-  564 107 moveto 566 107 568 109 568 110 curveto 567 111 566 112 564 112 curveto 564 107 lineto 
+  headphones-logo
+  580 96   8 16 boxat
 ;
 : ac-conn  553 306  36 27 boxat  ;
 : ext-sd-slot  13 270  81 90 boxat ;
@@ -47,57 +77,27 @@
    20 283 moveto 20 369 lineto 87 369 lineto 87 294 lineto 76 283 lineto 20 283 lineto 
 ;
 
-
 : usb0-conn
    537 126  45 27 boxat
-   \ Logo
-   551 137 moveto 552 138 552 140 551 141 curveto 550 142 549 142 548 141 curveto 547 140 547 138 548 137 curveto 549 136 550 136 551 137 curveto
-   561 133 moveto 562 132 562 131 561 131 curveto 561 130 560 130 560 131 curveto 560 131 560 132 560 133 curveto 560 133 561 133 561 133 curveto
-   549 139 moveto 567 139 lineto
-   572 139 moveto 567 137 lineto 567 141 lineto 572 139 lineto
-   565 145 moveto 567 145 lineto 567 148 lineto 565 148 lineto 565 145 lineto
-   554 139 moveto 555 137 556 134 557 133 curveto 558 131 559 132 560 132 curveto 
-   558 139 moveto 560 141 560 144 562 146 curveto 563 147 565 146 567 146 curveto 
+   usb-logo
 ;
 : usb1-conn
    0 54  45 27 boxat
-   \ Logo
-   13 65 moveto 14 66 14 68 13 69 curveto 12 70 10 70 10 69 curveto 9 68 9 66 10 65 curveto 10 64 12 64 13 65 curveto 
-   23 61 moveto 23 60 23 59 23 59 curveto 23 58 22 58 22 59 curveto 21 59 21 60 22 61 curveto 22 61 23 61 23 61 curveto 
-   11 67 moveto 29 67 lineto 
-   33 67 moveto 29 65 lineto 29 69 lineto 33 67 lineto 
-   27 73 moveto 29 73 lineto 29 76 lineto 27 76 lineto 27 73 lineto 
-   16 67 moveto 17 65 17 62 18 61 curveto 19 59 21 60 22 60 curveto 
-   20 67 moveto 21 69 22 72 23 74 curveto 25 75 27 74 29 74 curveto 
+   usb-logo   
 ;
 : usb2-conn
    0 99  45 45 boxat
-   \ Logo
-   13 119 moveto 14 120 14 122 13 123 curveto 12 124 10 124 10 123 curveto 9 122 9 120 10 119 curveto 10 118 12 118 13 119 curveto 
-   23 115 moveto 23 114 23 113 23 113 curveto 23 112 22 112 22 113 curveto 21 113 21 114 22 115 curveto 22 115 23 115 23 115 curveto 
-   11 121 moveto 29 121 lineto 
-   33 121 moveto 29 119 lineto 29 123 lineto 33 121 lineto 
-   27 127 moveto 29 127 lineto 29 130 lineto 27 130 lineto 27 127 lineto 
-   16 121 moveto 17 119 17 116 18 115 curveto 19 113 21 114 22 114 curveto 
-   20 121 moveto 21 123 22 126 23 128 curveto 25 129 27 128 29 128 curveto 
+   0 9 rmove  usb-logo
 ;
 : battery-conn
    444 306  27 27 boxat
    427 279  18 18 boxat
 ;   
 
-: led0
-   110 344 moveto 115 349 lineto 110 354 lineto 105 349 lineto 110 344 lineto
-;
-: led1
-   136 344 moveto 141 349 lineto 136 354 lineto 131 349 lineto 136 344 lineto
-;
-: led2
-   451 344 moveto 456 349 lineto 451 354 lineto 446 349 lineto 451 344 lineto
-;
-: led3
-   478 344 moveto 483 349 lineto 478 354 lineto 473 349 lineto 478 344 lineto
-;
+: led0  105 349 led-symbol  ;
+: led1  131 349 led-symbol  ;
+: led2  446 349 led-symbol  ;
+: led3  473 349 led-symbol  ;
 : cmos-battery-conn
    304  85  12 18 boxat
    306  81   8  4 boxat
@@ -105,11 +105,8 @@
 ;
 
 : cmos-battery
-   278 45 moveto
-     287  53   287  66   278 74 curveto
-     270  83   255  83   247 74 curveto
-     238  66   238  53   247 45 curveto
-     255  36   270  36   278 45 curveto
+   262 60  22 circleat
+   \ Wires
    243 71 moveto
      238  75   228  81   229  86 curveto
      229  90   242  99   249 100 curveto
@@ -153,9 +150,9 @@
 ;
 
 : draw-board  ( -- )
-   erase-screen
-   d# 10 d# 20 to dot-offset
-   double-size
+   clear-drawing
+   d# 10 d# 20 offsetat
+   double-drawing
 
    board-outline
    mic-conn

Added: cpu/x86/pc/olpc/via/drawboardtop.fth
===================================================================
--- cpu/x86/pc/olpc/via/drawboardtop.fth	                        (rev 0)
+++ cpu/x86/pc/olpc/via/drawboardtop.fth	2010-01-21 23:02:56 UTC (rev 1681)
@@ -0,0 +1,107 @@
+: button-symbol  ( x y -- )
+   2dup  18 18 boxat
+   swap 9 +  swap 9 +  6 circleat
+;
+: top-outline
+   153 360 moveto
+   153 324 lineto  441 324 lineto  441 360 lineto  585 360 lineto
+   585  36 lineto  531  36 lineto  531   0 lineto  234   0 lineto
+   234  99 lineto  144  99 lineto  144   0 lineto   63   0 lineto
+    63  36 lineto    9  36 lineto    9 360 lineto  153 360 lineto 
+;
+: hph
+   2 95   7 18  boxat
+   9 91  45 28  boxat
+   headphones-logo
+;
+: mic
+   9 54  45 28  boxat
+   24 20 rmove  mic-logo
+   2 59   7 18  boxat
+;
+: acin  0 307  36 27  boxat  ;
+: int-mic-conn
+   70 146  18 18  boxat
+   28 15 rmove  mic-logo
+;
+: usb0
+   7 128  45 27  boxat
+   usb-logo
+;
+: usb1
+   543 55  45 27  boxat
+   usb-logo
+;
+: usb2
+   543 100  45 45  boxat
+   0 9 rmove  usb-logo
+;
+: display-conn  252 1  89 18  boxat  ;
+: camera-conn  540 154  36 18  boxat  ;
+: backlight-conn  63 46  27 17  boxat  ;
+: above-int-mic-conn
+   79 87  18 27  boxat
+   81 82  9 5  boxat
+   81 114  9 5  boxat
+;
+: pwr-but  543 338  button-symbol  ;
+: rotate-but  30 338  button-symbol  ;
+: up-but  37 237  button-symbol  ;
+: down-but  37 278  button-symbol  ;
+: left-but  14 258  button-symbol  ;
+: right-but  57 258  button-symbol  ;
+: o-but  543 239  button-symbol  ;
+: x-but
+   543 279  18 18  boxat
+   548 283 moveto 557 292 lineto 548 292 moveto 557 283 lineto 
+;
+: square-but
+   521 260  18 18  boxat
+   525 264 moveto 534 264 lineto 534 273 lineto 525 273 lineto 525 264 lineto 
+;
+: check-but
+   564 259  18 18  boxat
+   570 269 moveto 573 273 lineto 578 263 lineto 
+;
+: led0  518 348  led-symbol  ;
+: led1  491 348  led-symbol  ;
+: led2  72 348  led-symbol  ;
+: led3  99 348  led-symbol  ;
+: mic-led  31 45   led-symbol  ;
+: camera-led  569 45  led-symbol  ;
+: wlan-conn  144 82  90 27  boxat  ;
+: wlan-card  152 7  75 75  boxat  ;
+: ext-sd-slot  497 360  81 9  boxat  ;
+
+: draw-top  ( -- )
+   clear-drawing
+   top-outline
+   hph
+   mic
+   acin
+   int-mic-conn
+   usb0 usb1 usb2
+   display-conn
+   camera-conn
+   backlight-conn
+   above-int-mic-conn
+   pwr-but
+   rotate-but
+   up-but
+   down-but
+   left-but
+   right-but
+   o-but
+   x-but
+   square-but
+   check-but
+   led0
+   led1
+   led2
+   led3
+   mic-led
+   camera-led
+   wlan-conn
+   wlan-card
+   ext-sd-slot
+;




More information about the openfirmware mailing list