Pokitext: text editor on pokitto


#161

I mentioned it 5 days ago:

I probably won’t have time today.


#162

Oooh sorry, I overlooked that.


#163

You know what, I scratch undo. I’d like to focus on the IDE, would be too many things to juggle.

EDIT:

I’ve fixed the LIL bug.


#164

It’s looking good now, except flickering because no double buffer.

out

bin if you wanna try this out

firmware.bin (180.4 KB)

LIL cheatsheet
  LIL functions for Pokitto:

    p_write what [x] [y] [color]       write value to screen
    p_read                             waits for pokitto button press and returns
                                       its value (ABCURDL = 0123456)
    p_clear [color]                    clear screen with given color
    p_wait n                           wait (sleep) for n frames
    p_rect x y w h color [filled]      draw a rectangle
    p_circle x y r color [filled]      draw a circle
    p_line x1 y1 x2 y2 color           draw a line

  general LIL cheatsheet (find more in lil's readme.txt)
  
    case-sensitive
    separate with ; or newlines

    ## comment
    [...]                        execute what's inside square brackets and substitute the result, e.g.: print [expr 1 + 1]   
    if ["not"] val then [else]   branching, e.g.: if 1 {print one} {print noone}
    while ["not"] val code       while loop
    for init expr step code      for loop
    foreach [name] l code        executes code for each list item (its value will be in "name"), returns list of evaluations,
                                 e.g.: foreach i [list a b c] {print $i}
    return [val]                 returns from function with optional value

    set var val                  set given variable to given value
    $var                         get variable value (same as set with only one argument)
    expr a b c ...               combines arguments into one math epression, evaluates and returns the result
    func fname args body         define a new function, e.g.: func myfunc {a b} {print $a $b}
    list a b c ...               returns a new list with arguments as items
    count l                      returns number of items in a LIL list
    index l i                    returns ith item in a LIL list (0-based)
    indexof l v                  returns index of first occurence of value in a LIL list, or empty string
    append l v                   appends a value to a LIL list
    slice l i1 [i2]              returns a slice of a LIL list
    eval a b c ...               combines argument into a single string and evaluates as LIL code
    char n                       converts int to char (one-character string)
    rand                         returns a random number between 0.0 and 1.0
    inc name [val]               increment variable (or add given value)

EDIT:

I was confused about how the display worked, it actually has kind of a double buffering. Now it’s fixed:

out


Am I understanding it right it works like this?

You can write pixel to the hardware LCD, and the screen then keeps showing these pixels until the next refresh? So it needs no extra memory to just hold a picture. So the direct drawing methods write it directly to the LCD where it stays until a refresh. The undirect methods write to the screen buffer – which depends on the screen mode – and the buffer is directly written to the screen on a each Pokitto::Display::update (which is the double buffering – one is the screen itself, and the RAM screen buffer is the back buffer).

So theoretically we can work without a screen buffer and save a lot of RAM on the display buffer?

EDIT:

Adding LIL examples:

out


#165

You got it correct. Direct is a bit slower than the buffered modes though, as more commands need to be sent more often.