Skip to content

Commit

Permalink
Start implementing non ansi escape sequence version.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ismael-VC committed Nov 2, 2024
1 parent e8700c3 commit 8e02aef
Show file tree
Hide file tree
Showing 15 changed files with 450 additions and 95 deletions.
13 changes: 8 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,14 @@ if [ -z "$DEBUG" ]; then
fi

# Sorry
cpp -P -w -D $DEBUG config/pre-options.tal -o config/options.tal
cpp -P -w -D $DEBUG src/debugger/routines/pre-after-eval.tal \
-o src/debugger/routines/after-eval.tal
cpp -P -w -D $DEBUG src/debugger/routines/pre-before-eval.tal \
-o src/debugger/routines/before-eval.tal
cpp -P -w -D $DEBUG config/options.talp -o config/options.tal
cpp -P -w -D $DEBUG src/debugger/routines/after-eval.talp \
-o src/debugger/routines/after-eval.tal
cpp -P -w -D $DEBUG src/debugger/routines/before-eval.talp \
-o src/debugger/routines/before-eval.tal
cpp -P -w -D $DEBUG src/repl/data.talp -o src/repl/data.tal
cpp -P -w -D $DEBUG src/talos/main.talp -o src/talos/main.tal
cpp -P -w -D $DEBUG src/talos/macros.talp -o src/talos/macros.tal

# Build
mkdir -p rom
Expand Down
1 change: 0 additions & 1 deletion config/macros.tal
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(
@|config/macros )

