diff --git a/.gitmodules b/.gitmodules index 6cbadcbda9..e4b7ced6e1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1337,6 +1337,9 @@ [submodule "vendor/grammars/typst-grammar"] path = vendor/grammars/typst-grammar url = https://github.com/michidk/typst-grammar.git +[submodule "vendor/grammars/uxntal-vscode"] + path = vendor/grammars/uxntal-vscode + url = https://github.com/bellinitte/uxntal-vscode.git [submodule "vendor/grammars/verilog.tmbundle"] path = vendor/grammars/verilog.tmbundle url = https://github.com/textmate/verilog.tmbundle diff --git a/grammars.yml b/grammars.yml index 13979f0c14..58f42fcfca 100644 --- a/grammars.yml +++ b/grammars.yml @@ -1190,6 +1190,8 @@ vendor/grammars/typespec: - source.tsp vendor/grammars/typst-grammar: - source.typst +vendor/grammars/uxntal-vscode: +- source.tal vendor/grammars/verilog.tmbundle: - source.verilog vendor/grammars/vsc-ember-syntax: diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 7ea73879c5..d4ee0b5eb2 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -8112,6 +8112,17 @@ UrWeb: tm_scope: source.ur ace_mode: text language_id: 383 +Uxntal: + type: programming + color: "#72dec2" + aliases: + - uxn + - tal + extensions: + - ".tal" + tm_scope: source.tal + ace_mode: text + language_id: 187264989 V: type: programming color: "#4f87c4" diff --git a/samples/Uxntal/dvd.tal b/samples/Uxntal/dvd.tal new file mode 100644 index 0000000000..8b355440e7 --- /dev/null +++ b/samples/Uxntal/dvd.tal @@ -0,0 +1,56 @@ +( DVD Bounce ) + +|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 +|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 + +|0000 + + @dvd &x $2 &y $2 + +|0100 + +@on-reset ( -> ) + ( | theme ) + #4cfd .System/r DEO2 + #4cf3 .System/g DEO2 + #dcf2 .System/b DEO2 + ( | vectors ) + ;on-frame .Screen/vector DEO2 + ( | starting position ) + .Screen/width DEI2 #01 SFT2 .dvd/x STZ2 + .Screen/height DEI2 #01 SFT2 .dvd/y STZ2 + ( | set collisions ) + .Screen/width DEI2 #0020 SUB2 ;on-frame/hit-hor STA2 + .Screen/height DEI2 #0010 SUB2 ;on-frame/hit-ver STA2 + ( | drawing mode ) + [ LIT2 36 -Screen/auto ] DEO + #01 draw-dvd BRK + +@on-frame ( -> ) + #00 draw-dvd + ( | x ) + .dvd/x LDZ2 + ( left ) ORAk ?{ #0001 ,&x STR2 } + ( right ) DUP2 [ LIT2 &hit-hor $2 ] NEQ2 ?{ #ffff ,&x STR2 } + [ LIT2 &x 0001 ] ADD2 .dvd/x STZ2 + ( | y ) + .dvd/y LDZ2 + ( top ) ORAk ?{ #0001 ,&y STR2 } + ( bottom ) DUP2 [ LIT2 &hit-ver $2 ] NEQ2 ?{ #ffff ,&y STR2 } + [ LIT2 &y 0001 ] ADD2 .dvd/y STZ2 + #01 draw-dvd BRK + +@draw-dvd ( color -- ) + ;dvd-icn .Screen/addr DEO2 + .dvd/x LDZ2 .Screen/x DEO2 + .dvd/y LDZ2 .Screen/y DEO2 + .Screen/sprite DEOk DEO + JMP2r + +@dvd-icn ( 4 x 2 ) + [ + 001f 3f38 3838 787f 00fe fe7e 7777 e3c3 + 000f 1f3b 7b77 e7c7 00fc fe8f 8707 0efc + 7f00 000f ff7f 0700 0301 00ff f0f8 ff00 + 8700 00ff 7f7f ff00 f000 00e0 fcfc 8000 ] + diff --git a/samples/Uxntal/mandelbrot.tal b/samples/Uxntal/mandelbrot.tal new file mode 100644 index 0000000000..cc3d18be0a --- /dev/null +++ b/samples/Uxntal/mandelbrot.tal @@ -0,0 +1,124 @@ +( mandelbrot.tal ) +( ) +( by alderwick and d_m ) + +%WIDTH { #02a0 } +%HEIGHT { #0200 } +%XMIN { #de69 } ( -8601 ) +%XMAX { #0b33 } ( 2867 ) +%YMIN { #ecc7 } ( -4915 ) +%YMAX { #1333 } ( 4915 ) + +|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 +|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 + +|0100 ( -> ) + + ( theme ) + #0f0f .System/r DEO2 + #0ff0 .System/g DEO2 + #00ff .System/b DEO2 + + ( size ) + WIDTH .Screen/width DEO2 + HEIGHT .Screen/height DEO2 + + ( run ) + draw-mandel + BRK + +( draw the mandelbrot set using 4.12 fixed point numbers ) +@draw-mandel ( -> ) + XMAX XMIN SUB2 WIDTH DIV2 ,&dx STR2 ( ; &dx<-{xmax-min}/width ) + YMAX YMIN SUB2 HEIGHT DIV2 ,&dy STR2 ( ; &dy<-{ymax-ymin}/height ) + [ LIT2 01 -Screen/auto ] DEO ( ; auto<-1 ) + LIT2r 8000 ( [8000] ) + YMAX YMIN ( ymax* ymin* [8000] ) + &yloop ( ymax* y* [8000] ) + XMAX XMIN ( ymax* y* xmax* xmin* [8000] ) + &xloop ( ymax* y* xmax* x* [8000] ) + ROT2k evaluate ( ymax* y* xmax* x* xmax* count^ [8000] ) + .Screen/pixel DEO POP2 ( ymax* y* xmax* x* [8000] ) + [ LIT2 &dx $2 ] ADD2 ( ymax* y* xmax* x+dx* [8000] ) + OVR2 STH2kr ADD2 ( ymax* y* xmax* x+dx* 8000+xmax* [8000] ) + OVR2 STH2kr ADD2 ( ymax* y* xmax* x+dx* 8000+xmax* 8000+x+dx* [8000] ) + GTH2 ?&xloop ( ymax* y* xmax* x+dx* [8000] ) + POP2 POP2 ( ymax* y* [8000] ) + #0000 .Screen/x DEO2 ( ymax* y* [8000] ; sc/x<-0 ) + .Screen/y DEI2k ( ymax* y* d^ sy* [8000] ) + INC2 ROT DEO2 ( ymax* y* [8000] ; sc/y<-sy+1 ) + [ LIT2 &dy $2 ] ADD2 ( ymax* y+dy* [8000] ) + OVR2 STH2kr ADD2 ( ymax* y+dy* 8000+ymax* [8000] ) + OVR2 STH2kr ADD2 ( ymax* y+dy* 8000+ymax* 8000+y+dy* [8000] ) + GTH2 ?&yloop ( ymax* y+dy* [8000] ) + POP2 POP2 POP2r JMP2r ( ) + +@evaluate ( x* y* -> count^ ) + #0000 DUP2 ,&x1 STR2 ( x* y* ; x1<-0 ) + DUP2 ,&y1 STR2 ( x* y* ; y1<-0 ) + DUP2 ,&x2 STR2 ( x* y* ; x2<-0 ) + ,&y2 STR2 ( x* y* ; y2<-0 ) + LIT2r 2000 ( x* y* [20 00] ) + &loop ( x* y* [20 n^] ) + [ LIT2 &x1 $2 ] ( x* y* x1* [20 n^] ) + [ LIT2 &y1 $2 ] ( x* y* x1* y1* [20 n^] ) + smul2 DUP2 ADD2 ( x* y* 2x1y1* [20 n^] ) + OVR2 ADD2 ,&y1 STR2 ( x* y* [20 n^] ; y1<-2x1y1+y* ) + SWP2 [ LIT2 &x2 $2 ] ( y* x* x2* [20 n^] ) + [ LIT2 &y2 $2 ] SUB2 ( y* x* x2-y2* [20 n^] ) + OVR2 ADD2 ,&x1 STR2 SWP2 ( x* y* [20 n^] ; x1<-x2-y2+x* ) + ,&x1 LDR2 square ( x* y* x1^2* [20 n^] ) + DUP2 ,&x2 STR2 ( x* y* x1^2* [20 n^] ; x2<-x1^2* ) + ,&y1 LDR2 square ( x* y* x1^2* y1^2* [20 n^] ) + DUP2 ,&y2 STR2 ( x* y* x1^2* y1^2* [20 n^] ; y2<-y1^2* ) + ADD2 #4000 GTH2 ?&end ( x* y* [20 n^] ) + INCr GTHkr STHr ?&loop ( x* y* [20 n+1*] ) + &end ( x* y* [20 count^] ) + POP2 POP2 NIPr STHr JMP2r ( count^ ) + +( multiply two signed 4.12 fixed point numbers ) +@smul2 ( a* b* -> ab* ) + LIT2r 0001 DUP2 #8000 LTH2 ?&bpos negate SWPr ( a* |b|* [sign*] ) + &bpos SWP2 DUP2 #8000 LTH2 ?&apos negate SWPr ( |b|* |a|* [sign*] ) + &apos smul2-pos STHr ?&abpos negate ( ab* [scrap^] ) + &abpos POPr JMP2r ( ab* ) + +( multiply two non-negative fixed point numbers ) +( ) +( a * b = {a0/16 + a1/4096} * {b0/16 + b1/4096} ) +( = a0b0/256 + a1b0/65536 + a0b1/65536 + a1b1/16777216 ) +( = x + y + z + 0 ; the last term is too small to represent, i.e. zero ) +( ) +( x = a0b0 << 4 ) +( y = a1b0 >> 4 ) +( z = a0b1 >> 4 ) +@smul2-pos ( a* b* -> ab* ) + aerate ROT2 aerate ( b0* b1* a0* a1* ) + STH2 ROT2k ( b0* b1* a0* b1* a0* b0* [a1*] ) + STH2 MUL2r ( b0* b1* a0* b1* a0* [a1b0*] ) + MUL2 STH2 ADD2r ( b0* b1* a0* [a1b0+a0b1*] ) + NIP2 MUL2 #07ff min #40 SFT2 ( a0b0* [y+z*] ) + STH2r #04 SFT2 ADD2 ( x* [y+z*] ) + #7fff !min ( ab* ) + +( equivalent to DUP2 smul2 but faster ) +@square ( a* -> aa* ) + DUP2 #8000 LTH2 ?&pos negate &pos + +( >> ) + +( equivalent to DUP2 smul2-pos but faster ) +@square-pos ( a* -> aa* ) + aerate ( 00 ahi^ 00 alo^ ) + OVR2 MUL2 #03 SFT2 SWP2 ( yz* ahi* ) + DUP2 MUL2 #07ff min #40 SFT2 ( x* yz* ) + ADD2 #7fff !min ( aa* ) + +( convert each byte of a a short into a short ) +@aerate ( x* -> 00 xhi^ 00 xlo^ ) SWP #0000 ROT SWP2 SWP JMP2r + +( negate a fixed point number. doesn't work for #8000 ) +@negate ( x* -> -x* ) DUP2k EOR2 SWP2 SUB2 JMP2r + +( return the minimum of two non-negative numbers. ) +@min ( x* y* ) GTH2k [ JMP SWP2 ] NIP2 JMP2r diff --git a/vendor/README.md b/vendor/README.md index da47065d96..1e22073216 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -651,6 +651,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting - **UnrealScript:** [textmate/java.tmbundle](https://github.com/textmate/java.tmbundle) - **Untyped Plutus Core:** [aiken-lang/vscode-aiken](https://github.com/aiken-lang/vscode-aiken) - **UrWeb:** [gwalborn/UrWeb-Language-Definition](https://github.com/gwalborn/UrWeb-Language-Definition) +- **Uxntal:** [bellinitte/uxntal-vscode](https://github.com/bellinitte/uxntal-vscode) - **V:** [0x9ef/vscode-vlang](https://github.com/0x9ef/vscode-vlang) - **VBA:** [serkonda7/vscode-vba](https://github.com/serkonda7/vscode-vba) - **VBScript:** [peters-ben-0007/VBDotNetSyntax](https://github.com/peters-ben-0007/VBDotNetSyntax) diff --git a/vendor/grammars/uxntal-vscode b/vendor/grammars/uxntal-vscode new file mode 160000 index 0000000000..81112c2d78 --- /dev/null +++ b/vendor/grammars/uxntal-vscode @@ -0,0 +1 @@ +Subproject commit 81112c2d78a0206182866a6157cab37ebde58cf1 diff --git a/vendor/licenses/git_submodule/uxntal-vscode.dep.yml b/vendor/licenses/git_submodule/uxntal-vscode.dep.yml new file mode 100644 index 0000000000..68387d755f --- /dev/null +++ b/vendor/licenses/git_submodule/uxntal-vscode.dep.yml @@ -0,0 +1,36 @@ +--- +name: uxntal-vscode +version: 81112c2d78a0206182866a6157cab37ebde58cf1 +type: git_submodule +homepage: https://github.com/bellinitte/uxntal-vscode.git +license: mit +licenses: +- sources: LICENSE + text: | + MIT License + + Copyright (c) 2021 Karol Belina + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +- sources: README.md + text: |- + This software is licensed under the MIT license. + + See the [LICENSE](LICENSE) file for more details. +notices: []