From 39cf3b41b575e2c38f167592bc54e2d2c99c5df0 Mon Sep 17 00:00:00 2001 From: RodrigoDornelles Date: Tue, 5 Nov 2024 17:04:35 -0300 Subject: [PATCH] docs: add topic languages --- docs/lang_esc_g.txt | 59 +++++++++++++++++++++++++++++++++++ src/engine/core/repl/main.lua | 17 ++++++++-- 2 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 docs/lang_esc_g.txt diff --git a/docs/lang_esc_g.txt b/docs/lang_esc_g.txt new file mode 100644 index 0000000..2fa38f2 --- /dev/null +++ b/docs/lang_esc_g.txt @@ -0,0 +1,59 @@ +@defgroup Languages +@{ + +@defgroup lang_esc_g ESC G +@{ + +@par Backus–Naur Form +@startebnf +protocol_esc_g = esc, "G", command (* 7 bits *), size (* MSB command\ndefines x1024 *), [ buffer ], checksum (* DJB2 *); +esc = "\x1b"; +command = byte; +size = byte; +buffer = 4 * byte | 1024 * byte; +checksum = 4 * byte; +@endebnf + +@par Commands + +| | command name | parameters | sizes in bytes| +| :-: | :------------- | :-------------- | :------------ | +| 0 | hello | | 0 | +| 1 | hdmi cec | command | 4..20 | +| 2 | press menu key | | 0 | +| 3 | gamepad update | z,x,c,v,w,a,s,d | 8 | +| 44 | set img index | index,type,w,h | 4 or 8 | +| 45 | update image | image | 0..254000 | +| 46 | set text index | index | 4 | +| 47 | update text | text | 0..254000 | +| 48 | draw mode | m1, m2, s1, s2 | 4 | +| 49 | draw color | r, g, b, a | 4 | +| 50 | draw rect | x, y, w, h | 4, 8 or 16 | +| 51 | draw line | x1, y1, x2, y2 | 4, 8 or 16 | +| 52 | draw text | x, y, id, size | 4 | +| 52 | draw image | x, y, id | 4 | +| 64..127 | custom | | 0..254000 | + +@par Modes + +@li @b 0 tint fill +@li @b 1 tint frame +@li @b 2 tint open +@li @b 4 tint save +@li @b 5 erase fill +@li @b 6 erase frame +@li @b 7 erase open + +@par Image Types + +@li @b 0 RGB 15bits +@li @b 1 RGBA 32bits +@li @b 2 BMP +@li @b 3 PNG + +@par Examples + +@li @c std.draw.clear(0xAABBCCDD) @n ESC G 0x48 0x00000003 0x00000000 @n ESC G 0x49 0x01 0xAABBCCDD 0x00000000 @n ESC G 0x50 0x01 0x0000FFFFF 0x00000000 + +@} +@} diff --git a/src/engine/core/repl/main.lua b/src/engine/core/repl/main.lua index 78a8fe4..2a76ca7 100644 --- a/src/engine/core/repl/main.lua +++ b/src/engine/core/repl/main.lua @@ -1,5 +1,9 @@ ---! @short Read Eval Print Loop ---! @brief an interpreter to debuging the game via stdio. +--! @defgroup Languages +--! @{ +--! +--! @defgroup REPL +--! @{ +--! --! @par Extended Backus-Naur Form --! @startebnf --! line = exit | frame_skip | [frame_skip], variable, ["=", value (* assignment *)]; @@ -7,6 +11,15 @@ --! digit = { ? 0 - 9 ? }- ; --! exit = "?" ; --! @endebnf +--! +--! @par Usage +--! @code{.sql} +--! lua cli.lua run game.lua --core repl +--! @endcode +--! +--! @} +--! @} + local zeebo_module = require('src/lib/common/module') -- local engine_encoder = require('src/lib/engine/api/encoder')