%UXN { LIT2 "փ }
%SPACER { \s \s \s \s \s \s }

%ENABLE { |00 }
Expand Down
2 changes: 1 addition & 1 deletion config/pre-options.tal → config/options.talp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ DEBUG @LOG-LEVEL ( valid values: OFF INFO WARN DEBUG ( most verbose ) )

ENABLE @INFO-STACKS ( print stacks after each evaluation )
DISABLE @INFO-PROMPT ( print the heap's `head` pointer inside the prompt )
ENABLE @INFO-ASSEMBLER-SUMMARY ( print the assembled definition summary )
DISABLE @INFO-ASSEMBLER-SUMMARY ( print the assembled definition summary )

ENABLE @WARN-ABORT ( warn each time an evaluation is aborted )
ENABLE @WARN-REDEFINITION ( warn on each redefinition )
Expand Down
1 change: 1 addition & 0 deletions etc/src/demos/փsh/փsh.tal
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
;Command/buf ;Command/pos STA2
JMP2r


@prompt 0a &first "փsh> 2000

@Command &pos $2 &buf
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/logger/data.tal
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"INFO: \s \0
&unused "-- \s "Unused: \s \0
&on-repl "expression \0
&assembled "Assembled \s \0
&in \s "in \s \0
&bytes \s "bytes. \n \0
&assembled \n "Assembled \fg-2 \s \0
&in \s \fg-3 "in \s \0
&bytes \s "bytes. \0
&labels \s "labels 29 ". \n \0
&sym-ext ".sym \0
&multiline-info-prompt \n "... \s "... \s ": \s \0
Expand Down
34 changes: 12 additions & 22 deletions src/repl/data.tal
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
(
@|repl/data )

@banner [
\bold \bg-1 \fg-0 MARGIN \n

\s \s \bg-2 \s \s \s \underline "/ \s \reset-console-style \bold \bg-1 \fg-0
\s \s \bg-3 \fg-1 \s \s "⋃ \s "⨉ \s "⋂ \s \s \bg-0 \fg-3 \s \s NAME \s
\s \bg-2 \fg-0 \s \s "v VERSION \s 28 DATE 29 \s \s \bg-1 \fg-0 \s \s \n

\s \s \bg-2 \underline "/ \s \reset-console-style \bold \bg-2 \fg-0 "/ \s "/
\bg-1 \s \s \s \s \s "©2024 \s AUTHOR \s \s \s \s \s \n

\s \s \bg-2 \s "/ \s \s \s \bg-1 \s \s \s \s "Type \s \bold \italic \fg-3 "help
\reset-console-style \bold \bg-1 \fg-0 \s "for \s "more \s "information. \s \s
\s \s \n

MARGIN \n

\reset-console-style \bg-0 \fg-1 \0 ]

@ok [ \underline \fg-3 \s \s \s \s "ok \n \n \0 ]

@multiline-prompt [ \n "... \s \0 ]
@banner [
\n \s \s \s \s \s "/_ \s \s "UXN \s \s \s \s \s NAME \s \s \s \s
\s "v VERSION \s 28 DATE 29 \n
\s \s "/_/ \s "/ \s \s "(c)2024 \s AUTHOR \n
\s \s \s "/ \s \s \s \s \s "Type \s "help \s "for \s "more \s
"information. \n \n \0 ]
@ok [ "____ok \n \n \0 ]
@shell-prompt \n \n "uxnsh> \s \0
@prompt [ "uxn \s "> \s \0 ]
@prompt-start [ "uxn \0 ]
@multiline-prompt [ \n \s "... \s \0 ]
@prompt-end [ "> \s \0 ]
54 changes: 54 additions & 0 deletions src/repl/data.talp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
(
@|repl/data )

#ifdef ANSI
@banner [
\bold \bg-1 \fg-0 MARGIN \n

\s \s \bg-2 \s \s \s \underline "/ \s \reset-console-style \bold \bg-1 \fg-0
\s \s \bg-3 \fg-1 \s \s "⋃ \s "⨉ \s "⋂ \s \s \bg-0 \fg-3 \s \s NAME \s
\s \bg-2 \fg-0 \s \s "v VERSION \s 28 DATE 29 \s \s \bg-1 \fg-0 \s \s \n

\s \s \bg-2 \underline "/ \s \reset-console-style \bold \bg-2 \fg-0 "/ \s "/
\bg-1 \s \s \s \s \s "©2024 \s AUTHOR \s \s \s \s \s \n

\s \s \bg-2 \s "/ \s \s \s \bg-1 \s \s \s \s "Type \s \bold \italic \fg-3 "help
\reset-console-style \bold \bg-1 \fg-0 \s "for \s "more \s "information. \s \s
\s \s \n

MARGIN \n

\reset-console-style \bg-0 \fg-1 \0 ]

@ok [ \underline \fg-3 \s \s \s \s "ok \n \n \0 ]

@shell-prompt [
\r \s \s \s \s \s \s \s \s \s \r \bg-0 \fg-2 \bold "փsh> \s
\reset-console-style \bg-0 \fg-1 \0 ]

@prompt [
\r \s \s \s \s \r \bg-0 \fg-3 \bold "փ \s "> \s
\reset-console-style \bg-0 \fg-1 \0 ]

@prompt-start [ "փ \s \0 ]
@multiline-prompt [ \n "... \s \0 ]
#else
@banner [
\n \s \s \s \s \s "/_ \s \s "UXN \s \s \s \s \s NAME \s \s \s \s
\s "v VERSION \s 28 DATE 29 \n

\s \s "/_/ \s "/ \s \s "(c)2024 \s AUTHOR \n

\s \s \s "/ \s \s \s \s \s "Type \s "help \s "for \s "more \s
"information. \n \n \0 ]

@ok [ "____ok \n \n \0 ]

@shell-prompt \n \n "uxnsh> \s \0

@prompt [ "uxn \s "> \s \0 ]
@prompt-start [ "uxn \0 ]
@multiline-prompt [ \n \s "... \s \0 ]
#endif

@prompt-end [ "> \s \0 ]
19 changes: 6 additions & 13 deletions src/repl/routines.tal
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,10 @@
;&shell-mode LDA #00 EQU ;&shell-mode STA POP

;&shell-mode LDA ?{
pstr:
\r \s \s \s \s \s \s \s \s \s \r \bg-0 \fg-2 \bold "փsh> \s
\reset-console-style \bg-0 \fg-1 \0
;shell-prompt pstr
BRK }

pstr:
\r \s \s \s \s \r \bg-0 \fg-3 \bold "փ \s "> \s
\reset-console-style \bg-0 \fg-1 \0
;prompt pstr
BRK }

DUP LIT "@ NEQ ?{ #01 ;&expression STA }
Expand All @@ -141,7 +137,7 @@
!&multiline-end }

#01 ,&break STR
POP LIT \n }
POP LIT \0 }

DUP \emit

Expand All @@ -155,7 +151,7 @@
#0000 ;length STA2
~debugger/routines/before-eval.tal

POP ( consume newline )
POP ( consume newline)

(
@|Eval )
Expand Down Expand Up @@ -230,15 +226,12 @@
( ;input ;input-ptr LDA2 NEQ2 ?{
pstr: \console-cursor-up \0 } )

;&prompt-start pstr
;prompt-start pstr
~logger/info/prompt.tal
;&prompt-end pstr
;prompt-end pstr
pstr: \CSI "m \CSI "48;2;51;00;34m \CSI "38;2;170;170;170m \0
JMP2r

&prompt-start [ "փ \s \0 ]
&prompt-end [ "> \s \0 ]

@<print-post-prompt> ( -- )
;ok !pstr

Expand Down
Loading

0 comments on commit 8e02aef

Please sign in to comment.