Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use VGA Terminal and PS2Keyboard from FabGL #30

Open
ghost opened this issue Oct 30, 2022 · 1 comment
Open

use VGA Terminal and PS2Keyboard from FabGL #30

ghost opened this issue Oct 30, 2022 · 1 comment

Comments

@ghost
Copy link

ghost commented Oct 30, 2022

Hello with FabGL and ueforth, we can easily get a standalone forth computer!

Any plan to integrate FabGL into ueforth? In a basic form a 2 color text Terminal running on VGA2Controller can be used, and advanced support for drawing add audio could be added for gaming programming.

Thanks!

I figured out that change the default I/O to a VGA Terminal is simple:

*** ESP32forth.ino.orig	2022-10-30 17:12:44.579464479 +0800
--- ESP32forth.ino	2022-10-30 17:08:28.536010233 +0800
***************
*** 21 ****
--- 22,23 ----
+ #include <fabgl.h>
+ 
***************
*** 90 ****
!   V(rtos) V(SPIFFS) V(serial) V(SD) V(SD_MMC) V(ESP) \
--- 92 ----
!   V(rtos) V(SPIFFS) V(serial) V(terminal) V(SD) V(SD_MMC) V(ESP)	  \
*************** static cell_t ResizeFile(cell_t fd, cell
*** 470 ****
--- 473 ----
+   REQUIRED_TERMINAL_SUPPORT \
*************** static cell_t ResizeFile(cell_t fd, cell
*** 520 ****
--- 524,532 ----
+ fabgl::PS2Controller PS2Controller;
+ fabgl::VGA2Controller DisplayController;
+ fabgl::Terminal Terminal;
+ #define REQUIRED_TERMINAL_SUPPORT \
+   XV(terminal, "Terminal.available", TERMINAL_AVAILABLE, PUSH Terminal.available()) \
+   XV(terminal, "Terminal.write", TERMINAL_WRITE, n0 = Terminal.write(b1, n0); NIP) \
+   XV(terminal, "Terminal.read", TERMINAL_READ, PUSH Terminal.read()) \
+   XV(terminal, "Terminal.flush", TERMINAL_FLUSH, Terminal.flush())
+ 
*************** forth definitions
*** 1776 ****
--- 1789,1792 ----
+ vocabulary Terminal  Terminal definitions
+ transfer Terminal-builtins
+ forth definitions
+ 
*************** ARGS_MARK flags'or! LEAVE
*** 1956 ****
! forth definitions 
--- 1972 ----
! forth definitions
*************** also forth definitions
*** 2163 ****
!    dup 0= if 2drop exit then 
--- 2179 ----
!    dup 0= if 2drop exit then
*************** internals definitions also serial
*** 2678 ****
--- 2695,2702 ----
+ 
+ internals definitions also terminal
+ : terminal-type ( a n -- ) Terminal.write drop ;
+ : terminal-key ( -- n )
+    begin pause Terminal.available until Terminal.read ;
+ : terminal-key? ( -- n ) Terminal.available ;
+ 
+ 
*************** also forth definitions
*** 2680,2682 ****
! : default-type serial-type ;
! : default-key serial-key ;
! : default-key? serial-key? ;
--- 2704,2706 ----
! : default-type terminal-type ;
! : default-key terminal-key ;
! : default-key? terminal-key? ;
*************** static cell_t TimerIsrRegister(cell_t gr
*** 3858 ****
--- 3883,3884 ----
+ 
+ 
*************** void setup() {
*** 3859 ****
--- 3886,3892 ----
+   PS2Controller.begin(PS2Preset::KeyboardPort0);
+   DisplayController.begin();
+   DisplayController.setResolution(VGA_640x480_60Hz);
+   Terminal.begin(&DisplayController);
+   Terminal.connectLocally();
+   Terminal.enableCursor(true);
+ 

It looks like this :)
x

@farvardin
Copy link

thank you @iyzsong it helped to patch espforthstation: uho/ESP32forthStation#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant