no { curlies }

but I used them today in Jal!

Spot the Braces!
In my terminal.jal  file/library

- Terminal stuff
-- ------------------------------------------------------------
-- Clear screen
-- (and set the cursor to the upper left corner: column 0, row 0)
-- ------------------------------------------------------------
procedure  ScreenClear() is
   if CharInk then
      LCD_Cmd = PANEL_CLEAR           -- Clear the display
   else
       LCD_Cmd = PANEL_FILL
   end if
   screenCharX = 0;
   screenCharY = 0;
   CharStyleBold = false
   _charStyleDouble = false
   CharInk = true
   _charLineSpacing = 8
   _charSpacing = 6
end procedure

procedure ScreenCharClearEOL() is
var byte col, fill
     if CharInk then fill = 0 else fill = 255 end if
     col = screenCharX
     while screenCharX < 128 loop
         BlitColumn (screenCharX, screenCharY,fill)
         screenCharX = screenCharX +1
     end loop
     screenCharX = col
     if CharStyleDouble then
         col = screenCharX
         screenCharY = screenCharY+ 8
         while screenCharX < 128 loop
             BlitColumn (screenCharX, screenCharY,fill)
             screenCharX = screenCharX +1
         end loop
         screenCharY = screenCharY - 8
         screenCharX = col
     end if
end procedure

-- ------------------------------------------------------------
-- Set cursor position
-- Specify column and row in base-0 notation (first line is 0).
-- ------------------------------------------------------------
procedure  ScreenCharXY(byte in col, byte in row)  is
   screenCharX = col * _charSpacing -- up to 21 cols
   if screenCharX > 127 then
      screenCharX = 0
      screenCharY = screenCharY + _charLineSpacing
   end if
   screenCharY = row * _charLineSpacing -- up to 8 rows
   if screenCharY > 63 Then
      screenCharY =  0
   end if
end procedure

procedure ScreenHome()  is
   screenCharY = 0
   screenCharX = 0
end procedure

procedure ScreenChar'put(byte in char) is
    if char < 32 then
        PlotDigit(screenCharX, screenCharY, char)
    else
        PlotChar(screenCharX, screenCharY, char)
    end if
    screenCharX = screenCharX + _charSpacing
    if screenCharX > 127 then
       screenCharX = 0
       screenCharY = screenCharY + _charLineSpacing
       if  screenCharY > 63 then
           screenCharY = 0
       end if
    end if
end procedure



const byte _DIGITS_3X5_MAP[] = {
      1+2+4+8+16, 1+16, 1+2+4+8+16,       ; 0
      0, 1+2+4+8+16, 0,                   ; 1
      1+4+8+16, 1+4+16, 2+ 16,            ; 2
      1+4+16, 1+4+16, 1+2+4+8+16,         ; 3
      1+2+4, 4, 1+2+4+8+16,               ; 4
      1+2+4+16, 1+4+16, 1+8,              ; 5
      2+4+8+16, 1+4+16, 4+8+16,           ; 6
      1, 1, 1+2+4+8+16,                   ; 7
      1+2+4+8+16, 1+4+16, 1+2+4+8+16,     ; 8
      1+2+4, 1+4, 1+2+4+8+16,             ; 9
      1+2+4+8+16, 1+4, 1+2+4+8+16,        ; A
      1+2+4+8+16, 1+4+16, 2+8+16,         ; B
      1+2+4+8+16, 1+16, 1+16,             ; C
      1+2+4+8+16, 1+16, 2+4+8,            ; D
      1+2+4+8+16, 1+4+16, 1+16,           ; E
      1+2+4+8+16, 1+4, 1,                 ; F
      0,0,0,                              ; space = 16
      4,4,4,                              ; -     = 17
      4,2+4+8,4,                          ; +     = 18
      1+2+8+16,1+2+8+16,0,                ; :     = 19
      8+16,8+16,0 }                       ; .     = 20

const DIGITS_SPACE = 16
const DIGITS_NEG = 17
const DIGITS_PLUS = 18
const DIGITS_COLON = 19
const DIGITS_DP = 20

procedure PlotDigit(byte in x, byte in y, byte in ch) is
var word indx = 0
var byte cx, bitIdx
var bit ink
    if ((ch *3) <  Count ( _DIGITS_3X5_MAP)) then
        indx = indx + 3 * (ch)
        for 3 loop
           cx = _DIGITS_3X5_MAP[indx]
           if ! CharInk then    -- black background, white text
              cx = !cx
           end if
           bitIdx = 1
           for 5  loop
               ink = ((cx & bitIdx) > 0)
               PlotPixel(x, y, ink)
               if (bitIdx < 128) then
                    bitIdx = bitIdx * 2
               end if
               y = y +1
           end loop    -- rows of font
           y = y -5
           indx = indx + 1
           x = x+1
        end loop   -- cols of font
    end if      -- characters
end procedure


-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to