├── .gitattributes
├── .gitignore
├── .gitmodules
├── .travis.yml
├── Makefile.am
├── README.md
├── bootstrap
├── build.config
├── carts
├── Makefile.am
├── dickwave.p8
├── dickwave.p8.png
├── launcher.p8
├── rgbplasma.p8
├── rgbplasma.p8.png
├── rulez.p8
├── rulez.p8.png
├── shmup.p8
├── tunnel.p8
├── tunnel.p8.png
├── tut.p8
├── tut.p8.png
├── zepto.p8
├── zepto8.p8.png
├── zepton.p8
└── zepton.p8.png
├── configure.ac
├── doc
├── PICO-8-language.md
├── ports.md
├── z8tool.md
└── zepto8.md
├── src
├── .gitignore
├── Makefile.am
├── analyzer.h
├── bindings
│ ├── js.h
│ └── lua.h
├── bios.cpp
├── bios.h
├── compress.cpp
├── compress.h
├── config_app.h
├── data
│ ├── blank.png
│ ├── jingle.p8
│ ├── makefont.p8
│ ├── zepto8.sfd
│ └── zepto8.ttf
├── dither.cpp
├── dither.h
├── dummy.cpp
├── filter.cpp
├── filter.h
├── ide
│ ├── ide.cpp
│ ├── ide.h
│ ├── memory-editor.cpp
│ ├── memory-editor.h
│ ├── text-editor.cpp
│ └── text-editor.h
├── libquickjs.vcxproj
├── libretro-zepto8.vcxproj
├── libretro.cpp
├── libz8lua.vcxproj
├── libzepto8.vcxproj
├── libzepto8.vcxproj.filters
├── minify.cpp
├── minify.h
├── pico8
│ ├── api.cpp
│ ├── ast.cpp
│ ├── bios.p8
│ ├── cart.cpp
│ ├── cart.h
│ ├── code.cpp
│ ├── gfx.cpp
│ ├── grammar.h
│ ├── memory.h
│ ├── parser.cpp
│ ├── pico8.h
│ ├── private.cpp
│ ├── render.cpp
│ ├── sfx.cpp
│ ├── vm.cpp
│ └── vm.h
├── player.cpp
├── player.h
├── raccoon
│ ├── api.cpp
│ ├── font.h
│ ├── memory.h
│ ├── vm.cpp
│ └── vm.h
├── splore.cpp
├── splore.h
├── synth.cpp
├── synth.h
├── telnet.h
├── template.html
├── textfile.cpp
├── textfile.h
├── unz8
├── unz8.p8
├── vm.cpp
├── z8dev.cpp
├── z8dev.vcxproj
├── z8dev.vcxproj.filters
├── z8lua.vcxproj
├── z8lua.vcxproj.filters
├── z8tool.cpp
├── z8tool.vcxproj
├── z8tool.vcxproj.filters
├── zepto8.cpp
├── zepto8.h
├── zepto8.vcxproj
└── zlib
│ ├── deflate.c
│ ├── deflate.h
│ ├── gz8.h
│ ├── trees.c
│ ├── trees.h
│ ├── zconf.h
│ ├── zlib.h
│ └── zutil.h
├── t
├── Makefile.am
├── math-old.p8
├── math.p8
├── print.p8
├── syntax-depicofier.lua
├── syntax.p8
└── tables.p8
├── utils
└── Makefile.am
└── zepto8.sln
/.gitattributes:
--------------------------------------------------------------------------------
1 |
2 | # Everything is text unless it isn’t.
3 | * text=auto
4 |
5 | # Source files are whatever the OS prefers but should be
6 | # normalised in the repository.
7 | *.c text
8 | *.cpp text
9 | *.cc text
10 | *.h text
11 | *.hh text
12 | *.lolfx text
13 | *.cs text
14 |
15 | # Vim doesn't like CRLF, even on Windows.
16 | # Same for autoconf/automake
17 | *.vim text eol=lf
18 | *.m4 text eol=lf
19 | *.ac text eol=lf
20 | *.in text eol=lf
21 |
22 | # This is Windows-specific and should always have CRLF, or
23 | # Visual Studio may misbehave.
24 | *.sln text eol=crlf
25 | *.csproj text eol=crlf
26 | *.vcxproj text eol=crlf
27 | *.resx text eol=crlf
28 |
29 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Our binaries
2 | zepto8
3 | z8dev
4 | z8lua
5 | z8tool
6 | # Autotools cruft
7 | *.o
8 | *.lo
9 | *.a
10 | *.la
11 | *.exe
12 | *.so
13 | *.elf
14 | *.self
15 | *.nexe
16 | *.userprefs
17 | *.usertasks
18 | *.pidb
19 | .auto
20 | .libs
21 | .deps
22 | .dirstamp
23 | .*.androiddir
24 | .*.androidstamp
25 | Makefile
26 | Makefile.in
27 | aclocal.m4
28 | autom4te.cache
29 | config.h.in
30 | config.h
31 | config.log
32 | config.status
33 | configure
34 | libtool
35 | stamp-*
36 | *-stamp
37 | test-suite.log
38 | # Emscripten cruft
39 | *.html
40 | *.html.mem
41 | *.js
42 | *.wasm
43 | *.wasm.map
44 | # Personal stuff
45 | patch-*.diff
46 | # Debugging cruft
47 | core
48 | !core/
49 | core.*
50 | vgcore.*
51 | callgrind.out.*
52 | perf.data*
53 | *.gcda
54 | *.gcno
55 | # Editor cruft
56 | .*.swp
57 | *~
58 | .ycm_extra_conf.pyc
59 | # Visual Studio cruft
60 | *.vcxproj.user
61 | *.csproj.user
62 | binaries/*Debug
63 | binaries/*Release
64 | .vs
65 | *.VC.VC.opendb
66 | *.VC.db
67 | *.sdf
68 | *.suo
69 | *.opensdf
70 | # ReSharper cruft
71 | _ReSharper.*
72 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "lolengine"]
2 | path = src/3rdparty/lolengine
3 | url = https://github.com/lolengine/lolengine
4 | branch = master
5 | update = merge
6 |
7 | [submodule "wiki"]
8 | path = wiki
9 | url = https://github.com/samhocevar/zepto8.wiki
10 | branch = master
11 | update = merge
12 |
13 | [submodule "z8lua"]
14 | path = src/3rdparty/z8lua
15 | url = https://github.com/samhocevar/z8lua
16 | branch = zepto8
17 | update = merge
18 | upstream = https://github.com/lua/lua
19 |
20 | [submodule "imgui-club"]
21 | path = src/3rdparty/imgui-club
22 | url = https://github.com/samhocevar/fork-imgui-club
23 | branch = master
24 | update = merge
25 | upstream = https://github.com/ocornut/imgui_club
26 |
27 | [submodule "zep"]
28 | path = src/3rdparty/zep
29 | url = https://github.com/samhocevar/fork-zep
30 | branch = zepto8/experiments
31 | update = merge
32 | upstream = https://github.com/cmaughan/zep
33 |
34 | [submodule "quickjs"]
35 | path = src/3rdparty/quickjs
36 | url = https://github.com/samhocevar/fork-quickjs
37 | branch = zepto8
38 | update = merge
39 | upstream = https://github.com/horhof/quickjs
40 |
41 | [submodule "libretro-common"]
42 | path = src/3rdparty/libretro-common
43 | url = https://github.com/libretro/libretro-common
44 | branch = master
45 | update = merge
46 |
47 | [submodule "lodepng"]
48 | path = src/3rdparty/lodepng
49 | url = https://github.com/lvandeve/lodepng
50 | branch = master
51 | update = merge
52 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: required
2 | dist: trusty
3 | language: c++
4 | env: VERBOSE=1
5 |
6 | addons:
7 | apt:
8 | packages:
9 | - build-essential
10 | - automake
11 | - autoconf
12 | - libtool
13 | - pkg-config
14 | - libsdl2-dev
15 | - libsdl2-image-dev
16 | - libsdl2-mixer-dev
17 | - libglew-dev
18 | # this can fix clang compilation
19 | - clang-3.8
20 | - libc++-dev
21 |
22 | before_install:
23 | - if [ "$CC" = "clang" ]; then export CC="clang-3.8"; fi
24 | - if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.8 -stdlib=libc++"; fi
25 | - ./bootstrap
26 |
27 | os:
28 | - linux
29 |
30 | compiler:
31 | - gcc
32 | - clang
33 |
34 |
--------------------------------------------------------------------------------
/Makefile.am:
--------------------------------------------------------------------------------
1 |
2 | include $(top_srcdir)/src/3rdparty/lolengine/build/autotools/common.am
3 |
4 | ACLOCAL_AMFLAGS = -I src/3rdparty/lolengine/build/autotools/m4
5 | EXTRA_DIST += bootstrap
6 |
7 | SUBDIRS = src/3rdparty/lolengine src
8 | DIST_SUBDIRS = $(SUBDIRS) t utils carts
9 |
10 | test: check
11 |
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # zepto8
2 | Fantasy fantasy console emulator emulator
3 |
4 | This is all experimental.
5 |
6 | ## Documentation
7 |
8 | - [`zepto8`](doc/zepto8.md), the PICO-8 emulator
9 | - [`z8tool`](doc/z8tool.md), a utility toolkit
10 | - `z8dev` is an experimental IDE and does not work yet
11 | - the [PICO-8 language](doc/PICO-8-language.md)
12 | - [zepto8 ports to other platforms](doc/ports.md)
13 |
14 | ## See also
15 |
16 | - [`z8lua`](https://github.com/samhocevar/z8lua)
17 | - the [PICO-8](https://www.lexaloffle.com/pico-8.php) fantasy console
18 |
--------------------------------------------------------------------------------
/bootstrap:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Clean up
4 | if [ -d .git/modules/lol ]; then
5 | echo "Warning: found old submodule directory .git/modules/lol"
6 | exit 1
7 | fi
8 |
9 | # Check that the repository is properly set up
10 | if [ ! -x "./src/3rdparty/lolengine/bootstrap" ]; then
11 | cat << EOF
12 | Error: cannot execute src/3rdparty/lolengine/bootstrap
13 |
14 | Did you configure the Lol Engine submodule? The following may help:
15 |
16 | git submodule update --init --recursive
17 |
18 | EOF
19 | exit 1
20 | fi
21 |
22 | # Bootstrap this project first, using the Lol Engine script
23 | ./src/3rdparty/lolengine/bootstrap
24 |
25 | # Then bootstrap Lol Engine itself
26 | (cd src/3rdparty/lolengine && ./bootstrap)
27 |
28 |
--------------------------------------------------------------------------------
/build.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | no
7 | yes
8 | yes
9 | yes
10 | yes
11 |
12 | no
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/carts/Makefile.am:
--------------------------------------------------------------------------------
1 |
2 | include $(top_srcdir)/src/3rdparty/lolengine/build/autotools/common.am
3 |
4 | EXTRA_DIST += zepto8.p8.png \
5 | tunnel.p8.png \
6 | rulez.p8 rulez.p8.png \
7 | tut.p8 tut.p8.png
8 |
9 |
--------------------------------------------------------------------------------
/carts/dickwave.p8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samhocevar/zepto8/b2929a4fe31e5765ef66d7794edd11086b9638b4/carts/dickwave.p8.png
--------------------------------------------------------------------------------
/carts/launcher.p8:
--------------------------------------------------------------------------------
1 | pico-8 cartridge // http://www.pico-8.com
2 | version 41
3 | __lua__
4 |
5 | --------------
6 | -----WIDE-----
7 | --------------
8 |
9 | poke(0x5f36,1)
10 |
11 | _cam_x=0
12 | _cam_y=0
13 |
14 | _realcamera=camera
15 | function camera(_cx,_cy)
16 | _cam_x=_cx and _cx or 0
17 | _cam_y=_cy and _cy or 0
18 | _realcamera(_cam_x-64,_cam_y)
19 | end
20 |
21 | function _widedraw(_f,...)
22 | _realcamera(_cam_x-64,_cam_y)
23 | _f(...)
24 | _map_display(1)
25 | _realcamera(_cam_x+64,_cam_y)
26 | _f(...)
27 | _realcamera(_cam_x,_cam_y)
28 | _map_display(0)
29 | end
30 |
31 | _realcls=cls function cls(...)_widedraw(_realcls,...)end
32 | _realspr=spr function spr(...)_widedraw(_realspr,...)end
33 | _realsspr=sspr function sspr(...)_widedraw(_realsspr,...)end
34 | _realmap=map function map(...)_widedraw(_realmap,...)end
35 | _realrect=rect function rect(...)_widedraw(_realrect,...)end
36 | _realrectfill=rectfill function rectfill(...)_widedraw(_realrectfill,...)end
37 | _realcircfill=circfill function circfill(...)_widedraw(_realcircfill,...)end
38 | _realcirc=circ function circ(...)_widedraw(_realcirc,...)end
39 | _realprint=print function print(...)_widedraw(_realprint,...)end
40 | _realpset=pset function pset(...)_widedraw(_realpset,...)end
41 | _realline=line function line(...)_widedraw(_realline,...)end
42 | --------------
43 |
44 | cartdata("z8_launcher_label")
45 |
46 | piledir={}
47 | curdir=""
48 | curlist={}
49 | meta_loaded=false
50 |
51 | function find(t,si,c)
52 | for i=si,#t do
53 | if t[i]==c then
54 | return i
55 | end
56 | end
57 | return -1
58 | end
59 |
60 | function find_end(t,si,c)
61 | for i=#t-si,1,-1 do
62 | if t[i]==c then
63 | return i
64 | end
65 | end
66 | return -1
67 | end
68 |
69 | function uplist()
70 | curdir="/"
71 | for i=1,#piledir do
72 | curdir..=piledir[i].."/"
73 | end
74 | curlist=dir(curdir)
75 | add(curlist,"../",1)
76 | sel=2
77 | end
78 |
79 | function get_start_dir()
80 | curlist={}
81 | local start=stat(124)
82 | local st=2
83 | while st<#start do
84 | local v=find(start,st,"/")
85 | if v<0 then
86 | v=#start+1
87 | end
88 | add(piledir,sub(start,st,v-1))
89 | st=v+1
90 | end
91 | end
92 |
93 | get_start_dir()
94 | uplist()
95 |
96 | function load_meta()
97 | if not meta_loaded then
98 | memset(0,0,0x2000)
99 | if #curlist>0 and sel<=#curlist then
100 | local dd=curlist[sel]
101 | extcmd("z8_load_metadata "..curdir..dd)
102 | end
103 | meta_loaded = true
104 | end
105 | end
106 |
107 | function back_folder()
108 | if #piledir>0 and piledir[#piledir]!=".." then
109 | deli(piledir,#piledir)
110 | end
111 | end
112 |
113 | function _update()
114 | if btnp(2) then sel-=1 meta_loaded=false end
115 | if btnp(3) then sel+=1 meta_loaded=false end
116 | if #curlist>0 then
117 | sel=(sel-1)%#curlist+1
118 | else
119 | sel=1
120 | end
121 | if btnp(5) then
122 | meta_loaded=false
123 | back_folder()
124 | uplist()
125 | end
126 | if btnp(4) then
127 | if #curlist>0 and sel<=#curlist then
128 | meta_loaded=false
129 | local dd=curlist[sel]
130 | local isdir=dd[#dd]=="/"
131 | if isdir then
132 | if dd=="../" then
133 | back_folder()
134 | else
135 | add(piledir,sub(dd,1,#dd-1))
136 | end
137 | uplist()
138 | else
139 | load(curdir..dd,"back to launcher")
140 | end
141 | end
142 | end
143 | end
144 |
145 | function bprint(t,x,y,c)
146 | print(t,x-1,y,1)
147 | print(t,x+1,y,1)
148 | print(t,x,y-1,1)
149 | print(t,x,y+1,1)
150 | print(t,x,y,c)
151 | end
152 |
153 | function _draw()
154 | load_meta()
155 |
156 | camera()
157 | cls(1)
158 | print(curdir,65,1,7)
159 | local base=min(max(sel-10,1),max(1,#curlist-18))
160 | for i=base,min(base+19,#curlist) do
161 | local dd=curlist[i]
162 | local isdir=dd[#dd]=="/"
163 | local c=isdir and 4 or 13
164 | if(i==sel) c=isdir and 8 or 12
165 | print(dd,65,(i-base+1)*6+1,c)
166 | end
167 |
168 | camera(64,0)
169 | rectfill(0,0,127,127,0)
170 | spr(0,0,0,16,16)
171 | bprint(stat(130),4,4,7)
172 | bprint(stat(131),4,10,7)
173 | end
174 | __gfx__
175 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
176 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
177 | 00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
178 | 00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
179 | 00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
180 | 00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
181 |
--------------------------------------------------------------------------------
/carts/rgbplasma.p8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samhocevar/zepto8/b2929a4fe31e5765ef66d7794edd11086b9638b4/carts/rgbplasma.p8.png
--------------------------------------------------------------------------------
/carts/rulez.p8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samhocevar/zepto8/b2929a4fe31e5765ef66d7794edd11086b9638b4/carts/rulez.p8.png
--------------------------------------------------------------------------------
/carts/shmup.p8:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samhocevar/zepto8/b2929a4fe31e5765ef66d7794edd11086b9638b4/carts/shmup.p8
--------------------------------------------------------------------------------
/carts/tunnel.p8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samhocevar/zepto8/b2929a4fe31e5765ef66d7794edd11086b9638b4/carts/tunnel.p8.png
--------------------------------------------------------------------------------
/carts/tut.p8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samhocevar/zepto8/b2929a4fe31e5765ef66d7794edd11086b9638b4/carts/tut.p8.png
--------------------------------------------------------------------------------
/carts/zepto8.p8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samhocevar/zepto8/b2929a4fe31e5765ef66d7794edd11086b9638b4/carts/zepto8.p8.png
--------------------------------------------------------------------------------
/carts/zepton.p8:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samhocevar/zepto8/b2929a4fe31e5765ef66d7794edd11086b9638b4/carts/zepton.p8
--------------------------------------------------------------------------------
/carts/zepton.p8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samhocevar/zepto8/b2929a4fe31e5765ef66d7794edd11086b9638b4/carts/zepton.p8.png
--------------------------------------------------------------------------------
/configure.ac:
--------------------------------------------------------------------------------
1 | dnl
2 | dnl Configure script for a Lol Engine project
3 | dnl
4 |
5 | AC_INIT([zepto8], [0.0])
6 |
7 | dnl
8 | dnl Standard autoconf setup and tools requirements
9 | dnl
10 |
11 | AC_PREREQ(2.69)
12 | AC_CONFIG_AUX_DIR(.auto)
13 | AC_CANONICAL_TARGET
14 | AM_INIT_AUTOMAKE([subdir-objects no-define tar-ustar silent-rules])
15 |
16 | AC_PROG_CXX
17 | LT_INIT
18 | LT_LANG([C++])
19 |
20 | AC_CONFIG_HEADERS([config.h])
21 |
22 | AC_CONFIG_FILES(
23 | [Makefile
24 | src/Makefile
25 | t/Makefile
26 | utils/Makefile
27 | carts/Makefile
28 | ])
29 |
30 | AC_CHECK_HEADERS(sys/select.h)
31 |
32 | ac_cv_have_readline=no
33 | AC_CHECK_LIB(readline, rl_callback_handler_install, [ac_cv_have_readline=yes])
34 | AM_CONDITIONAL(HAVE_READLINE, test "${ac_cv_have_readline}" != "no")
35 |
36 | dnl
37 | dnl Inherit all Lol Engine checks
38 | dnl
39 |
40 | LOL_AC_SUBPROJECT(src/3rdparty/lolengine)
41 |
42 | dnl
43 | dnl Perform the actual commands
44 | dnl
45 |
46 | AC_OUTPUT
47 |
48 |
--------------------------------------------------------------------------------
/doc/PICO-8-language.md:
--------------------------------------------------------------------------------
1 | ## Syntax
2 |
3 | PICO-8 uses Lua 5.2, however through various feature extensions its syntax has become closer to Lua 5.3.
4 |
5 | The following PICO-8 syntax is adapted from [the official Lua 5.3 manual](https://www.lua.org/manual/5.3/manual.html#9).
6 |
7 | ```ebnf
8 | chunk ::= block
9 |
10 | block ::= {stat} [retstat]
11 |
12 | stat ::= ";" |
13 | varlist "=" explist |
14 | var compop exp |
15 | functioncall |
16 | "?" [explist] |
17 | label |
18 | "break" |
19 | "goto" Name |
20 | "do" block "end" |
21 | "while" exp "do" block "end" |
22 | "while" "(" exp ")" block |
23 | "repeat" block "until" exp |
24 | "if" exp "then" block {"elseif" exp "then" block} ["else" block] "end" |
25 | "if" "(" exp ")" block ["else" block] |
26 | "for" Name "=" exp "," exp ["," exp] "do" block "end" |
27 | "for" namelist "in" explist "do" block "end" |
28 | "function" funcname funcbody |
29 | "local" "function" Name funcbody |
30 | "local" namelist ["=" explist]
31 |
32 | retstat ::= "return" [explist] [";"]
33 |
34 | label ::= "::" Name "::"
35 |
36 | funcname ::= Name {"." Name} [":" Name]
37 |
38 | varlist ::= var {"," var}
39 |
40 | var ::= Name | prefixexp "[" exp "]" | prefixexp "." Name
41 |
42 | namelist ::= Name {"," Name}
43 |
44 | explist ::= exp {"," exp}
45 |
46 | exp ::= "nil" | "false" | "true" | Numeral | LiteralString | "..." | functiondef |
47 | prefixexp | tableconstructor | exp binop exp | unop exp
48 |
49 | prefixexp ::= var | functioncall | "(" exp ")"
50 |
51 | functioncall ::= prefixexp args | prefixexp ":" Name args
52 |
53 | args ::= "(" [explist] ")" | tableconstructor | LiteralString
54 |
55 | functiondef ::= "function" funcbody
56 |
57 | funcbody ::= "(" [parlist] ")" block "end"
58 |
59 | parlist ::= namelist ["," "..."] | "..."
60 |
61 | tableconstructor ::= "{" [fieldlist] "}"
62 |
63 | fieldlist ::= field {fieldsep field} [fieldsep]
64 |
65 | field ::= "[" exp "]" "=" exp | Name "=" exp | exp
66 |
67 | fieldsep ::= "," | ";"
68 |
69 | binop ::= "+" | "-" | "*" | "/" | "^" | "%" | "\" | "^^" |
70 | "&" | "|" | ">>" | ">>>" | "<<" | ">><" | "<<>" | ".." |
71 | "<" | "<=" | ">" | ">=" | "==" | "~=" | "and" | "or"
72 |
73 | compop ::= "+=" | "-=" | "*=" | "/=" | "^=" | "%=" | "\=" | "^^=" |
74 | "&=" | "|=" | ">>=" | ">>>=" | "<<=" | ">><=" | "<<>=" | "..="
75 |
76 | unop ::= "-" | "not" | "#" | "~" | "@" | "%” | "$"
77 | ```
78 |
--------------------------------------------------------------------------------
/doc/ports.md:
--------------------------------------------------------------------------------
1 | # zepto8 ports to other platforms
2 |
3 | ## OpenDingux, GCW0, RG350, …
4 |
5 | ### Build toolchain
6 |
7 | First you need to get a recent enough toolchain (GCC 8.x or clang) and its dependencies. I have had
8 | success with [rg350-buildroot](https://github.com/tonyjih/RG350_buildroot):
9 |
10 | ```sh
11 | sudo apt install python unzip bc gcc-multilib subversion mercurial rsync libncurses-dev
12 | ```
13 |
14 | ```sh
15 | git clone https://github.com/tonyjih/RG350_buildroot ~/rg350
16 | cd ~/rg350
17 | make rg350_defconfig BR2_EXTERNAL=board/opendingux
18 | make menuconfig
19 | ```
20 |
21 | Make sure a recent version of GCC is selected: _Toolchain_ → _GCC Compiler Version_ → _gcc 9.x_
22 | then exit the configuration utility.
23 |
24 | Next, build the toolchain and the SDL libraries:
25 |
26 | ```sh
27 | export BR2_JLEVEL=0
28 | make toolchain
29 | make sdl2 sdl2_image sdl2_mixer
30 | ```
31 |
32 | For some reason the toolchain needs to be patched in the following way:
33 |
34 | ```sh
35 | echo 'namespace std { using ::cbrt, ::round, ::exp2; }' \
36 | >> ~/rg350/output/host/usr/mipsel-gcw0-linux-uclibc/include/c++/9.2.0/cmath
37 | ```
38 |
39 | ### Build zepto8
40 |
41 | Assuming `rg350` is located in `${HOME}`:
42 |
43 | ```sh
44 | ./bootstrap
45 |
46 | BUILDROOT="${HOME}/rg350"
47 | HOSTCONF="mipsel-gcw0-linux-uclibc"
48 | TOOLCHAIN="${BUILDROOT}/output/host/usr/bin"
49 | SYSROOT="${BUILDROOT}/output/host/usr/${HOSTCONF}/sysroot"
50 | PKG_CONFIG_LIBDIR="${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/share/pkgconfig"
51 | PKG_CONFIG_SYSROOT_DIR="$SYSROOT"
52 | ./configure --host="${HOSTCONF}" --with-sysroot="${SYSROOT}" \
53 | CC="${TOOLCHAIN}/${HOSTCONF}-gcc" CXX="${TOOLCHAIN}/${HOSTCONF}-g++" \
54 | CPPFLAGS="-I${SYSROOT}/usr/include"
55 |
56 | make -j
57 | ```
58 |
59 |
--------------------------------------------------------------------------------
/doc/z8tool.md:
--------------------------------------------------------------------------------
1 | # z8tool
2 |
3 | **z8tool** is a multi-purpose tool for working with PICO-8 cartridges.
4 |
5 | Usage: `z8tool `
6 |
7 | ## `z8tool stats`
8 |
9 | Outputs statistics about a cart.
10 |
11 | Usage:
12 |
13 | z8tool stats
14 |
15 | Where `` is any cartridge in P8 (`.p8`), PNG (`.p8.png`), JavaScript (`.js`) or binary format (`.bin`).
16 |
17 | Example:
18 |
19 | ```
20 | % z8tool stats celeste.p8
21 | file_name: celeste.p8
22 | token_count: 5921 [8192]
23 | code_size: 27484 [65535]
24 | compressed_code_size: 7903 [15616]
25 |
26 | %
27 | ```
28 |
29 | ## `z8tool listlua`
30 |
31 | Extract code from a cart, in text format.
32 |
33 | Usage:
34 |
35 | z8tool listlua
36 |
37 | Where `` is any cartridge in P8 (`.p8`), PNG (`.p8.png`), JavaScript (`.js`) or binary format (`.bin`).
38 |
39 | ## `z8tool printast`
40 |
41 | Not fully implemented yet.
42 |
43 | ## `z8tool convert`
44 |
45 | Convert carts beetween formats: P8 (`.p8`), PNG (`.p8.png`), JavaScript (`.js`) or binary format (`.bin`).
46 |
47 | Usage:
48 |
49 | z8tool convert