├── .clang-format
├── .github
├── FUNDING.yml
└── workflows
│ ├── build.yml
│ └── webapp.yml
├── .gitignore
├── .gitmodules
├── CMakeLists.txt
├── CODE_OF_CONDUCT.md
├── CommunityGuidelines.md
├── Dockerfile.dapper
├── LICENSE
├── README.md
├── SECURITY.md
├── assets.bat
├── build
├── android
│ ├── app
│ │ ├── build.gradle
│ │ ├── proguard-rules.pro
│ │ └── src
│ │ │ └── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ ├── com
│ │ │ │ └── nesbox
│ │ │ │ │ └── tic
│ │ │ │ │ ├── TIC.java
│ │ │ │ │ ├── TICDocumentsProvider.java
│ │ │ │ │ └── TICFileReceiver.java
│ │ │ └── org
│ │ │ │ └── libsdl
│ │ │ │ └── app
│ │ │ │ ├── HIDDevice.java
│ │ │ │ ├── HIDDeviceBLESteamController.java
│ │ │ │ ├── HIDDeviceManager.java
│ │ │ │ ├── HIDDeviceUSB.java
│ │ │ │ ├── SDL.java
│ │ │ │ ├── SDLActivity.java
│ │ │ │ ├── SDLAudioManager.java
│ │ │ │ ├── SDLControllerManager.java
│ │ │ │ └── SDLSurface.java
│ │ │ └── res
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ ├── my-release-key.keystore
│ ├── readme.md
│ └── settings.gradle
├── assets
│ ├── benchmark.tic.dat
│ ├── bpp.tic.dat
│ ├── car.tic.dat
│ ├── cart.png.dat
│ ├── config.tic.dat
│ ├── fenneldemo.tic.dat
│ ├── fire.tic.dat
│ ├── font.tic.dat
│ ├── janetdemo.tic.dat
│ ├── janetmark.tic.dat
│ ├── jsdemo.tic.dat
│ ├── jsmark.tic.dat
│ ├── luademo.tic.dat
│ ├── luamark.tic.dat
│ ├── moondemo.tic.dat
│ ├── moonmark.tic.dat
│ ├── music.tic.dat
│ ├── p3d.tic.dat
│ ├── palette.tic.dat
│ ├── pythondemo.tic.dat
│ ├── pythonmark.tic.dat
│ ├── quest.tic.dat
│ ├── rubydemo.tic.dat
│ ├── rubymark.tic.dat
│ ├── schemedemo.tic.dat
│ ├── schememark.tic.dat
│ ├── sfx.tic.dat
│ ├── squirreldemo.tic.dat
│ ├── squirrelmark.tic.dat
│ ├── tetris.tic.dat
│ ├── wasmdemo.tic.dat
│ ├── wasmmark.tic.dat
│ ├── wrendemo.tic.dat
│ └── wrenmark.tic.dat
├── baremetalpi
│ ├── Dockerfile
│ ├── Makefile
│ ├── README.md
│ ├── boot
│ │ ├── Makefile
│ │ └── config.txt
│ ├── circle.patch
│ └── toolchain.cmake
├── cart.png
├── html
│ ├── export.html
│ ├── index.html
│ └── prejs.js
├── janet
│ └── janetconf.h
├── libretro
│ └── merge_static.sh
├── linux
│ ├── com.tic80.TIC_80.metainfo.xml
│ ├── tic80.desktop.in
│ ├── tic80.png
│ └── tic80.xml
├── macosx
│ ├── tic80.icns
│ ├── tic80.plist.in
│ └── tic80pro.plist.in
├── mruby
│ ├── .gitignore
│ ├── tic.gembox
│ ├── tic_android.rb
│ └── tic_default.rb
├── n3ds
│ ├── Dockerfile
│ ├── README.md
│ ├── icon.png
│ └── romfs
│ │ └── kbd_display.png
├── rpi
│ ├── Dockerfile
│ └── toolchain.cmake
├── tools
│ ├── bin2txt.c
│ ├── cart2prj.c
│ ├── prj2cart.c
│ ├── wasmp2cart.c
│ └── xplode.c
├── webapp
│ ├── index.html
│ ├── serviceworker.js
│ ├── tic80-180.png
│ ├── tic80-192.png
│ ├── tic80-512.png
│ └── tic80.webmanifest
└── windows
│ ├── icon.ico
│ └── tic80.rc.in
├── cmake
├── argparse.cmake
├── blipbuf.cmake
├── core.cmake
├── fennel.cmake
├── gif.cmake
├── install.cmake
├── janet.cmake
├── libretro.cmake
├── lua.cmake
├── moon.cmake
├── mruby.cmake
├── n3ds.cmake
├── naett.cmake
├── png.cmake
├── pocketpy.cmake
├── quickjs.cmake
├── scheme.cmake
├── sdl.cmake
├── squirrel.cmake
├── studio.cmake
├── tools.cmake
├── version.cmake
├── wasm.cmake
├── wave.cmake
├── wren.cmake
├── zip.cmake
└── zlib.cmake
├── config.js
├── debug-linux.sh
├── debug-macos.sh
├── debug-windows.ps1
├── demos
├── benchmark.lua
├── bpp.lua
├── bunny
│ ├── janetmark.janet
│ ├── jsmark.js
│ ├── luamark.lua
│ ├── moonmark.moon
│ ├── pythonmark.py
│ ├── rubymark.rb
│ ├── schememark.scm
│ ├── squirrelmark.nut
│ ├── wasmmark
│ │ ├── README.md
│ │ ├── build.zig
│ │ ├── src
│ │ │ ├── main.zig
│ │ │ └── tic80.zig
│ │ ├── wasmmark.wasm
│ │ └── wasmmark.wasmp
│ └── wrenmark.wren
├── car.lua
├── fenneldemo.fnl
├── fire.lua
├── font.lua
├── janetdemo.janet
├── jsdemo.js
├── luademo.lua
├── moondemo.moon
├── music.lua
├── p3d.lua
├── palette.lua
├── pythondemo.py
├── quest.lua
├── rubydemo.rb
├── schemedemo.scm
├── sfx.lua
├── squirreldemo.nut
├── tetris.lua
├── wasm
│ ├── build.zig
│ ├── src
│ │ ├── main.zig
│ │ └── tic80.zig
│ ├── wasmdemo.wasm
│ └── wasmdemo.wasmp
└── wrendemo.wren
├── include
├── retro_endianness.h
├── retro_inline.h
├── tic80.h
├── tic80_config.h
└── tic80_types.h
├── src
├── api.h
├── api
│ ├── fennel.c
│ ├── janet.c
│ ├── js.c
│ ├── lua.c
│ ├── luaapi.c
│ ├── luaapi.h
│ ├── moonscript.c
│ ├── mruby.c
│ ├── parse_note.c
│ ├── python.c
│ ├── scheme.c
│ ├── squirrel.c
│ ├── wasm.c
│ └── wren.c
├── cart.c
├── cart.h
├── core
│ ├── altfont.inl
│ ├── core.c
│ ├── core.h
│ ├── draw.c
│ ├── draw_dep.c
│ ├── font.inl
│ ├── io.c
│ └── sound.c
├── defines.h
├── ext
│ ├── _kiss_fft_guts.h
│ ├── fft.c
│ ├── fft.h
│ ├── gif.c
│ ├── gif.h
│ ├── history.c
│ ├── history.h
│ ├── json.c
│ ├── json.h
│ ├── kiss_fft.c
│ ├── kiss_fft.h
│ ├── kiss_fft_log.h
│ ├── kiss_fftr.c
│ ├── kiss_fftr.h
│ ├── md5.c
│ ├── md5.h
│ ├── miniaudio.h
│ ├── png.c
│ └── png.h
├── fftdata.c
├── fftdata.h
├── script.c
├── script.h
├── studio
│ ├── anim.h
│ ├── config.c
│ ├── config.h
│ ├── editors
│ │ ├── code.c
│ │ ├── code.h
│ │ ├── map.c
│ │ ├── map.h
│ │ ├── music.c
│ │ ├── music.h
│ │ ├── sfx.c
│ │ ├── sfx.h
│ │ ├── sprite.c
│ │ ├── sprite.h
│ │ ├── world.c
│ │ └── world.h
│ ├── fs.c
│ ├── fs.h
│ ├── net.c
│ ├── net.h
│ ├── project.c
│ ├── project.h
│ ├── screens
│ │ ├── console.c
│ │ ├── console.h
│ │ ├── mainmenu.c
│ │ ├── mainmenu.h
│ │ ├── menu.c
│ │ ├── menu.h
│ │ ├── run.c
│ │ ├── run.h
│ │ ├── start.c
│ │ ├── start.h
│ │ ├── surf.c
│ │ └── surf.h
│ ├── studio.c
│ ├── studio.h
│ └── system.h
├── system
│ ├── baremetalpi
│ │ ├── customchargenerator.cpp
│ │ ├── customchargenerator.h
│ │ ├── customfont.h
│ │ ├── customscreen.cpp
│ │ ├── customscreen.h
│ │ ├── gamepads.cpp
│ │ ├── gamepads.h
│ │ ├── kernel.cpp
│ │ ├── kernel.h
│ │ ├── keycodes.h
│ │ ├── main.cpp
│ │ ├── stdlib_app.h
│ │ ├── syscore.h
│ │ ├── utils.cpp
│ │ └── utils.h
│ ├── libretro
│ │ ├── README.md
│ │ ├── libretro-common
│ │ │ └── include
│ │ │ │ └── libretro.h
│ │ ├── libretro_core_options.h
│ │ ├── libretro_core_options_intl.h
│ │ └── tic80_libretro.c
│ ├── n3ds
│ │ ├── keyboard.c
│ │ ├── keyboard.h
│ │ ├── main.c
│ │ ├── utils.c
│ │ └── utils.h
│ └── sdl
│ │ ├── kbdlabels.inl
│ │ ├── kbdlayout.inl
│ │ ├── keycodes.inl
│ │ ├── main.c
│ │ └── player.c
├── tic.c
├── tic.h
├── tic_assert.h
├── tilesheet.c
├── tilesheet.h
├── tools.c
├── tools.h
└── zip.c
├── templates
├── README.md
├── c
│ ├── Makefile
│ ├── README.md
│ ├── buildcart.sh
│ ├── buildwasm.sh
│ ├── src
│ │ ├── main.c
│ │ └── tic80.h
│ └── wasmdemo.wasmp
├── d
│ ├── Makefile
│ ├── README.md
│ ├── buildcart.sh
│ ├── buildwasm.sh
│ ├── dub.json
│ ├── src
│ │ ├── main.d
│ │ └── tic80.d
│ └── wasmdemo.wasmp
├── nim
│ ├── README.md
│ ├── cart.nimble
│ ├── config.nims
│ ├── demo
│ │ ├── bunny.tic
│ │ └── bunnymark.nim
│ └── src
│ │ ├── cart.nim
│ │ ├── cart.tic
│ │ └── cart
│ │ ├── internal.nim
│ │ └── tic80.nim
├── rust
│ ├── .cargo
│ │ └── config.toml
│ ├── .gitignore
│ ├── Cargo.toml
│ ├── README.md
│ └── src
│ │ ├── alloc.rs
│ │ ├── lib.rs
│ │ └── tic80.rs
└── zig
│ ├── README.md
│ ├── build.zig
│ ├── cart.wasmp
│ ├── run.sh
│ └── src
│ ├── main.zig
│ └── tic80.zig
├── tic80.sublime-project
├── tools
└── zig_sync
├── vendor
├── .gitignore
├── .gitmodules
├── fennel
│ ├── .gitignore
│ ├── Makefile
│ ├── README.md
│ ├── fennel.h
│ └── fennel.lua
└── s7
│ ├── README.md
│ ├── s7.c
│ ├── s7.h
│ └── s7.html
└── version.h.in
/.clang-format:
--------------------------------------------------------------------------------
1 | # Based on LLVM coding standards
2 | BasedOnStyle: LLVM
3 |
4 | # Use 4 spaces for indentation
5 | IndentWidth: 4
6 |
7 | # Use 4 spaces for continuations
8 | ContinuationIndentWidth: 4
9 |
10 | # Allow short functions to be on a single line
11 | AllowShortFunctionsOnASingleLine: false
12 |
13 | # Column limit for wrapping
14 | ColumnLimit: 0
15 |
16 | # Break before braces for functions and classes
17 | BreakBeforeBraces: Allman
18 |
19 | # Function declaration return type alignment
20 | AlignTrailingComments: true
21 | AlignAfterOpenBracket: true
22 | AlignEscapedNewlines: Left
23 | AlignOperands: true
24 | AlignConsecutiveAssignments: false
25 | AlignConsecutiveDeclarations: false
26 |
27 | # Control statements
28 | AllowShortIfStatementsOnASingleLine: true
29 | AllowShortLoopsOnASingleLine: false
30 | IndentCaseLabels: true
31 |
32 | # Pointer alignment
33 | PointerAlignment: Left
34 |
35 | # Space before and after operators
36 | SpaceBeforeParens: ControlStatements
37 | SpaceBeforeRangeBasedForLoopColon: true
38 | SpacesBeforeTrailingComments: 1
39 | SpacesInCStyleCastParentheses: false
40 | SpacesInContainerLiterals: false
41 | SpacesInParentheses: false
42 |
43 | # Namespace indentation
44 | NamespaceIndentation: None
45 |
46 | # Empty line before access modifiers in classes
47 | EmptyLineBeforeAccessModifier: LogicalBlock
48 |
49 | # Add space between statements
50 | SpaceBeforeAssignmentOperators: true
51 |
52 | # No space before opening brackets
53 | SpaceBeforeSquareBrackets: false
54 |
55 | # No space before or after '<' and '>' in template argument lists
56 | SpacesInAngles: false
57 |
58 | # Handling include statements
59 | IncludeBlocks: Preserve
60 | IncludeCategories:
61 | - Regex: '^<.*\.h>'
62 | Priority: 1
63 | - Regex: '^".*\.h"'
64 | Priority: 2
65 |
66 | # Keep empty lines at the start of blocks
67 | KeepEmptyLinesAtTheStartOfBlocks: true
68 |
69 | # Indentation style for preprocessor directives
70 | IndentPPDirectives: AfterHash
71 |
72 | # Wrap comments to fit within column limit
73 | ReflowComments: false
74 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [nesbox]
4 | # patreon: # Replace with a single Patreon username
5 | # open_collective: # Replace with a single Open Collective username
6 | # ko_fi: # Replace with a single Ko-fi username
7 | # tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | # community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | # liberapay: # Replace with a single Liberapay username
10 | # issuehunt: # Replace with a single IssueHunt username
11 | # otechie: # Replace with a single Otechie username
12 | # lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13 | # custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
14 |
--------------------------------------------------------------------------------
/.github/workflows/webapp.yml:
--------------------------------------------------------------------------------
1 | name: WebApp
2 |
3 | on:
4 | release:
5 | types: [published]
6 |
7 | env:
8 | BUILD_TYPE: MinSizeRel
9 |
10 | jobs:
11 | webapp:
12 | runs-on: ubuntu-latest
13 | steps:
14 | - name: Setup Emscripten
15 | uses: mymindstorm/setup-emsdk@v7
16 |
17 | - name: Checkout
18 | uses: actions/checkout@v2
19 | with:
20 | submodules: recursive
21 | fetch-depth: 0
22 |
23 | - name: Build
24 | run: |
25 | cd build
26 | emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=$BUILD_TYPE ..
27 | cmake --build . --config $BUILD_TYPE --parallel
28 | cp bin/tic80.js webapp/tic80.js
29 | cp bin/tic80.wasm webapp/tic80.wasm
30 |
31 | - name: Deploy
32 | uses: JamesIves/github-pages-deploy-action@4.1.3
33 | with:
34 | branch: webapp
35 | folder: build/webapp
36 |
--------------------------------------------------------------------------------
/CommunityGuidelines.md:
--------------------------------------------------------------------------------
1 | ## TIC-80 Community Guidelines
2 |
3 | We welcome everyone on the TIC-80 community, regardless of age and programming level, unless they are not following these guidelines. Help us keep your, our, and other's properties safe by following these Community Guidelines:
4 | ### Be respectful.
5 | We are all different. Try not to distrupt other people's rights.
6 | ### Don't place strong violence in-game.
7 | Do not place adult content, especially strong violence or strong language, in a TIC-80 game. This would be too inappropriate content. **The violence and bad language level should be between none to minimally strong.**
8 | ### Keep personal info private.
9 | Do not share emails, DOBs (dates of births), people's ages, and do not link to chats except on encrypted secure websites.
10 | ### Be friendly.
11 | It is important that all of our user generated content has no content that is only suitable for adults. If anything on TIC-80 you find looks too inappropriate for under 18s, please let us know.
12 |
--------------------------------------------------------------------------------
/Dockerfile.dapper:
--------------------------------------------------------------------------------
1 | FROM ubuntu:18.04
2 | RUN apt-get update && apt-get install -y g++ git cmake libgtk-3-dev \
3 | libglvnd-dev libglu1-mesa-dev freeglut3-dev libasound2-dev
4 | WORKDIR ${DAPPER_SOURCE:-/source}
5 | ENV DAPPER_OUTPUT build/bin
6 | ENTRYPOINT ["sh", "-c", "cd build; cmake .. && make -j4"]
7 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Vadim Grigoruk
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | ## Supported Versions
4 |
5 | Only the latest releases are supported and may receive security updates.
6 | If you aren't using the latest stable version, please upgrade.
7 |
8 | | Version | Status | Supported |
9 | | ---------- | -------- | ------------------ |
10 | | 1.0.x-dev | Alpha | :white_check_mark: |
11 | | 0.90.x | Stable | :white_check_mark: |
12 | | 0.80.x | | :x: |
13 | | 0.70.x | Obsolete | :x: |
14 | | < 0.70 | Obsolete | :x: |
15 |
16 | ## Reporting a Vulnerability
17 |
18 | Please open a [new GitHub issue](https://github.com/nesbox/TIC-80/issues/new) to report a vulnerability.
19 |
20 | If you feel your vulnerability is serious and should not
21 | be publically disclosed you may reach out via email:
22 |
23 | grigoruk@gmail.com
24 |
--------------------------------------------------------------------------------
/build/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY');
2 | def buildAsApplication = !buildAsLibrary
3 | if (buildAsApplication) {
4 | apply plugin: 'com.android.application'
5 | }
6 | else {
7 | apply plugin: 'com.android.library'
8 | }
9 |
10 | android {
11 | compileSdkVersion 31
12 | defaultConfig {
13 | if (buildAsApplication) {
14 | applicationId "com.nesbox.tic"
15 | }
16 | minSdkVersion 24
17 | targetSdkVersion 31
18 | versionCode 10200
19 | versionName "1.02.00"
20 | ndk {
21 | abiFilters 'arm64-v8a', 'armeabi-v7a'
22 | }
23 | externalNativeBuild {
24 | ndkBuild {
25 | arguments "APP_PLATFORM=android-31"
26 | }
27 | cmake {
28 | arguments "-DBUILD_WITH_RUBY=OFF", "-DBUILD_PRO=Off", "-DCMAKE_BUILD_TYPE=Release", "-DBUILD_WITH_ALL=ON"
29 | }
30 | }
31 | }
32 |
33 | signingConfigs {
34 |
35 | release {
36 | storeFile file(RELEASE_STORE_FILE)
37 | storePassword RELEASE_STORE_PASSWORD
38 | keyAlias RELEASE_KEY_ALIAS
39 | keyPassword RELEASE_KEY_PASSWORD
40 | }
41 | }
42 |
43 | buildTypes {
44 | release {
45 | minifyEnabled false
46 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
47 | signingConfig signingConfigs.release
48 | }
49 | }
50 | if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) {
51 | sourceSets.main {
52 | jniLibs.srcDir 'libs'
53 | }
54 | externalNativeBuild {
55 | cmake {
56 | path '../../../CMakeLists.txt'
57 | }
58 | }
59 | }
60 |
61 | lintOptions {
62 | abortOnError false
63 | }
64 |
65 | if (buildAsLibrary) {
66 | libraryVariants.all { variant ->
67 | variant.outputs.each { output ->
68 | def outputFile = output.outputFile
69 | if (outputFile != null && outputFile.name.endsWith(".aar")) {
70 | def fileName = "org.libsdl.app.aar";
71 | output.outputFile = new File(outputFile.parent, fileName);
72 | }
73 | }
74 | }
75 | }
76 | }
77 |
78 | dependencies {
79 | implementation fileTree(include: ['*.jar'], dir: 'libs')
80 | }
81 |
--------------------------------------------------------------------------------
/build/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in [sdk]/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/build/android/app/src/main/java/com/nesbox/tic/TIC.java:
--------------------------------------------------------------------------------
1 | package com.nesbox.tic;
2 |
3 | import org.libsdl.app.SDLActivity;
4 |
5 | public class TIC extends SDLActivity
6 | {
7 | @Override
8 | protected String[] getLibraries() {
9 | return new String[] { "tic80" };
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/build/android/app/src/main/java/org/libsdl/app/HIDDevice.java:
--------------------------------------------------------------------------------
1 | package org.libsdl.app;
2 |
3 | import android.hardware.usb.UsbDevice;
4 |
5 | interface HIDDevice
6 | {
7 | public int getId();
8 | public int getVendorId();
9 | public int getProductId();
10 | public String getSerialNumber();
11 | public int getVersion();
12 | public String getManufacturerName();
13 | public String getProductName();
14 | public UsbDevice getDevice();
15 | public boolean open();
16 | public int sendFeatureReport(byte[] report);
17 | public int sendOutputReport(byte[] report);
18 | public boolean getFeatureReport(byte[] report);
19 | public void setFrozen(boolean frozen);
20 | public void close();
21 | public void shutdown();
22 | }
23 |
--------------------------------------------------------------------------------
/build/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/build/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/build/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/build/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/build/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/build/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/build/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/build/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/build/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/build/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/build/android/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/build/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | TIC-80
4 |
5 |
--------------------------------------------------------------------------------
/build/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/build/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | mavenCentral()
6 | google()
7 | }
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.0.3'
10 |
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | mavenCentral()
19 | google()
20 | }
21 | }
22 |
23 | task clean(type: Delete) {
24 | delete rootProject.buildDir
25 | }
26 |
--------------------------------------------------------------------------------
/build/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
19 | RELEASE_STORE_FILE=../my-release-key.keystore
20 | RELEASE_STORE_PASSWORD=123456
21 | RELEASE_KEY_ALIAS=alias_name
22 | RELEASE_KEY_PASSWORD=123456
23 |
--------------------------------------------------------------------------------
/build/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/build/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/build/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Nov 11 18:20:34 PST 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/build/android/my-release-key.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/build/android/my-release-key.keystore
--------------------------------------------------------------------------------
/build/android/readme.md:
--------------------------------------------------------------------------------
1 | # USEFUL ADB COMMANDS
2 |
3 | ## BUILD IN DOCKER
4 | ```
5 | winpty docker exec -it nice_goldwasser bash -c "cd /tic80/build/android && ./gradlew assembleRelease" && adb install -r app/build/outputs/apk/arm8/release/app-arm8-release.apk && adb shell am start -n com.nesbox.tic/com.nesbox.tic.TIC
6 | ```
7 |
8 | ## INSTALL APP AND RUN
9 | ```
10 | release: adb install -r app/build/outputs/apk/arm8/release/app-arm8-release.apk && adb shell am start -n com.nesbox.tic/com.nesbox.tic.TIC
11 |
12 | debug: adb install -r app/build/outputs/apk/arm8/debug/app-arm8-debug.apk && adb shell am start -n com.nesbox.tic/com.nesbox.tic.TIC
13 | ```
14 |
15 | ## VIEW APP LOG
16 | ```
17 | adb logcat --pid `adb shell pidof com.nesbox.tic`
18 | ```
19 |
20 | ## STOP APP
21 | ```
22 | adb shell am force-stop com.nesbox.tic
23 | ```
24 |
--------------------------------------------------------------------------------
/build/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/build/assets/jsdemo.tic.dat:
--------------------------------------------------------------------------------
1 | 0x78, 0xda, 0xed, 0x52, 0xcd, 0x6a, 0xdb, 0x40, 0x10, 0x5e, 0xf7, 0xe7, 0xe0, 0x3d, 0x14, 0xfa, 0x06, 0xd3, 0x40, 0x61, 0xb7, 0x56, 0x62, 0x49, 0x36, 0xa1, 0x35, 0xb8, 0x97, 0xb6, 0xd0, 0x80, 0x4b, 0xa0, 0x04, 0x7a, 0x56, 0x94, 0x75, 0xbc, 0xad, 0x22, 0x19, 0xed, 0xda, 0xb5, 0x69, 0x72, 0xd7, 0xa1, 0xd7, 0xde, 0x7b, 0x2c, 0x42, 0x0f, 0xb1, 0xe7, 0xb2, 0xe4, 0x49, 0x8c, 0x9e, 0xa1, 0xb3, 0x9b, 0xc4, 0xe4, 0x50, 0xda, 0x43, 0x0e, 0xbd, 0x74, 0x56, 0xc3, 0xcc, 0xb7, 0xdf, 0xcc, 0xce, 0xc0, 0xa7, 0xc7, 0x84, 0x90, 0xce, 0xf7, 0x7b, 0xe4, 0x6f, 0x76, 0x69, 0xd1, 0xaa, 0xaa, 0x6a, 0xea, 0xba, 0x6e, 0x5c, 0x44, 0xd8, 0x58, 0xb3, 0x75, 0x6b, 0x37, 0x6d, 0x55, 0xd9, 0xb6, 0xae, 0x4d, 0x5b, 0xfd, 0x30, 0xad, 0x6d, 0x8c, 0x35, 0x8d, 0x31, 0x37, 0xfe, 0xfb, 0x7e, 0xfb, 0xc7, 0x7e, 0x7b, 0xab, 0x9f, 0xfc, 0xb7, 0x7f, 0x6a, 0x5e, 0x2b, 0xa7, 0x9d, 0x3f, 0x3f, 0x7d, 0xfe, 0x15, 0x75, 0xb4, 0xc4, 0x58, 0xd4, 0xf6, 0xd2, 0x36, 0xc4, 0xa2, 0x76, 0x9b, 0x06, 0xf5, 0xab, 0xaf, 0xdd, 0xe9, 0x49, 0xcc, 0xa6, 0xb5, 0xb6, 0x6d, 0xef, 0xda, 0xdf, 0x7d, 0x79, 0xb7, 0xfd, 0xef, 0x3f, 0x78, 0xd4, 0xc1, 0x3f, 0xfd, 0xe1, 0xb7, 0x0e, 0xe9, 0xf7, 0x41, 0x4b, 0x9d, 0x89, 0x11, 0x00, 0x9c, 0x26, 0x67, 0xe2, 0x0a, 0x51, 0xbc, 0x4e, 0x16, 0x7a, 0x56, 0x94, 0xa3, 0xeb, 0xeb, 0x13, 0xb1, 0x14, 0x59, 0x31, 0x17, 0x65, 0x00, 0xe2, 0x2c, 0x91, 0x19, 0x06, 0x9d, 0xee, 0xb9, 0xba, 0x13, 0xa1, 0x52, 0xd7, 0x0d, 0x0a, 0xcb, 0xb5, 0x87, 0xa5, 0x9c, 0x6b, 0x59, 0xe4, 0x8e, 0x55, 0x52, 0xfb, 0xb7, 0xe1, 0xb3, 0x38, 0x76, 0x39, 0x64, 0x32, 0xff, 0xe4, 0x88, 0x4c, 0xa6, 0x22, 0x57, 0xc8, 0xbd, 0x3b, 0x38, 0x82, 0xc9, 0x15, 0x00, 0x96, 0xce, 0x92, 0xfc, 0x14, 0x97, 0x98, 0x49, 0x05, 0xba, 0x80, 0x75, 0xb1, 0x28, 0x6f, 0x2a, 0xa1, 0x98, 0x42, 0x3a, 0x2b, 0x10, 0x70, 0xd7, 0xbf, 0x14, 0xa5, 0xc2, 0x19, 0x23, 0x08, 0xf7, 0x22, 0x3f, 0xc8, 0x4f, 0xc5, 0x51, 0x1f, 0x15, 0xa5, 0xcb, 0xa4, 0x04, 0x3d, 0x0e, 0x7d, 0x5c, 0x8d, 0x5f, 0xec, 0xfb, 0x64, 0x3d, 0x8e, 0x87, 0x94, 0x4e, 0x17, 0x79, 0xea, 0x96, 0x83, 0xa3, 0x83, 0x57, 0x8c, 0xd3, 0x2f, 0xb4, 0x2b, 0xa7, 0xec, 0x58, 0xe7, 0x2c, 0xe4, 0x7c, 0xbd, 0xbb, 0xbb, 0x85, 0x11, 0xc2, 0x5e, 0x6f, 0x0b, 0x63, 0xce, 0x57, 0xb7, 0xd8, 0x01, 0x42, 0x64, 0x69, 0x37, 0xcd, 0x14, 0x8b, 0x06, 0x9c, 0x76, 0xd5, 0xbc, 0x64, 0x51, 0x8f, 0x31, 0xfd, 0x74, 0x3f, 0xe4, 0xfd, 0x41, 0x78, 0x1e, 0xf2, 0x67, 0x71, 0xb0, 0x0a, 0xd6, 0x41, 0x34, 0x0c, 0x06, 0x41, 0x88, 0x27, 0x0e, 0x62, 0x2c, 0x9c, 0x97, 0x32, 0xd7, 0x6c, 0xe7, 0xed, 0x9b, 0xc9, 0xe4, 0x10, 0x3e, 0x1c, 0xbe, 0x9f, 0xbc, 0x7e, 0xb2, 0x13, 0x3c, 0x1f, 0xe2, 0x87, 0xa4, 0xc6, 0x47, 0x2f, 0xe8, 0x2f, 0x66, 0xf0, 0x2c, 0x9d,
--------------------------------------------------------------------------------
/build/assets/luademo.tic.dat:
--------------------------------------------------------------------------------
1 | 0x78, 0xda, 0xed, 0x52, 0xc1, 0x4e, 0xdb, 0x40, 0x10, 0xdd, 0x40, 0x7b, 0xc8, 0x1e, 0x90, 0xf8, 0x83, 0x01, 0xa9, 0x92, 0xd3, 0x38, 0xc1, 0x76, 0x22, 0x54, 0x22, 0x99, 0x0b, 0x54, 0x2a, 0x52, 0xaa, 0x48, 0x15, 0x12, 0x67, 0xe3, 0x6c, 0xc8, 0xaa, 0x66, 0x1d, 0xd9, 0x1b, 0x88, 0xff, 0xc0, 0x07, 0x3e, 0x82, 0x23, 0xb2, 0x7c, 0xec, 0x07, 0xec, 0x19, 0xad, 0xf8, 0x92, 0xc8, 0xdf, 0xc0, 0xac, 0x09, 0xd0, 0x56, 0x15, 0x1c, 0x38, 0xf4, 0xc2, 0xac, 0x47, 0xbb, 0x6f, 0xdf, 0xbc, 0x9d, 0x91, 0x9e, 0x37, 0x09, 0x21, 0x8d, 0xeb, 0x35, 0xf2, 0x5a, 0xdc, 0x69, 0x8c, 0x3c, 0xcf, 0xcb, 0xa2, 0x28, 0x4a, 0xb3, 0x23, 0x2c, 0xb5, 0x7a, 0x4a, 0xad, 0x97, 0x55, 0x9e, 0xeb, 0xaa, 0x28, 0x54, 0x95, 0xdf, 0xa8, 0x4a, 0x97, 0x4a, 0xab, 0x52, 0xa9, 0xc7, 0xfc, 0xb7, 0x5e, 0xbf, 0xa8, 0xd7, 0xbf, 0xe9, 0xc9, 0x7b, 0xfc, 0xd7, 0xa8, 0xbd, 0x32, 0xde, 0xd5, 0xeb, 0xb6, 0x3e, 0x5f, 0xa1, 0x8f, 0x9a, 0x28, 0x8d, 0xde, 0xde, 0xe9, 0x92, 0x68, 0xf4, 0x6e, 0x59, 0xa2, 0x7f, 0xc5, 0x2a, 0x8d, 0x9f, 0x44, 0x2d, 0x2b, 0xad, 0xab, 0xea, 0xad, 0xfa, 0xe6, 0xfe, 0xdb, 0xe6, 0x5f, 0xff, 0xb0, 0xd1, 0xc0, 0x3f, 0xfd, 0xe3, 0xaf, 0x06, 0xe9, 0x74, 0x40, 0x72, 0x19, 0xb1, 0x01, 0x00, 0x9c, 0x05, 0xe7, 0xec, 0x01, 0x51, 0xbc, 0x0e, 0xe6, 0x72, 0x1a, 0x27, 0x83, 0xd5, 0xf5, 0x98, 0x5d, 0xb0, 0x28, 0x9e, 0xb1, 0xc4, 0x06, 0x76, 0x1e, 0xf0, 0x08, 0x37, 0x19, 0x76, 0x4d, 0xdd, 0x98, 0xa5, 0xa1, 0x51, 0x43, 0x8a, 0xe5, 0xb2, 0x86, 0x09, 0x9f, 0x49, 0x1e, 0x0b, 0xc3, 0xa6, 0x5c, 0xd6, 0x6f, 0xc3, 0x25, 0x3b, 0x35, 0x67, 0x88, 0xb8, 0xf8, 0x69, 0x88, 0x88, 0x87, 0x4c, 0xa4, 0xc8, 0x7d, 0x3f, 0x3a, 0x86, 0xe1, 0x03, 0x00, 0x2b, 0x9c, 0x06, 0xe2, 0x0c, 0x87, 0x98, 0xf2, 0x14, 0x64, 0x0c, 0x59, 0x3c, 0x4f, 0x1e, 0x2b, 0x21, 0x9e, 0x40, 0x38, 0x8d, 0x11, 0xb4, 0x8c, 0xfe, 0x82, 0x25, 0x29, 0xf6, 0x18, 0x80, 0xd3, 0x75, 0xeb, 0x46, 0x75, 0x57, 0x6c, 0x15, 0xcd, 0x03, 0x4a, 0xa5, 0xef, 0xd0, 0x85, 0xbf, 0xb7, 0x4b, 0x33, 0xdf, 0xeb, 0x53, 0x3a, 0x99, 0x8b, 0xd0, 0x4c, 0x04, 0xc7, 0x47, 0x07, 0x56, 0x8b, 0xd2, 0x26, 0x9f, 0xc0, 0xa9, 0x14, 0x96, 0xd3, 0xc2, 0x56, 0x4c, 0x40, 0xe6, 0x67, 0x1d, 0x17, 0x98, 0x18, 0x3f, 0x31, 0xee, 0x33, 0xd3, 0xfe, 0x93, 0xf1, 0x56, 0xcc, 0xc2, 0x5f, 0xfc, 0xa5, 0xe9, 0x3d, 0x33, 0x2b, 0x0d, 0x6d, 0x86, 0x51, 0x6a, 0xb9, 0xbd, 0x16, 0x6d, 0xa6, 0xb3, 0xc4, 0x72, 0xdb, 0xf2, 0xd3, 0xae, 0xb3, 0xb3, 0xd3, 0x73, 0x3e, 0x7b, 0xf6, 0xc2, 0xce, 0x6c, 0xb7, 0x6f, 0xf7, 0x6c, 0x07, 0x97, 0x67, 0x7b, 0x58, 0x33, 0x4b, 0xb8, 0x90, 0xd6, 0xf6, 0xb7, 0xaf, 0xc3, 0xe1, 0x08, 0x4e, 0x46, 0x3f, 0x86, 0x87, 0x5b, 0xdb, 0xf6, 0x97, 0x3e, 0x7e, 0x48, 0x4a, 0x5f, 0xb6, 0x5d, 0x6a, 0x5e, 0xbd, 0x07, 0xd5, 0x6c, 0x37, 0xdf,
--------------------------------------------------------------------------------
/build/assets/moondemo.tic.dat:
--------------------------------------------------------------------------------
1 | 0x78, 0xda, 0xed, 0x52, 0xcd, 0x4a, 0xc3, 0x40, 0x10, 0xde, 0xfa, 0x73, 0x30, 0x07, 0xc1, 0x37, 0x18, 0x0b, 0x42, 0xab, 0xa9, 0x26, 0x6d, 0x29, 0x5a, 0x48, 0x2f, 0x2a, 0x28, 0x54, 0x0a, 0x52, 0xf0, 0xdc, 0xa6, 0xab, 0x5d, 0x4c, 0x93, 0x90, 0xac, 0xb5, 0x79, 0x83, 0x1c, 0x7c, 0x01, 0x6f, 0x1e, 0x25, 0xe4, 0x21, 0xf6, 0x2c, 0x4b, 0x9f, 0xa4, 0xe4, 0x19, 0x9c, 0x4d, 0xad, 0x3f, 0x20, 0x7a, 0xe8, 0xc1, 0x8b, 0xb3, 0x19, 0x76, 0xe7, 0x9b, 0xf9, 0x66, 0x06, 0xbe, 0x6c, 0x11, 0x42, 0x0a, 0x4f, 0x2b, 0xe4, 0x37, 0x9b, 0x4a, 0xb4, 0x38, 0x8e, 0xd3, 0x24, 0x49, 0x52, 0x75, 0x63, 0x98, 0x4a, 0xf1, 0xee, 0x52, 0xce, 0xb2, 0x38, 0x96, 0x59, 0x92, 0x88, 0x2c, 0x7e, 0x16, 0x99, 0x4c, 0x85, 0x14, 0xa9, 0x10, 0x0b, 0xff, 0x9e, 0x2f, 0x7f, 0xe4, 0xcb, 0x4f, 0x7c, 0xf2, 0x6f, 0x7f, 0x6a, 0xb9, 0x56, 0x4a, 0xbb, 0xfc, 0xbc, 0xe4, 0xef, 0x07, 0xd4, 0x51, 0x12, 0x21, 0x51, 0xdb, 0xa9, 0x4c, 0x89, 0x44, 0xed, 0x66, 0x29, 0xea, 0x97, 0xbc, 0xb9, 0xd2, 0x93, 0x88, 0x59, 0x26, 0x65, 0x96, 0x2d, 0xcb, 0xdf, 0x68, 0x2d, 0xb7, 0xff, 0xea, 0xda, 0x66, 0x01, 0xff, 0xf4, 0xf5, 0xc7, 0x02, 0xa9, 0x54, 0x80, 0x33, 0xee, 0xd0, 0x26, 0x00, 0xdc, 0xf4, 0x46, 0x74, 0x1e, 0x69, 0x08, 0xf7, 0xee, 0xf8, 0xd0, 0x0b, 0x9a, 0x6f, 0xf0, 0x80, 0x8e, 0xa9, 0xe3, 0xf9, 0x34, 0xd0, 0x81, 0x8e, 0x7a, 0xcc, 0xc1, 0x8b, 0xdb, 0xfb, 0xaa, 0x6e, 0x40, 0x43, 0x5b, 0xb1, 0x21, 0xc4, 0x72, 0x9e, 0x87, 0x01, 0xf3, 0x39, 0xf3, 0x5c, 0x95, 0x0d, 0x19, 0xcf, 0x7b, 0xc3, 0x3d, 0xed, 0xab, 0x37, 0x38, 0xcc, 0xbd, 0x55, 0x09, 0x87, 0xd9, 0xd4, 0x0d, 0x31, 0x77, 0x71, 0xde, 0x85, 0xf6, 0x3c, 0x80, 0x92, 0x3d, 0xec, 0xb9, 0x37, 0xb8, 0xc4, 0x90, 0x85, 0xc0, 0x3d, 0x88, 0xbc, 0xbb, 0x60, 0x51, 0x09, 0xde, 0x35, 0xd8, 0x43, 0x0f, 0x83, 0xb2, 0xe2, 0x8f, 0x69, 0x10, 0xe2, 0x8c, 0x26, 0x18, 0xfb, 0x66, 0x3e, 0x28, 0x9f, 0x8a, 0xa3, 0x46, 0x1e, 0x4e, 0xd6, 0xb8, 0x65, 0x68, 0x13, 0xeb, 0xa8, 0xa1, 0x45, 0x56, 0xb5, 0xae, 0x69, 0x74, 0xe2, 0xab, 0xe5, 0xba, 0xe7, 0xc7, 0x56, 0xa5, 0xa5, 0x01, 0xb0, 0x6b, 0xe8, 0x73, 0x17, 0x0c, 0x4d, 0xad, 0x16, 0x55, 0x2c, 0xf3, 0x03, 0x33, 0xe7, 0xd8, 0xde, 0x67, 0xac, 0x9a, 0x63, 0x93, 0x2f, 0x75, 0xb5, 0x39, 0xa6, 0xea, 0xf0, 0x65, 0x3b, 0x21, 0x98, 0x0a, 0x0a, 0xfd, 0x00, 0xcc, 0xbd, 0x12, 0xdf, 0x69, 0x18, 0xe5, 0x83, 0x83, 0x9a, 0xb1, 0x5b, 0xd5, 0x27, 0x7a, 0xa4, 0x9b, 0x75, 0xbd, 0xa6, 0x1b, 0x78, 0xaa, 0xba, 0x6a, 0xe6, 0x07, 0xcc, 0xe5, 0x50, 0x3c, 0x3b, 0x6d, 0xb7, 0x3b, 0x70, 0xd5, 0xb9, 0x6c, 0x9f, 0x6c, 0x17, 0xf5, 0xc3, 0x3a, 0x7e, 0x98, 0xe4, 0xaa, 0xe7, 0x2b, 0x1e, 0x39, 0x29, 0xef,
--------------------------------------------------------------------------------
/build/assets/pythondemo.tic.dat:
--------------------------------------------------------------------------------
1 | 0x78, 0xda, 0xed, 0x52, 0xcd, 0x6a, 0xdc, 0x30, 0x10, 0xf6, 0xf6, 0xe7, 0x50, 0x1d, 0x0a, 0x7d, 0x83, 0x69, 0x42, 0xc1, 0x9b, 0xb8, 0x89, 0xed, 0x5d, 0x42, 0x6b, 0x70, 0x2f, 0x69, 0xa0, 0x81, 0x2d, 0x81, 0x12, 0xe8, 0xd9, 0xeb, 0xd5, 0xae, 0x45, 0x14, 0xcb, 0x58, 0x4a, 0xb2, 0x7e, 0x03, 0x1f, 0xfa, 0x10, 0x39, 0x16, 0xe3, 0x87, 0x10, 0x39, 0x06, 0x91, 0x27, 0x59, 0xfc, 0x0c, 0x1d, 0x39, 0xc9, 0xb2, 0x87, 0xd2, 0x1e, 0x72, 0xe8, 0xa5, 0x63, 0x0f, 0x9a, 0xef, 0x9b, 0x19, 0xcd, 0xc0, 0xa7, 0x37, 0x8e, 0xe3, 0x0c, 0xae, 0x9f, 0x39, 0x7f, 0xb3, 0x3b, 0x83, 0x56, 0xd7, 0x75, 0xdb, 0x34, 0x4d, 0x6b, 0x4f, 0x84, 0xad, 0xd1, 0x6b, 0x37, 0x66, 0xd5, 0xd5, 0xb5, 0xe9, 0x9a, 0x46, 0x77, 0xf5, 0x4f, 0xdd, 0x99, 0x56, 0x1b, 0xdd, 0x6a, 0xfd, 0xe8, 0xbf, 0xef, 0x37, 0x7f, 0xec, 0x37, 0x1b, 0xfd, 0xce, 0x7f, 0xfb, 0xa7, 0xd6, 0x6b, 0x65, 0xb5, 0xeb, 0xbf, 0xdb, 0x3e, 0xfe, 0x81, 0x3a, 0x1a, 0x47, 0x1b, 0xd4, 0xf6, 0xce, 0xb4, 0x8e, 0x41, 0xed, 0x56, 0x2d, 0xea, 0xd7, 0x3c, 0xb8, 0xd5, 0xd3, 0xd1, 0xab, 0xce, 0x98, 0xae, 0x7b, 0x6a, 0xff, 0xab, 0x4f, 0x4f, 0xdb, 0xff, 0xf9, 0x8b, 0xd7, 0x03, 0x7c, 0xe9, 0x2f, 0x6f, 0x06, 0xce, 0x36, 0x28, 0xa6, 0x38, 0x8d, 0x00, 0x60, 0x91, 0x9c, 0xd3, 0x7b, 0x44, 0xb6, 0x21, 0xb9, 0x50, 0x99, 0x28, 0xa3, 0x07, 0x76, 0x46, 0x2f, 0x29, 0x17, 0x05, 0x2d, 0xa5, 0x07, 0xf4, 0x3c, 0x61, 0x1c, 0x0f, 0x95, 0xee, 0x61, 0xdd, 0x8c, 0xca, 0xd4, 0x36, 0x83, 0xc4, 0x72, 0xd5, 0xc3, 0x92, 0x15, 0x8a, 0x89, 0x1c, 0x93, 0x92, 0xa9, 0xfe, 0x66, 0xb8, 0xa2, 0x53, 0x1b, 0x03, 0x67, 0xf9, 0x19, 0xf2, 0x9c, 0xa5, 0x34, 0x97, 0x98, 0xfa, 0x7a, 0x7c, 0x0a, 0x93, 0x7b, 0x00, 0x6e, 0x9a, 0x25, 0xf9, 0x02, 0x37, 0xc8, 0x98, 0x04, 0x25, 0xa0, 0x12, 0x17, 0xe5, 0x63, 0x25, 0x88, 0x39, 0xa4, 0x99, 0x40, 0x30, 0xc4, 0xf6, 0x4b, 0xdc, 0x03, 0x07, 0x44, 0xe0, 0xef, 0x05, 0x76, 0x4a, 0x3f, 0x11, 0xe7, 0x14, 0x15, 0xee, 0x9c, 0x13, 0xa2, 0x62, 0x9f, 0x2c, 0xe3, 0x8f, 0x07, 0xa4, 0x8a, 0xc3, 0x31, 0x21, 0x33, 0x3a, 0x87, 0xd3, 0xe3, 0x43, 0x77, 0x18, 0x11, 0x58, 0x70, 0x31, 0x4d, 0x38, 0xa8, 0x75, 0xb4, 0x5c, 0x47, 0x15, 0x21, 0xc0, 0xe6, 0x30, 0x55, 0xb9, 0xeb, 0x0f, 0x23, 0xa8, 0xde, 0xc7, 0xc1, 0x9a, 0x08, 0x2c, 0xb1, 0xbb, 0x41, 0x84, 0x48, 0x2c, 0x37, 0x2b, 0x46, 0x96, 0xb0, 0x15, 0x04, 0x52, 0x2e, 0xdd, 0x60, 0x34, 0x24, 0x20, 0x8b, 0xd2, 0x25, 0x00, 0xc1, 0xae, 0x7a, 0x77, 0xe0, 0xef, 0xef, 0x8f, 0xfc, 0x9d, 0xd0, 0x43, 0xbc, 0xf4, 0x2a, 0x7b, 0xa4, 0x82, 0x8b, 0xf2, 0x8c, 0x56, 0x71, 0x30, 0xb6, 0x50, 0xa6, 0x09, 0xa7, 0xf1, 0xc8, 0x86, 0x57, 0x71, 0xe8, 0x65, 0x71, 0x48, 0x00, 0xef, 0x28, 0x4a, 0x96, 0x2b, 0x77, 0xeb, 0xcb, 0xd1, 0x64, 0x72, 0x02, 0xdf, 0x4f, 0xbe, 0x4d, 0x3e, 0xbf, 0xdd, 0xf2, 0x3e, 0x8c, 0xf1, 0xc7, 0xa4, 0xb2, 0x03, 0x7f, 0x01, 0xed, 0xa1, 0x39, 0x70,
--------------------------------------------------------------------------------
/build/assets/rubydemo.tic.dat:
--------------------------------------------------------------------------------
1 | 0x78, 0xda, 0xed, 0x52, 0xcd, 0x4a, 0xc3, 0x40, 0x10, 0xde, 0xfa, 0x73, 0xe8, 0x1e, 0x04, 0xdf, 0x60, 0xd4, 0x08, 0xad, 0x8d, 0x9a, 0xb4, 0x45, 0xb4, 0x50, 0x2f, 0x2a, 0x58, 0xa8, 0x14, 0x44, 0xf0, 0xdc, 0xa6, 0xdb, 0x76, 0x31, 0x26, 0x25, 0xd9, 0xd6, 0x06, 0x3c, 0x4b, 0x0e, 0x3e, 0x84, 0x47, 0x09, 0x79, 0x88, 0x3d, 0xcb, 0xe2, 0x93, 0x94, 0x3c, 0x83, 0x93, 0xd4, 0x9f, 0x1e, 0x44, 0x0f, 0x3d, 0x78, 0x71, 0x76, 0x87, 0xdd, 0x6f, 0x66, 0xbe, 0x99, 0x85, 0x6f, 0xd7, 0x09, 0x21, 0xb9, 0xa7, 0x25, 0xf2, 0x9b, 0xbd, 0x2a, 0xb4, 0x30, 0x0c, 0xe3, 0x28, 0x8a, 0xe2, 0xf4, 0x44, 0x18, 0x2b, 0xf9, 0xe9, 0x4a, 0x4d, 0x93, 0x30, 0x54, 0x49, 0x14, 0xc9, 0x24, 0x7c, 0x96, 0x89, 0x8a, 0xa5, 0x92, 0xb1, 0x94, 0x1f, 0xfe, 0x3d, 0x5f, 0xfd, 0xc8, 0x57, 0x73, 0x7c, 0xf2, 0x6f, 0x7f, 0x6a, 0x99, 0x56, 0xa9, 0x76, 0xd9, 0x7a, 0xc9, 0xee, 0x8f, 0xa8, 0xa3, 0x22, 0x52, 0xa1, 0xb6, 0xaf, 0x2a, 0x26, 0x0a, 0xb5, 0x9b, 0xc6, 0xa8, 0x5f, 0xf4, 0xee, 0xa9, 0x9e, 0x44, 0x4e, 0x13, 0xa5, 0x92, 0x64, 0x51, 0x7e, 0xfe, 0x78, 0xb1, 0xf7, 0x2f, 0xaf, 0xac, 0xe5, 0xf0, 0xa7, 0xaf, 0x3e, 0xe4, 0xc8, 0x16, 0x08, 0x2e, 0x6c, 0x56, 0x03, 0x80, 0x7e, 0xfb, 0x96, 0xcd, 0x10, 0xdd, 0x82, 0xf6, 0x48, 0x0c, 0x5c, 0xaf, 0xf6, 0x1e, 0xed, 0xb2, 0x31, 0xb3, 0xdd, 0x21, 0xf3, 0x74, 0x60, 0xb7, 0x6d, 0x6e, 0xe3, 0x21, 0xac, 0x3d, 0x2c, 0xeb, 0x32, 0xdf, 0x4a, 0xb9, 0xe0, 0x63, 0xb5, 0xc8, 0xa0, 0xc7, 0x87, 0x82, 0xbb, 0x0e, 0x26, 0x7d, 0x2e, 0xb2, 0xc6, 0x70, 0xc7, 0x3a, 0xe9, 0x1d, 0x6c, 0xee, 0xdc, 0x60, 0xdc, 0xe6, 0x16, 0x73, 0x7c, 0x4c, 0x5d, 0x34, 0xae, 0xa0, 0x39, 0x03, 0x50, 0xb0, 0x06, 0x6d, 0xa7, 0x8f, 0x0f, 0x18, 0x70, 0x1f, 0x84, 0x0b, 0x81, 0x3b, 0xf2, 0x3e, 0x2a, 0xc1, 0xed, 0x81, 0x35, 0x70, 0x11, 0x14, 0x91, 0x3e, 0x66, 0x9e, 0x8f, 0x03, 0x6a, 0x60, 0xec, 0x99, 0xe9, 0x94, 0x6c, 0x22, 0xce, 0xf1, 0x46, 0x9d, 0x80, 0x52, 0x4d, 0xd4, 0x0d, 0xaa, 0x4d, 0xea, 0x47, 0x07, 0x54, 0x0b, 0xea, 0xe5, 0x2a, 0xa5, 0x5d, 0xd6, 0x83, 0xab, 0xc6, 0x09, 0xcd, 0x6b, 0xc1, 0x6e, 0xdd, 0x04, 0xde, 0x83, 0x8e, 0x70, 0xc0, 0x48, 0x71, 0xe9, 0x0b, 0x9b, 0x88, 0x27, 0x73, 0xf9, 0x72, 0x8a, 0xe7, 0xf2, 0x15, 0x4a, 0xf3, 0x96, 0xed, 0x83, 0x59, 0xa1, 0x79, 0x7f, 0xe8, 0x81, 0x59, 0x2a, 0x14, 0x34, 0xb1, 0x7d, 0x60, 0x14, 0xf7, 0x2b, 0xc6, 0xbd, 0x51, 0xdc, 0x29, 0xeb, 0xda, 0x44, 0xd7, 0x02, 0xdd, 0xac, 0xea, 0x15, 0xdd, 0xc0, 0x55, 0xd6, 0xb1, 0xc7, 0xd0, 0xe3, 0x8e, 0x80, 0xcd, 0xf3, 0xb3, 0x66, 0xb3, 0x05, 0xd7, 0xad, 0xcb, 0xe6, 0xe9, 0xc6, 0xa6, 0x7e, 0x58, 0xc5, 0x8d, 0xfd, 0x05, 0xf6, 0xa7, 0xcc, 0xe9, 0xd2, 0x37, 0x80, 0xd6, 0x26, 0x84,
--------------------------------------------------------------------------------
/build/assets/sfx.tic.dat:
--------------------------------------------------------------------------------
1 | 0x78, 0xda, 0x85, 0x8e, 0xbb, 0x4a, 0x03, 0x41, 0x14, 0x86, 0x27, 0xc6, 0xa8, 0x3b, 0x46, 0xdd, 0x80, 0xa5, 0xc5, 0x10, 0x23, 0x6c, 0x70, 0x83, 0xb3, 0xeb, 0x26, 0x42, 0x40, 0x41, 0x34, 0xc1, 0x1b, 0x51, 0x12, 0x41, 0xd3, 0x88, 0x9b, 0x64, 0x93, 0x2c, 0xec, 0xcd, 0xec, 0xac, 0x97, 0xc2, 0xd2, 0xc2, 0x07, 0x10, 0xb4, 0xb4, 0xd5, 0x37, 0xb0, 0xb4, 0x14, 0x14, 0x11, 0xb1, 0x10, 0xf1, 0x11, 0xf4, 0x0d, 0xd4, 0x33, 0xc1, 0x34, 0xa6, 0xf0, 0x7c, 0x33, 0x73, 0xce, 0x7f, 0xce, 0x3f, 0xc3, 0x44, 0x29, 0x42, 0xa3, 0xd1, 0xb1, 0xc5, 0x84, 0x46, 0x35, 0xbb, 0xb0, 0x52, 0x38, 0x59, 0xa3, 0x9a, 0x91, 0x78, 0xcc, 0x2f, 0x05, 0x7b, 0x7a, 0xf9, 0xf8, 0xe1, 0xe9, 0x58, 0x3e, 0x39, 0xbb, 0xb4, 0xaf, 0xe4, 0xa7, 0xab, 0x0b, 0xfb, 0xf6, 0xee, 0xf5, 0x79, 0xe7, 0xfd, 0xe3, 0x05, 0xc3, 0x1d, 0x1e, 0xdf, 0x10, 0x9d, 0x2c, 0xaa, 0x9b, 0xfb, 0xe7, 0x37, 0x6f, 0x5f, 0x9f, 0xf7, 0xd7, 0xa7, 0x8d, 0xdc, 0x78, 0xa8, 0xa3, 0x3b, 0x39, 0xb4, 0x8b, 0xfe, 0x8d, 0x58, 0x3b, 0x44, 0xd8, 0xbc, 0x14, 0x45, 0x5e, 0x87, 0x90, 0x18, 0x43, 0x88, 0xe7, 0xff, 0x66, 0xb1, 0x98, 0x30, 0x87, 0x50, 0x04, 0x85, 0x81, 0x9e, 0x36, 0xe1, 0x5f, 0x7a, 0x81, 0x08, 0xd0, 0x07, 0xf4, 0xa3, 0x01, 0x24, 0x00, 0x18, 0x0d, 0x02, 0x51, 0x60, 0x08, 0x0d, 0x03, 0x23, 0x40, 0xb8, 0x37, 0xd2, 0x08, 0xa1, 0x54, 0x8a, 0x30, 0x93, 0x59, 0x46, 0x96, 0x10, 0xbf, 0x7e, 0x88, 0x41, 0xea, 0x01, 0x6b, 0xba, 0xad, 0x2c, 0x29, 0x18, 0x7e, 0xc5, 0x6d, 0x77, 0x6a, 0x86, 0x5f, 0x85, 0x39, 0x69, 0xba, 0x07, 0x84, 0xb9, 0xc4, 0xb3, 0xf4, 0x23, 0x52, 0xca, 0x6f, 0x43, 0xdf, 0x76, 0xf9, 0xdc, 0xaf, 0xb6, 0x4c, 0x8f, 0x65, 0x89, 0x15, 0xe8, 0x5c, 0x9a, 0x8e, 0x17, 0x80, 0x22, 0x0d, 0xdd, 0x36, 0x3c, 0xbd, 0x86, 0x31, 0x9b, 0xa5, 0xd8, 0xac, 0xc1, 0x81, 0xeb, 0x81, 0x53, 0x65, 0xa6, 0xeb, 0x90, 0xcd, 0xe5, 0x05, 0x29, 0x89, 0xb1, 0x60, 0xd6, 0x49, 0x85, 0x39, 0x9e, 0x44, 0x93, 0x84, 0x35, 0x0d, 0x87, 0xff, 0x41, 0x32, 0x6b, 0x72, 0x3c, 0x97, 0xd2, 0xe2, 0x49, 0x2c, 0x18, 0x96, 0x6f, 0x74, 0x2c, 0x4a, 0x97, 0x25, 0xf3, 0xd7, 0xa2, 0x76, 0x59, 0x66, 0xfe, 0x5a, 0xa6, 0xbb, 0x2c, 0xe9, 0xb6, 0xc5, 0x81, 0x7f, 0x0a, 0x55, 0xcb, 0x97, 0x94, 0x34, 0x48, 0xdf, 0x6b, 0x49, 0xca, 0xa4, 0xc4, 0x26, 0x54, 0x9a, 0x9c, 0x52, 0xa8, 0xac, 0x50, 0x55, 0x56, 0x35, 0x59, 0x91, 0x35, 0x18, 0x7a, 0x2d, 0xd3, 0x61, 0x52, 0x7c, 0xa3, 0x98, 0x2b, 0x95, 0xc8, 0x7c, 0xa1, 0x4c, 0xe6, 0x8b, 0xc5, 0xf5, 0x2d, 0xb2, 0x9a, 0x2b, 0xc7, 0xe5, 0x8c, 0xc6, 0x17, 0x05, 0x17, 0x16, 0xd8, 0x2c, 0x9b, 0x54, 0xa0, 0xe0, 0x6f, 0xff, 0x00, 0xf8, 0x95, 0x97, 0x61,
--------------------------------------------------------------------------------
/build/assets/squirreldemo.tic.dat:
--------------------------------------------------------------------------------
1 | 0x78, 0xda, 0xed, 0x52, 0xcd, 0x6a, 0xdb, 0x40, 0x10, 0x5e, 0xf7, 0xe7, 0xe0, 0x3d, 0x14, 0xfa, 0x06, 0xd3, 0x40, 0x61, 0x55, 0xcb, 0xb1, 0x24, 0x9b, 0xd0, 0x3a, 0x76, 0x2f, 0x69, 0xa1, 0x01, 0x97, 0x40, 0x09, 0xf4, 0xec, 0x28, 0xeb, 0x78, 0xa9, 0x22, 0xb9, 0xbb, 0xeb, 0xd4, 0xa2, 0xe4, 0xae, 0x43, 0x1e, 0x22, 0xa7, 0x52, 0x84, 0x1e, 0x62, 0xcf, 0x65, 0xc9, 0x93, 0x18, 0x3d, 0x43, 0x67, 0xe5, 0xa4, 0x4d, 0xa1, 0xb4, 0x87, 0x1c, 0x7a, 0xe9, 0xac, 0x86, 0xdd, 0xf9, 0xe6, 0xfb, 0x34, 0x0b, 0xdf, 0x3e, 0x26, 0x84, 0xb4, 0x2e, 0xef, 0x91, 0xbf, 0xc5, 0x95, 0xc5, 0x28, 0x8a, 0xa2, 0x2a, 0xcb, 0xb2, 0x72, 0x3b, 0x96, 0x95, 0x35, 0x3f, 0xd2, 0xda, 0x75, 0x5d, 0x14, 0xb6, 0x2e, 0x4b, 0x53, 0x17, 0x5f, 0x4d, 0x6d, 0x2b, 0x63, 0x4d, 0x65, 0xcc, 0x4d, 0xfe, 0x5e, 0x6f, 0xff, 0xa8, 0xb7, 0xb7, 0xf4, 0xe4, 0x7f, 0xfc, 0xd3, 0x68, 0xbc, 0x72, 0xde, 0x35, 0xeb, 0x5b, 0x73, 0xbe, 0x40, 0x1f, 0x2d, 0x31, 0x16, 0xbd, 0xbd, 0xb2, 0x15, 0xb1, 0xe8, 0xdd, 0xba, 0x42, 0xff, 0xca, 0xeb, 0x74, 0x7e, 0x12, 0xb3, 0xae, 0xad, 0xad, 0xeb, 0xbb, 0xea, 0xdb, 0x2f, 0xef, 0x76, 0xff, 0xfb, 0x0f, 0x1e, 0xb5, 0xf0, 0xa5, 0x3f, 0xfc, 0xd2, 0x22, 0xbd, 0x1e, 0x68, 0xa1, 0x13, 0x3e, 0x04, 0x80, 0x93, 0xe9, 0x29, 0xdf, 0x54, 0x14, 0xe1, 0xe9, 0x52, 0xcf, 0x33, 0x39, 0xbc, 0x86, 0x8f, 0xf9, 0x19, 0x4f, 0xb2, 0x05, 0x97, 0x3e, 0xf0, 0xd3, 0xa9, 0x48, 0x70, 0xd3, 0xf1, 0xb6, 0xe3, 0x1d, 0x73, 0x15, 0x3b, 0x35, 0x28, 0xa4, 0xeb, 0xa6, 0x94, 0x62, 0xa1, 0x45, 0x96, 0xba, 0xae, 0x12, 0xba, 0xf9, 0x37, 0x7c, 0xe2, 0x47, 0xee, 0x0c, 0x89, 0x48, 0x3f, 0xb8, 0x46, 0x22, 0x62, 0x9e, 0x2a, 0xec, 0xbd, 0xdd, 0x3f, 0x84, 0xc9, 0xa6, 0x00, 0x16, 0xcf, 0xa7, 0xe9, 0x09, 0x5e, 0x62, 0x2e, 0x14, 0xe8, 0x0c, 0xf2, 0x6c, 0x29, 0x6f, 0x98, 0x90, 0xcd, 0x20, 0x9e, 0x67, 0x58, 0x78, 0x4e, 0x7f, 0xc6, 0xa5, 0xc2, 0x19, 0x43, 0x08, 0xb6, 0xc3, 0x66, 0x50, 0x33, 0x15, 0x47, 0xa9, 0x8f, 0x4b, 0x21, 0x25, 0x4f, 0x28, 0xd5, 0xa3, 0x6e, 0x40, 0x57, 0xa3, 0xee, 0x8b, 0x1d, 0x9a, 0x8f, 0xba, 0xd1, 0x80, 0xd2, 0xd9, 0x32, 0x8d, 0xdd, 0xcd, 0xe0, 0x70, 0x7f, 0x8f, 0x79, 0xf4, 0x33, 0x6d, 0x8b, 0x19, 0xb0, 0x23, 0x9d, 0xb2, 0xc0, 0xf3, 0x20, 0x1f, 0xe7, 0xdd, 0x70, 0xf7, 0x27, 0x16, 0x6e, 0xb0, 0xce, 0x6d, 0x2c, 0x42, 0x6c, 0x35, 0x5e, 0xfd, 0xc2, 0xeb, 0x6f, 0x30, 0xc7, 0xa3, 0xed, 0x38, 0x51, 0x2c, 0xec, 0x7b, 0xb4, 0xad, 0x16, 0x92, 0x85, 0x1d, 0xc6, 0xf4, 0xd3, 0x9d, 0xc0, 0xeb, 0xf5, 0x03, 0xef, 0x59, 0xe4, 0xaf, 0xfc, 0xdc, 0x0f, 0x07, 0x7e, 0xdf, 0x0f, 0x70, 0x45, 0x7e, 0x84, 0xb4, 0x85, 0x14, 0xa9, 0x66, 0x5b, 0x6f, 0x5e, 0x4f, 0x26, 0x07, 0xf0, 0xfe, 0xe0, 0xdd, 0xe4, 0xd5, 0x93, 0x2d, 0xff, 0xf9, 0x00, 0x3f, 0x6c, 0xea, 0xb1, 0xee, 0x84, 0xf4, 0x9c, 0x7e, 0x07, 0x67, 0x1d, 0x30, 0x72,
--------------------------------------------------------------------------------
/build/baremetalpi/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ubuntu:24.04
2 | RUN apt-get update
3 | RUN apt-get install software-properties-common -y
4 | RUN add-apt-repository ppa:git-core/ppa -y
5 | RUN apt-get install wget git build-essential -y
6 | RUN wget -q https://cmake.org/files/v3.30/cmake-3.30.3-linux-x86_64.sh
7 | RUN sh cmake-3.30.3-linux-x86_64.sh --skip-license --prefix=/usr
8 | RUN cd /opt && wget -q https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz
9 | RUN cd /opt && tar -xf arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz
10 | ENV PATH=/opt/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi/bin/:$PATH
11 | RUN mkdir /src
12 | WORKDIR /src
13 |
--------------------------------------------------------------------------------
/build/baremetalpi/Makefile:
--------------------------------------------------------------------------------
1 | #
2 | # Makefile
3 | #
4 | TIC80HOME = ../..
5 | TIC803RD = $(TIC80HOME)/vendor
6 | MRUBYDIR = $(TIC803RD)/mruby
7 | CIRCLESTDLIB = $(TIC803RD)/circle-stdlib
8 | CIRCLEHOME = $(CIRCLESTDLIB)/libs/circle
9 | NEWLIBDIR = $(CIRCLESTDLIB)/install/arm-none-circle
10 | TIC80LIB = $(TIC80HOME)/build/lib
11 | TIC80SRC = $(TIC80HOME)/src
12 | TIC80BUILD = $(TIC80HOME)/build
13 | TIC80STUDIOSRC = $(TIC80SRC)/studio
14 | BAREMETALSYSTEM = $(TIC80SRC)/system/baremetalpi
15 |
16 | OBJS = \
17 | $(BAREMETALSYSTEM)/main.o $(BAREMETALSYSTEM)/kernel.o $(BAREMETALSYSTEM)/customchargenerator.o \
18 | $(BAREMETALSYSTEM)/customscreen.o $(BAREMETALSYSTEM)/utils.o $(BAREMETALSYSTEM)/gamepads.o
19 |
20 | include $(CIRCLEHOME)/Rules.mk
21 |
22 | CFLAGS += -I "$(NEWLIBDIR)/include" -I $(STDDEF_INCPATH) -I $(CIRCLESTDLIB)/include -I $(TIC80HOME)/include -I $(TIC80SRC) \
23 | -I $(TIC80STUDIOSRC) -I $(TIC80BUILD) -D BAREMETALPI
24 |
25 | LIBS := \
26 | $(TIC80LIB)/libtic80studio.a \
27 | $(TIC80LIB)/libtic80core.a \
28 | $(TIC80LIB)/libgiflib.a \
29 | $(TIC80LIB)/liblpeg.a \
30 | $(TIC80LIB)/libluaapi.a \
31 | $(TIC80LIB)/liblua.a \
32 | $(TIC80LIB)/libmoon.a \
33 | $(TIC80LIB)/libfennel.a \
34 | $(TIC80LIB)/libzip.a \
35 | $(TIC80LIB)/libblipbuf.a \
36 | $(TIC80LIB)/libsquirrel.a \
37 | $(TIC80LIB)/libpython.a \
38 | $(TIC80LIB)/libpocketpy.a \
39 | $(TIC80LIB)/libscheme.a \
40 | $(TIC80LIB)/libwren.a \
41 | $(TIC80LIB)/libwasm.a \
42 | $(TIC80LIB)/libjanet.a \
43 | $(TIC80LIB)/libargparse.a \
44 | $(TIC80LIB)/libwave_writer.a \
45 | $(TIC80LIB)/libjs.a \
46 | $(TIC80LIB)/libquickjs.a \
47 | $(TIC80LIB)/libzlib.a \
48 | $(TIC80LIB)/libpng.a \
49 | $(TIC80LIB)/libruby.a \
50 | $(MRUBYDIR)/build/target/lib/libmruby.a \
51 | $(NEWLIBDIR)/lib/libc.a \
52 | $(NEWLIBDIR)/lib/libcirclenewlib.a \
53 | $(CIRCLEHOME)/addon/vc4/sound/libvchiqsound.a \
54 | $(CIRCLEHOME)/addon/vc4/vchiq/libvchiq.a \
55 | $(CIRCLEHOME)/addon/linux/liblinuxemu.a \
56 | $(CIRCLEHOME)/addon/SDCard/libsdcard.a \
57 | $(CIRCLEHOME)/addon/fatfs/libfatfs.a \
58 | $(CIRCLEHOME)/lib/sound/libsound.a \
59 | $(CIRCLEHOME)/lib/usb/libusb.a \
60 | $(CIRCLEHOME)/lib/input/libinput.a \
61 | $(CIRCLEHOME)/lib/fs/fat/libfatfs.a \
62 | $(CIRCLEHOME)/lib/fs/libfs.a \
63 | $(CIRCLEHOME)/lib/net/libnet.a \
64 | $(CIRCLEHOME)/lib/sched/libsched.a \
65 | $(CIRCLEHOME)/lib/libcircle.a \
66 | $(NEWLIBDIR)/lib/libm.a
67 |
--------------------------------------------------------------------------------
/build/baremetalpi/README.md:
--------------------------------------------------------------------------------
1 |
2 | # Raspberry PI Baremetal build
3 |
4 | The following explains how to build TIC-80 for the Raspberry PI boards in baremetal mode, that is, without an operating system (the board boots directly in TIC-80)
5 |
6 | # Requirements
7 |
8 | You need:
9 |
10 | - A Linux machine
11 | - gcc ARM toolchain. You can get it [here](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads). Successfully tested with version: gcc-arm-none-eabi-8-2018-q4-major
12 | - A standard building environment (make, cmake, gcc, wget, etc)
13 |
14 | # Building instructions
15 |
16 | Following are all the building steps for building the system.
17 |
18 | First, set the path to include the arm toolkit (fix the command with your path):
19 |
20 | ```
21 | PATH=/home/you/gcc-arm-none-eabi-8-2018-q4-major/bin/:$PATH
22 | ```
23 |
24 | Get a fresh copy of TIC-80 repository:
25 |
26 | ```
27 | git clone --recursive https://github.com/nesbox/TIC-80
28 | cd TIC-80
29 | ```
30 |
31 | Now build circle-stdlib (3 is your RPi model, should build with 2 and 4 too but it's untested):
32 |
33 | ```
34 | cd vendor/circle-stdlib
35 | ./configure -r 3
36 | make
37 | ```
38 |
39 | Make some addon that are not compiled automatically:
40 |
41 | ```
42 | cd libs/circle/addon/vc4/sound/
43 | make
44 | cd ../vchiq
45 | make
46 | cd ../../linux
47 | make
48 | cd ../../../../../..
49 | ```
50 |
51 | Build `tic80studio` for arm with baremetal customizations:
52 |
53 | ```
54 | cd build
55 | cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=baremetalpi/toolchain.cmake ..
56 | make tic80studio
57 | ```
58 |
59 | Build the kernel:
60 |
61 | ```
62 | cd baremetalpi
63 | make
64 | ```
65 |
66 | This generates the final `kernel8-32.img` file (or something similar depending on the RPI version). Copy it into your SD card root.
67 |
68 | Now you have to download some bootup files that need to be copied to the SD card root together with your kernel8-32.img. This only need to be done once.
69 |
70 | ```
71 | cd ../../vendor/circle-stdlib/libs/circle/boot/
72 | make
73 | ```
74 |
75 | Read the README.md in this folder to see what files needs to be copied to your RPI. For RPi3 should be ok to copy all of them
76 |
77 | You can create a `tic80` folder into your SD card to put your carts in.
78 |
79 | # Thanks
80 |
81 | This project is built on two awesome projects, [circle](https://github.com/rsta2/circle) and [circle-stdlib](https://github.com/smuehlst/circle-stdlib). Without them, this version of TIC-80 would not exist.
82 |
--------------------------------------------------------------------------------
/build/baremetalpi/boot/Makefile:
--------------------------------------------------------------------------------
1 | #
2 | # Download the firmware files to be required for boot (requires wget)
3 | #
4 | # These files must be copied along with the generated kernel.img
5 | # onto a SD(HC) card with FAT file system.
6 | #
7 |
8 | firmware:
9 | wget -q -O LICENCE.broadcom https://github.com/raspberrypi/firmware/blob/master/boot/LICENCE.broadcom?raw=true
10 | wget -q -O bootcode.bin https://github.com/raspberrypi/firmware/blob/master/boot/bootcode.bin?raw=true
11 | wget -q -O fixup.dat https://github.com/raspberrypi/firmware/blob/master/boot/fixup.dat?raw=true
12 | wget -q -O start.elf https://github.com/raspberrypi/firmware/blob/master/boot/start.elf?raw=true
13 |
14 | all: firmware
15 |
--------------------------------------------------------------------------------
/build/baremetalpi/boot/config.txt:
--------------------------------------------------------------------------------
1 | hdmi_group=1
2 | hdmi_mode=16
3 | scaling_kernel=8
--------------------------------------------------------------------------------
/build/baremetalpi/circle.patch:
--------------------------------------------------------------------------------
1 | --- a/vendor/circle-stdlib/libs/circle/include/circle/types.h
2 | +++ b/vendor/circle-stdlib/libs/circle/include/circle/types.h
3 | @@ -21,14 +21,15 @@
4 | #define _circle_types_h
5 |
6 | #include
7 | +#include
8 |
9 | typedef unsigned char u8;
10 | typedef unsigned short u16;
11 | -typedef unsigned int u32;
12 | +typedef uint32_t u32;
13 |
14 | typedef signed char s8;
15 | typedef signed short s16;
16 | -typedef signed int s32;
17 | +typedef int32_t s32;
18 |
19 | #if AARCH == 32
20 | typedef unsigned long long u64;
21 |
--------------------------------------------------------------------------------
/build/cart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/build/cart.png
--------------------------------------------------------------------------------
/build/janet/janetconf.h:
--------------------------------------------------------------------------------
1 | /* This will be generated by the build system if this file is not used */
2 |
3 | #ifndef JANETCONF_H
4 | #define JANETCONF_H
5 |
6 | #define JANET_VERSION_MAJOR 1
7 | #define JANET_VERSION_MINOR 31
8 | #define JANET_VERSION_PATCH 0
9 | #define JANET_VERSION_EXTRA ""
10 | #define JANET_VERSION "1.31.0"
11 |
12 | /* #define JANET_BUILD "local" */
13 |
14 | /* These settings all affect linking, so use cautiously. */
15 | #define JANET_SINGLE_THREADED
16 | #define JANET_NO_DYNAMIC_MODULES
17 |
18 | /* #define JANET_NO_NANBOX */
19 | /* #define JANET_API __attribute__((visibility ("default"))) */
20 |
21 | /* These settings should be specified before amalgamation is
22 | * built. Any build with these set should be considered non-standard, and
23 | * certain Janet libraries should be expected not to work. */
24 | #define JANET_REDUCED_OS
25 | #define JANET_NO_ASSEMBLER
26 | #define JANET_NO_NET
27 | #define JANET_NO_FFI
28 | #define JANET_NO_FFI_JIT
29 | #define JANET_NO_EV
30 | #define JANET_NO_THREADS
31 |
32 | /* #define JANET_NO_DOCSTRINGS */
33 | /* #define JANET_NO_SOURCEMAPS */
34 | /* #define JANET_NO_PEG */
35 | /* #define JANET_NO_INT_TYPES */
36 | /* #define JANET_NO_REALPATH */
37 | /* #define JANET_NO_SYMLINKS */
38 | /* #define JANET_NO_UMASK */
39 | /* #define JANET_NO_PROCESSES */
40 |
41 | /* Other settings */
42 | /* #define JANET_DEBUG */
43 | /* #define JANET_PRF */
44 | /* #define JANET_NO_UTC_MKTIME */
45 | /* #define JANET_OUT_OF_MEMORY do { printf("janet out of memory\n"); exit(1); } while (0) */
46 | /* #define JANET_EXIT(msg) do { printf("C assert failed executing janet: %s\n", msg); exit(1); } while (0) */
47 | /* #define JANET_TOP_LEVEL_SIGNAL(msg) call_my_function((msg), stderr) */
48 | /* #define JANET_RECURSION_GUARD 1024 */
49 | /* #define JANET_MAX_PROTO_DEPTH 200 */
50 | /* #define JANET_MAX_MACRO_EXPAND 200 */
51 | /* #define JANET_STACK_MAX 16384 */
52 | /* #define JANET_OS_NAME my-custom-os */
53 | /* #define JANET_ARCH_NAME pdp-8 */
54 | /* #define JANET_EV_NO_EPOLL */
55 | /* #define JANET_EV_NO_KQUEUE */
56 | /* #define JANET_NO_INTERPRETER_INTERRUPT */
57 |
58 | /* Custom vm allocator support */
59 | /* #include */
60 | /* #define janet_malloc(X) mi_malloc((X)) */
61 | /* #define janet_realloc(X, Y) mi_realloc((X), (Y)) */
62 | /* #define janet_calloc(X, Y) mi_calloc((X), (Y)) */
63 | /* #define janet_free(X) mi_free((X)) */
64 |
65 | /* Main client settings, does not affect library code */
66 | /* #define JANET_SIMPLE_GETLINE */
67 |
68 | #endif /* end of include guard: JANETCONF_H */
69 |
--------------------------------------------------------------------------------
/build/libretro/merge_static.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | AR="$1"
4 | shift
5 | OUTPUT="$1"
6 | shift
7 |
8 | (echo create "$OUTPUT";
9 | for x in "$@"; do
10 | echo addlib "$x"
11 | done
12 | echo save
13 | echo end
14 | ) | "$AR" -M
15 |
--------------------------------------------------------------------------------
/build/linux/tic80.desktop.in:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Version=1.0
3 | Name=TIC-80
4 | Comment=Fantasy computer for making, playing and sharing tiny games.
5 | Exec=tic80 %U
6 | Icon=tic80
7 | Terminal=false
8 | Type=Application
9 | Categories=Education
10 | MimeType=application/x-tic80-item;
11 | GenericName=TIC-80
12 |
--------------------------------------------------------------------------------
/build/linux/tic80.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/build/linux/tic80.png
--------------------------------------------------------------------------------
/build/linux/tic80.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Fantasy computer for making, playing and sharing tiny games.
7 | tic80
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/build/macosx/tic80.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/build/macosx/tic80.icns
--------------------------------------------------------------------------------
/build/macosx/tic80.plist.in:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | TIC-80
9 | CFBundleExecutable
10 | tic80
11 | CFBundleIconFile
12 | tic80.icns
13 | CFBundleIdentifier
14 | com.nesbox.tic
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | TIC-80
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_REVISION@
23 | CFBundleVersion
24 | @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_REVISION@
25 | NSHumanReadableCopyright
26 | https://tic80.com © 2017-@VERSION_YEAR@
27 | NSHighResolutionCapable
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/build/macosx/tic80pro.plist.in:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | TIC-80 Pro
9 | CFBundleExecutable
10 | tic80pro
11 | CFBundleIconFile
12 | tic80.icns
13 | CFBundleIdentifier
14 | com.nesbox.tic
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | TIC-80 Pro
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_REVISION@
23 | CFBundleVersion
24 | @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_REVISION@
25 | NSHumanReadableCopyright
26 | https://tic80.com © 2017-@VERSION_YEAR@
27 | NSHighResolutionCapable
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/build/mruby/.gitignore:
--------------------------------------------------------------------------------
1 | *.lock
2 |
--------------------------------------------------------------------------------
/build/mruby/tic.gembox:
--------------------------------------------------------------------------------
1 | MRuby::GemBox.new do |conf|
2 | conf.gembox "stdlib"
3 | conf.gembox "stdlib-ext"
4 | conf.gembox "math"
5 | conf.gembox "metaprog"
6 | end
7 | # vim: set ft=ruby :
8 |
--------------------------------------------------------------------------------
/build/mruby/tic_android.rb:
--------------------------------------------------------------------------------
1 | MRuby::Build.new do |conf|
2 | if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
3 | toolchain :visualcpp
4 | else
5 | conf.toolchain
6 | end
7 |
8 | conf.build_mrbc_exec
9 | conf.disable_libmruby
10 | conf.disable_presym
11 | end
12 |
13 | MRuby::CrossBuild.new('target') do |conf|
14 | ARCH = ENV['ANDROID_ARCH']
15 | PLATFORM = ENV['ANDROID_PLATFORM']
16 | API = ENV['ANDROID_PLATFORM'].rpartition('-').last
17 |
18 | toolchain :android, arch: ARCH, platform: PLATFORM
19 |
20 | conf.gembox File.expand_path('tic', File.dirname(__FILE__))
21 |
22 | conf.cc do |cc|
23 | cc.flags << '-fPIC'
24 | cc.defines << '__ANDROID__'
25 | cc.defines << "__ANDROID_API__=#{API}"
26 | end
27 |
28 | conf.enable_debug if /DEBUG/ =~ ENV["BUILD_TYPE"]
29 | conf.enable_bintest
30 | conf.enable_test
31 | end
32 |
--------------------------------------------------------------------------------
/build/mruby/tic_default.rb:
--------------------------------------------------------------------------------
1 | MRuby::Build.new do |conf|
2 | if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
3 | toolchain :visualcpp
4 | else
5 | conf.toolchain
6 | end
7 |
8 | conf.build_mrbc_exec
9 | conf.disable_libmruby
10 | conf.disable_presym
11 | end
12 |
13 | MRuby::CrossBuild.new('target') do |conf|
14 | toolchain ENV['MRUBY_TOOLCHAIN']
15 |
16 | conf.gembox File.expand_path('tic', File.dirname(__FILE__))
17 |
18 | conf.cc do |cc|
19 | cc.command = ENV["TARGET_CC"] || 'cc'
20 | cc.flags = [ENV["TARGET_CFLAGS"] || %w()]
21 | cc.flags << '-fPIC' unless ENV['MRUBY_TOOLCHAIN'] == 'visualcpp'
22 | cc.flags << "-isysroot #{ENV['MRUBY_SYSROOT']}" unless ENV['MRUBY_SYSROOT'].empty?
23 | end
24 |
25 | conf.linker do |linker|
26 | linker.command = ENV['TARGET_CC'] || 'cc'
27 | linker.flags = [ENV['TARGET_LDFLAGS'] || %w()]
28 | end
29 |
30 | conf.archiver do |archiver|
31 | archiver.command = ENV['TARGET_AR'] || 'ar'
32 | end
33 |
34 | conf.exts do |exts|
35 | exts.object = '.o'
36 | exts.library = '.a'
37 | # exts.executable = '' # '.exe' if Windows
38 | end
39 |
40 | conf.enable_debug if /DEBUG/ =~ ENV["BUILD_TYPE"]
41 | conf.enable_bintest
42 | conf.enable_test
43 | end
44 |
--------------------------------------------------------------------------------
/build/n3ds/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ubuntu:18.04
2 | RUN apt-get update
3 | RUN apt-get install software-properties-common -y
4 | RUN add-apt-repository ppa:git-core/ppa -y
5 | RUN apt-get install wget git curl xz-utils pkg-config libarchive13 -y
6 | RUN wget https://github.com/devkitPro/pacman/releases/download/v1.0.2/devkitpro-pacman.amd64.deb
7 | RUN dpkg -i devkitpro-pacman.amd64.deb
8 | RUN dkp-pacman --noconfirm --sync devkitARM devkitpro-pkgbuild-helpers 3ds-libpng 3ds-pkg-config 3ds-zlib 3dstools libctru citro3d
9 | ENV DEVKITPRO=/opt/devkitpro
10 | RUN wget https://cmake.org/files/v3.13/cmake-3.13.0-Linux-x86_64.sh
11 | RUN sh cmake-3.13.0-Linux-x86_64.sh --skip-license --prefix=/usr
12 | RUN mkdir /src
13 | WORKDIR /src
14 |
--------------------------------------------------------------------------------
/build/n3ds/README.md:
--------------------------------------------------------------------------------
1 | # 3DS build
2 |
3 | ## Requirements
4 |
5 | * devkitARM (tested on release 65, please use latest) + the 3ds-dev meta package
6 | * the following additional packages:
7 | * 3ds-libpng
8 | * 3ds-zlib
9 |
10 | ## Building instructions
11 |
12 | ```
13 | cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/3DS.cmake
14 | cmake --build build
15 | ```
16 |
17 | You should now be able to find `tic80.3dsx` in build/bin.
18 |
--------------------------------------------------------------------------------
/build/n3ds/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/build/n3ds/icon.png
--------------------------------------------------------------------------------
/build/n3ds/romfs/kbd_display.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/build/n3ds/romfs/kbd_display.png
--------------------------------------------------------------------------------
/build/rpi/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ubuntu:18.04
2 | RUN apt-get update
3 | RUN apt-get install software-properties-common -y
4 | RUN add-apt-repository ppa:git-core/ppa -y
5 | RUN apt-get install wget git make -y
6 | RUN mkdir /opt/sysroot
7 | RUN cd /opt/sysroot && wget -q http://downloads.raspberrypi.org/raspbian/root.tar.xz && tar xf root.tar.xz
8 | RUN cd /opt/sysroot && wget -q https://buildbot.libsdl.org/sdl-builds/sdl-raspberrypi/sdl-raspberrypi-224.tar.xz && tar xf sdl-raspberrypi-224.tar.xz
9 | RUN cd /opt && git clone --depth 1 https://github.com/raspberrypi/tools.git tools
10 | RUN wget -q https://cmake.org/files/v3.13/cmake-3.13.0-Linux-x86_64.sh
11 | RUN sh cmake-3.13.0-Linux-x86_64.sh --skip-license --prefix=/usr
12 | RUN mkdir /src
13 | WORKDIR /src
14 |
--------------------------------------------------------------------------------
/build/rpi/toolchain.cmake:
--------------------------------------------------------------------------------
1 | # Define our host system
2 | set(CMAKE_SYSTEM_NAME Linux)
3 | set(CMAKE_SYSTEM_VERSION 1)
4 |
5 | set(CMAKE_LIBRARY_ARCHITECTURE arm-linux-gnueabihf)
6 | set(SYSROOT_PATH /opt/sysroot)
7 |
8 | # Define the cross compiler locations
9 | set(CMAKE_C_COMPILER /usr/bin/${CMAKE_LIBRARY_ARCHITECTURE}-gcc-8)
10 | set(CMAKE_CXX_COMPILER /usr/bin/${CMAKE_LIBRARY_ARCHITECTURE}-g++-8)
11 |
12 | # Define the sysroot path for the RaspberryPi distribution in our tools folder
13 | set(CMAKE_FIND_ROOT_PATH ${SYSROOT_PATH})
14 |
15 | # Use our definitions for compiler tools
16 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
17 |
18 | # Search for libraries and headers in the target directories only
19 | set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
20 | set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
21 |
22 | include_directories(${SYSROOT_PATH}/usr/include)
23 | include_directories(${SYSROOT_PATH}/usr/include/${CMAKE_LIBRARY_ARCHITECTURE})
24 |
25 | set(RPI TRUE)
26 |
--------------------------------------------------------------------------------
/build/tools/cart2prj.c:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2020 Vadim Grigoruk @nesbox // grigoruk@gmail.com
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #include
24 | #include
25 | #include "studio/project.h"
26 |
27 | int main(int argc, char** argv)
28 | {
29 | int res = -1;
30 |
31 | if(argc == 3)
32 | {
33 | FILE* cartFile = fopen(argv[1], "rb");
34 |
35 | if(cartFile)
36 | {
37 | fseek(cartFile, 0, SEEK_END);
38 | int size = ftell(cartFile);
39 | fseek(cartFile, 0, SEEK_SET);
40 |
41 | unsigned char* buffer = (unsigned char*)malloc(size);
42 |
43 | if(buffer)
44 | {
45 | fread(buffer, size, 1, cartFile);
46 | fclose(cartFile);
47 |
48 | tic_cartridge* cart = calloc(1, sizeof(tic_cartridge));
49 |
50 | tic_cart_load(cart, buffer, size);
51 |
52 | FILE* project = fopen(argv[2], "wb");
53 |
54 | if(project)
55 | {
56 | unsigned char* out = (unsigned char*)malloc(sizeof(tic_cartridge) * 3);
57 |
58 | if(out)
59 | {
60 | s32 outSize = tic_project_save(argv[2], out, cart);
61 |
62 | fwrite(out, outSize, 1, project);
63 |
64 | free(out);
65 | }
66 |
67 | fclose(project);
68 |
69 | res = 0;
70 | }
71 | else printf("cannot open project file\n");
72 |
73 | free(buffer);
74 | free(cart);
75 | }
76 |
77 | }
78 | else printf("cannot open cartridge file\n");
79 | }
80 | else printf("usage: cart2prj \n");
81 |
82 | return res;
83 | }
84 |
--------------------------------------------------------------------------------
/build/tools/prj2cart.c:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2020 Vadim Grigoruk @nesbox // grigoruk@gmail.com
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #include
24 | #include
25 | #include "studio/project.h"
26 |
27 | int main(int argc, char** argv)
28 | {
29 | int res = -1;
30 |
31 | if(argc == 3)
32 | {
33 | FILE* project = fopen(argv[1], "rb");
34 |
35 | if(project)
36 | {
37 | fseek(project, 0, SEEK_END);
38 | int size = ftell(project);
39 | fseek(project, 0, SEEK_SET);
40 |
41 | unsigned char* buffer = (unsigned char*)malloc(size);
42 |
43 | if(buffer)
44 | {
45 | fread(buffer, size, 1, project);
46 | fclose(project);
47 |
48 | tic_cartridge* cart = calloc(1, sizeof(tic_cartridge));
49 |
50 | tic_project_load(argv[1], (char*)buffer, size, cart);
51 |
52 | FILE* cartFile = fopen(argv[2], "wb");
53 |
54 | if(cartFile)
55 | {
56 | unsigned char* out = (unsigned char*)malloc(sizeof(tic_cartridge));
57 |
58 | if(out)
59 | {
60 | int outSize = tic_cart_save(cart, out);
61 |
62 | fwrite(out, outSize, 1, cartFile);
63 |
64 | free(out);
65 | }
66 |
67 | fclose(cartFile);
68 |
69 | res = 0;
70 | }
71 | else printf("cannot open cartridge file\n");
72 |
73 | free(buffer);
74 | free(cart);
75 | }
76 |
77 | }
78 | else printf("cannot open project file\n");
79 | }
80 | else printf("usage: prj2cart \n");
81 |
82 | return res;
83 | }
84 |
--------------------------------------------------------------------------------
/build/webapp/serviceworker.js:
--------------------------------------------------------------------------------
1 | const version = 'tic80-v1'
2 | const assets = [
3 | 'index.html',
4 | 'tic80.js',
5 | 'tic80.wasm',
6 | 'tic80-180.png',
7 | 'tic80-192.png',
8 | 'tic80-512.png',
9 | 'serviceworker.js',
10 | 'tic80.webmanifest'
11 | ]
12 |
13 | self.addEventListener('install', function(event) {
14 | console.log('serviceworker installing')
15 | caches.open(version)
16 | .then(function(cache) {
17 | return cache.addAll(assets);
18 | })
19 | });
20 |
21 | self.addEventListener('fetch', function(event) {
22 | event.respondWith(
23 | caches.match(event.request)
24 | .then(function(response) {
25 | if (response) {
26 | return response;
27 | }
28 | return fetch(event.request);
29 | }
30 | )
31 | );
32 | });
33 |
34 |
--------------------------------------------------------------------------------
/build/webapp/tic80-180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/build/webapp/tic80-180.png
--------------------------------------------------------------------------------
/build/webapp/tic80-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/build/webapp/tic80-192.png
--------------------------------------------------------------------------------
/build/webapp/tic80-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/build/webapp/tic80-512.png
--------------------------------------------------------------------------------
/build/webapp/tic80.webmanifest:
--------------------------------------------------------------------------------
1 | {
2 | "background_color": "#1a1c2c",
3 | "theme_color": "#f4f4f4",
4 | "description": "TIC-80 is a fantasy computer for making, playing and sharing tiny games.",
5 | "display": "fullscreen",
6 | "icons": [
7 | {
8 | "src": "tic80-180.png",
9 | "sizes": "180x180",
10 | "type": "image/png",
11 | "purpose": "any maskable"
12 | },
13 | {
14 | "src": "tic80-192.png",
15 | "sizes": "192x192",
16 | "type": "image/png",
17 | "purpose": "any maskable"
18 | },
19 | {
20 | "src": "tic80-512.png",
21 | "sizes": "512x512",
22 | "type": "image/png",
23 | "purpose": "any maskable"
24 | }
25 | ],
26 | "name": "TIC-80 Tiny Computer",
27 | "short_name": "TIC-80",
28 | "start_url": "index.html"
29 | }
30 |
--------------------------------------------------------------------------------
/build/windows/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/build/windows/icon.ico
--------------------------------------------------------------------------------
/build/windows/tic80.rc.in:
--------------------------------------------------------------------------------
1 | 101 ICON "icon.ico"
2 |
3 | 1 VERSIONINFO
4 | FILEVERSION @VERSION_MAJOR@,@VERSION_MINOR@,@VERSION_REVISION@,0
5 | PRODUCTVERSION @VERSION_MAJOR@,@VERSION_MINOR@,@VERSION_REVISION@,0
6 | FILEFLAGSMASK 0x3fL
7 | #ifdef _DEBUG
8 | FILEFLAGS 0x1L
9 | #else
10 | FILEFLAGS 0x0L
11 | #endif
12 | FILEOS 0x40004L
13 | FILETYPE 0x0L
14 | FILESUBTYPE 0x0L
15 | BEGIN
16 | BLOCK "StringFileInfo"
17 | BEGIN
18 | BLOCK "040904E4"
19 | BEGIN
20 | VALUE "CompanyName", "Nesbox"
21 | VALUE "FileDescription", "TIC-80 tiny computer"
22 | VALUE "FileVersion", "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_REVISION@.0"
23 | VALUE "InternalName", "tic80.exe"
24 | VALUE "LegalCopyright", "https://tic80.com (C) 2017-@VERSION_YEAR@"
25 | VALUE "OriginalFilename", "tic80.exe"
26 | VALUE "ProductName", "TIC-80"
27 | VALUE "ProductVersion", "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_REVISION@.0"
28 | END
29 | END
30 | BLOCK "VarFileInfo"
31 | BEGIN
32 | VALUE "Translation", 0x409, 1252
33 | END
34 | END
35 |
--------------------------------------------------------------------------------
/cmake/argparse.cmake:
--------------------------------------------------------------------------------
1 | ################################
2 | # ArgParse lib
3 | ################################
4 |
5 | if(PREFER_SYSTEM_LIBRARIES)
6 | find_path(argparse_INCLUDE_DIR NAMES argparse.h)
7 | find_library(argparse_LIBRARY NAMES argparse)
8 | if(argparse_INCLUDE_DIR AND argparse_LIBRARY)
9 | add_library(argparse UNKNOWN IMPORTED GLOBAL)
10 | set_target_properties(argparse PROPERTIES
11 | IMPORTED_LOCATION "${argparse_LIBRARY}"
12 | INTERFACE_INCLUDE_DIRECTORIES "${argparse_INCLUDE_DIR}"
13 | )
14 | message(STATUS "Use system library: argparse")
15 | return()
16 | else()
17 | message(WARNING "System library argparse not found")
18 | endif()
19 | endif()
20 |
21 | add_library(argparse STATIC ${THIRDPARTY_DIR}/argparse/argparse.c)
22 | target_include_directories(argparse INTERFACE ${THIRDPARTY_DIR}/argparse)
23 |
--------------------------------------------------------------------------------
/cmake/blipbuf.cmake:
--------------------------------------------------------------------------------
1 | ################################
2 | # Blipbuf
3 | ################################
4 |
5 | add_library(blipbuf STATIC ${THIRDPARTY_DIR}/blip-buf/blip_buf.c)
6 | target_include_directories(blipbuf INTERFACE ${THIRDPARTY_DIR}/blip-buf)
--------------------------------------------------------------------------------
/cmake/fennel.cmake:
--------------------------------------------------------------------------------
1 | ################################
2 | # Fennel
3 | ################################
4 |
5 | option(BUILD_WITH_FENNEL "Fennel Enabled" ${BUILD_WITH_ALL})
6 | message("BUILD_WITH_FENNEL: ${BUILD_WITH_FENNEL}")
7 |
8 | if(BUILD_WITH_FENNEL)
9 |
10 | add_library(fennel ${TIC_RUNTIME} ${CMAKE_SOURCE_DIR}/src/api/fennel.c)
11 |
12 | if(NOT BUILD_STATIC)
13 | set_target_properties(fennel PROPERTIES PREFIX "")
14 | else()
15 | target_compile_definitions(fennel INTERFACE TIC_BUILD_WITH_FENNEL)
16 | endif()
17 |
18 | target_link_libraries(fennel PRIVATE runtime luaapi)
19 | target_include_directories(fennel
20 | PRIVATE
21 | ${THIRDPARTY_DIR}/fennel
22 | ${CMAKE_SOURCE_DIR}/include
23 | ${CMAKE_SOURCE_DIR}/src
24 | )
25 |
26 | endif()
--------------------------------------------------------------------------------
/cmake/gif.cmake:
--------------------------------------------------------------------------------
1 | ################################
2 | # GIFLIB
3 | ################################
4 |
5 | if(PREFER_SYSTEM_LIBRARIES)
6 | find_path(giflib_INCLUDE_DIR NAMES gif_lib.h)
7 | find_library(giflib_LIBRARY NAMES gif)
8 | if(giflib_INCLUDE_DIR AND giflib_LIBRARY)
9 | add_library(giflib UNKNOWN IMPORTED GLOBAL)
10 | set_target_properties(giflib PROPERTIES
11 | IMPORTED_LOCATION "${giflib_LIBRARY}"
12 | INTERFACE_INCLUDE_DIRECTORIES "${giflib_INCLUDE_DIR};${THIRDPARTY_DIR}/msf_gif"
13 | )
14 | message(STATUS "Use system library: giflib")
15 | return()
16 | else()
17 | message(WARNING "System library giflib not found")
18 | endif()
19 | endif()
20 |
21 | set(GIFLIB_DIR ${THIRDPARTY_DIR}/giflib)
22 | set(GIFLIB_SRC
23 | ${GIFLIB_DIR}/dgif_lib.c
24 | ${GIFLIB_DIR}/egif_lib.c
25 | ${GIFLIB_DIR}/gif_err.c
26 | ${GIFLIB_DIR}/gif_font.c
27 | ${GIFLIB_DIR}/gif_hash.c
28 | ${GIFLIB_DIR}/gifalloc.c
29 | ${GIFLIB_DIR}/openbsd-reallocarray.c
30 | )
31 | add_library(giflib STATIC ${GIFLIB_SRC})
32 | target_include_directories(giflib
33 | PRIVATE ${GIFLIB_DIR}
34 | INTERFACE
35 | ${THIRDPARTY_DIR}/giflib
36 | ${THIRDPARTY_DIR}/msf_gif)
--------------------------------------------------------------------------------
/cmake/install.cmake:
--------------------------------------------------------------------------------
1 | ################################
2 | # Install
3 | ################################
4 |
5 | set(CPACK_PACKAGE_NAME "TIC-80")
6 | set(CPACK_PACKAGE_VENDOR "Nesbox")
7 | set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Fantasy computer for making, playing and sharing tiny games.")
8 | set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
9 | set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
10 | set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_REVISION}")
11 | set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
12 | set(CPACK_PACKAGE_INSTALL_DIRECTORY "TIC-80")
13 |
14 | if (APPLE)
15 |
16 | set(CPACK_GENERATOR "Bundle")
17 | set(CPACK_BUNDLE_NAME "tic80")
18 |
19 | configure_file(${CMAKE_SOURCE_DIR}/build/macosx/tic80.plist.in ${CMAKE_SOURCE_DIR}/build/macosx/tic80.plist)
20 | set(CPACK_BUNDLE_PLIST ${CMAKE_SOURCE_DIR}/build/macosx/tic80.plist)
21 |
22 | set(CPACK_BUNDLE_ICON ${CMAKE_SOURCE_DIR}/build/macosx/tic80.icns)
23 | set(CPACK_BUNDLE_STARTUP_COMMAND "${CMAKE_BINARY_DIR}/bin/tic80")
24 |
25 | install(CODE "set(CMAKE_INSTALL_LOCAL_ONLY true)")
26 | include(CPack)
27 | elseif (LINUX)
28 | set(CPACK_GENERATOR "DEB")
29 | set(CPACK_DEBIAN_PACKAGE_NAME "tic80")
30 | set(CPACK_DEBIAN_FILE_NAME "tic80.deb")
31 | set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://tic80.com")
32 | set(CPACK_DEBIAN_PACKAGE_VERSION ${PROJECT_VERSION})
33 | set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Nesbox ")
34 | set(CPACK_DEBIAN_PACKAGE_SECTION "education")
35 |
36 | if(RPI)
37 | set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE armhf)
38 | endif()
39 |
40 | install(CODE "set(CMAKE_INSTALL_LOCAL_ONLY true)")
41 | include(CPack)
42 | endif()
43 |
--------------------------------------------------------------------------------
/cmake/libretro.cmake:
--------------------------------------------------------------------------------
1 | ################################
2 | # libretro renderer example
3 | ################################
4 |
5 | if(BUILD_LIBRETRO)
6 | set(LIBRETRO_DIR ${TIC80CORE_DIR}/system/libretro)
7 | set(LIBRETRO_SRC
8 | ${LIBRETRO_DIR}/tic80_libretro.c
9 | )
10 |
11 | if (LIBRETRO_STATIC)
12 | add_library(tic80_libretro STATIC
13 | ${LIBRETRO_SRC}
14 | )
15 | if(EMSCRIPTEN)
16 | set(LIBRETRO_EXTENSION "bc")
17 | else()
18 | set(LIBRETRO_EXTENSION "a")
19 | endif()
20 |
21 | set_target_properties(tic80_libretro PROPERTIES SUFFIX "${LIBRETRO_SUFFIX}.${LIBRETRO_EXTENSION}")
22 | else()
23 | add_library(tic80_libretro SHARED
24 | ${LIBRETRO_SRC}
25 | )
26 | endif()
27 |
28 | target_include_directories(tic80_libretro PRIVATE
29 | ${CMAKE_CURRENT_BINARY_DIR}
30 | ${TIC80CORE_DIR}
31 | )
32 |
33 | if(MINGW)
34 | target_link_libraries(tic80_libretro mingw32)
35 | endif()
36 |
37 | if(ANDROID)
38 | set_target_properties(tic80_libretro PROPERTIES SUFFIX "_android.so")
39 | endif()
40 |
41 | # MSYS2 builds libretro to ./bin, despite it being a DLL. This forces it to ./lib.
42 | set_target_properties(tic80_libretro PROPERTIES
43 | RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
44 | )
45 |
46 | target_compile_definitions(tic80_libretro PRIVATE
47 | __LIBRETRO__=TRUE
48 | )
49 | target_link_libraries(tic80_libretro tic80core)
50 | set_target_properties(tic80_libretro PROPERTIES PREFIX "")
51 | endif()
--------------------------------------------------------------------------------
/cmake/moon.cmake:
--------------------------------------------------------------------------------
1 | ################################
2 | # MoonScript
3 | ################################
4 |
5 | option(BUILD_WITH_MOON "Moon Enabled" ${BUILD_WITH_ALL})
6 | message("BUILD_WITH_MOON: ${BUILD_WITH_MOON}")
7 |
8 | if(BUILD_WITH_MOON)
9 |
10 | set(LPEG_DIR ${THIRDPARTY_DIR}/lpeg)
11 | set(LPEG_SRC
12 | ${LPEG_DIR}/lpcap.c
13 | ${LPEG_DIR}/lpcode.c
14 | ${LPEG_DIR}/lpprint.c
15 | ${LPEG_DIR}/lptree.c
16 | ${LPEG_DIR}/lpvm.c
17 | )
18 |
19 | add_library(lpeg STATIC ${LPEG_SRC})
20 | target_include_directories(lpeg PRIVATE ${LUA_DIR})
21 |
22 | add_library(moon ${TIC_RUNTIME} ${CMAKE_SOURCE_DIR}/src/api/moonscript.c)
23 |
24 | if(NOT BUILD_STATIC)
25 | set_target_properties(moon PROPERTIES PREFIX "")
26 | else()
27 | target_compile_definitions(moon INTERFACE TIC_BUILD_WITH_MOON)
28 | endif()
29 |
30 | target_link_libraries(moon PRIVATE lpeg runtime luaapi)
31 |
32 | target_include_directories(moon
33 | PRIVATE
34 | ${THIRDPARTY_DIR}/moonscript
35 | ${CMAKE_SOURCE_DIR}/include
36 | ${CMAKE_SOURCE_DIR}/src
37 | )
38 |
39 |
40 | endif()
41 |
--------------------------------------------------------------------------------
/cmake/n3ds.cmake:
--------------------------------------------------------------------------------
1 | ################################
2 | # TIC-80 app (N3DS)
3 | ################################
4 |
5 | if(NINTENDO_3DS)
6 | set(TIC80_SRC ${TIC80_SRC}
7 | ${CMAKE_SOURCE_DIR}/src/system/n3ds/utils.c
8 | ${CMAKE_SOURCE_DIR}/src/system/n3ds/keyboard.c
9 | ${CMAKE_SOURCE_DIR}/src/system/n3ds/main.c
10 | )
11 |
12 | add_executable(tic80 ${TIC80_SRC})
13 |
14 | target_include_directories(tic80 PRIVATE
15 | ${DEVKITPRO}/portlibs/3ds/include
16 | ${CMAKE_SOURCE_DIR}/include
17 | ${CMAKE_SOURCE_DIR}/src)
18 |
19 | target_link_directories(tic80 PRIVATE ${DEVKITPRO}/libctru/lib ${DEVKITPRO}/portlibs/3ds/lib)
20 | target_link_libraries(tic80 tic80studio png citro3d)
21 |
22 | ctr_generate_smdh(tic80.smdh
23 | NAME "TIC-80 tiny computer"
24 | DESCRIPTION "Fantasy computer for making, playing and sharing tiny games"
25 | AUTHOR "Nesbox"
26 | ICON ${CMAKE_SOURCE_DIR}/build/n3ds/icon.png
27 | )
28 |
29 | ctr_create_3dsx(tic80
30 | SMDH tic80.smdh
31 | ROMFS ${CMAKE_SOURCE_DIR}/build/n3ds/romfs
32 | OUTPUT ${CMAKE_SOURCE_DIR}/build/bin/tic80.3dsx
33 | )
34 |
35 | endif()
--------------------------------------------------------------------------------
/cmake/naett.cmake:
--------------------------------------------------------------------------------
1 | ################################
2 | # naett
3 | ################################
4 |
5 | if(NOT RPI AND NOT NINTENDO_3DS AND NOT EMSCRIPTEN AND NOT BAREMETALPI)
6 | set(USE_NAETT TRUE)
7 | endif()
8 |
9 | # On Linux, naett requires curl. Disable naett if curl is not found.
10 | if(LINUX)
11 | find_package(CURL)
12 | if(NOT CURL_FOUND)
13 | set(USE_NAETT FALSE)
14 | endif()
15 | endif()
16 |
17 | if(PREFER_SYSTEM_LIBRARIES)
18 | find_path(naett_INCLUDE_DIR NAMES naett.h)
19 | find_library(naett_LIBRARY NAMES naett)
20 | if(naett_INCLUDE_DIR AND naett_LIBRARY)
21 | add_library(naett UNKNOWN IMPORTED GLOBAL)
22 | set_target_properties(naett PROPERTIES
23 | IMPORTED_LOCATION "${naett_LIBRARY}"
24 | INTERFACE_INCLUDE_DIRECTORIES "${naett_INCLUDE_DIR}"
25 | )
26 | message(STATUS "Use system library: naett")
27 | set(USE_NAETT TRUE)
28 | return()
29 | else()
30 | message(WARNING "System library naett not found")
31 | endif()
32 | endif()
33 |
34 | if(USE_NAETT)
35 | add_library(naett STATIC ${THIRDPARTY_DIR}/naett/naett.c)
36 | target_include_directories(naett PUBLIC ${THIRDPARTY_DIR}/naett)
37 |
38 | if(WIN32)
39 | target_link_libraries(naett INTERFACE winhttp)
40 | elseif(LINUX)
41 | target_include_directories(naett PRIVATE ${CURL_INCLUDE_DIRS})
42 | target_link_libraries(naett ${CURL_LIBRARIES} pthread)
43 | elseif(APPLE)
44 | target_link_libraries(naett
45 | "-framework Cocoa")
46 | endif()
47 | endif()
48 |
--------------------------------------------------------------------------------
/cmake/png.cmake:
--------------------------------------------------------------------------------
1 | ################################
2 | # PNG
3 | ################################
4 |
5 | if(PREFER_SYSTEM_LIBRARIES)
6 | find_package(PkgConfig)
7 | pkg_check_modules(libpng IMPORTED_TARGET GLOBAL libpng)
8 | if (libpng_FOUND)
9 | add_library(png ALIAS PkgConfig::libpng)
10 | message(STATUS "Use system library: libpng")
11 | return()
12 | else()
13 | message(WARNING "System library libpng not found")
14 | endif()
15 | endif()
16 |
17 |
18 | set(LIBPNG_DIR ${THIRDPARTY_DIR}/libpng)
19 | set(LIBPNG_SRC
20 | ${LIBPNG_DIR}/png.c
21 | ${LIBPNG_DIR}/pngerror.c
22 | ${LIBPNG_DIR}/pngget.c
23 | ${LIBPNG_DIR}/pngmem.c
24 | ${LIBPNG_DIR}/pngpread.c
25 | ${LIBPNG_DIR}/pngread.c
26 | ${LIBPNG_DIR}/pngrio.c
27 | ${LIBPNG_DIR}/pngrtran.c
28 | ${LIBPNG_DIR}/pngrutil.c
29 | ${LIBPNG_DIR}/pngset.c
30 | ${LIBPNG_DIR}/pngtrans.c
31 | ${LIBPNG_DIR}/pngwio.c
32 | ${LIBPNG_DIR}/pngwrite.c
33 | ${LIBPNG_DIR}/pngwtran.c
34 | ${LIBPNG_DIR}/pngwutil.c
35 | )
36 |
37 | configure_file(${LIBPNG_DIR}/scripts/pnglibconf.h.prebuilt ${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
38 |
39 | add_library(png STATIC ${LIBPNG_SRC})
40 |
41 | target_compile_definitions(png PRIVATE PNG_ARM_NEON_OPT=0)
42 |
43 | target_include_directories(png
44 | PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
45 | PRIVATE ${THIRDPARTY_DIR}/zlib
46 | INTERFACE ${THIRDPARTY_DIR}/libpng)
--------------------------------------------------------------------------------
/cmake/pocketpy.cmake:
--------------------------------------------------------------------------------
1 | ################################
2 | # pocketpy (Python)
3 | ################################
4 |
5 | option(BUILD_WITH_PYTHON "Python Enabled" ${BUILD_WITH_ALL})
6 | message("BUILD_WITH_PYTHON: ${BUILD_WITH_PYTHON}")
7 | if(BUILD_WITH_PYTHON)
8 | option(PK_ENABLE_OS "" OFF)
9 | option(PK_BUILD_MODULE_LZ4 "" OFF)
10 |
11 | if(NOT WIN32)
12 | option(PK_BUILD_WITH_IPO "" OFF)
13 | endif()
14 |
15 | add_subdirectory(${THIRDPARTY_DIR}/pocketpy)
16 |
17 | if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
18 | target_compile_options(pocketpy PRIVATE -Wno-psabi)
19 | endif()
20 |
21 | set(PYTHON_SRC
22 | ${CMAKE_SOURCE_DIR}/src/api/python.c
23 | ${CMAKE_SOURCE_DIR}/src/api/parse_note.c
24 | )
25 |
26 | add_library(python ${TIC_RUNTIME} ${PYTHON_SRC})
27 |
28 | if(NOT BUILD_STATIC)
29 | set_target_properties(python PROPERTIES PREFIX "")
30 | else()
31 | target_compile_definitions(python INTERFACE TIC_BUILD_WITH_PYTHON=1)
32 | endif()
33 |
34 | target_link_libraries(python PRIVATE runtime)
35 |
36 | target_include_directories(python
37 | PRIVATE
38 | ${THIRDPARTY_DIR}/pocketpy/include
39 | ${CMAKE_SOURCE_DIR}/include
40 | ${CMAKE_SOURCE_DIR}/src
41 | )
42 |
43 | target_link_libraries(python PRIVATE pocketpy)
44 | endif()
45 |
--------------------------------------------------------------------------------
/cmake/scheme.cmake:
--------------------------------------------------------------------------------
1 | ################################
2 | # SCHEME (S7)
3 | ################################
4 |
5 | option(BUILD_WITH_SCHEME "Scheme Enabled" ${BUILD_WITH_ALL})
6 | message("BUILD_WITH_SCHEME: ${BUILD_WITH_SCHEME}")
7 |
8 | if(BUILD_WITH_SCHEME)
9 |
10 | set(SCHEME_DIR ${THIRDPARTY_DIR}/s7)
11 | set(SCHEME_SRC ${SCHEME_DIR}/s7.c)
12 |
13 | list(APPEND SCHEME_SRC ${CMAKE_SOURCE_DIR}/src/api/scheme.c)
14 |
15 | add_library(scheme ${TIC_RUNTIME} ${SCHEME_SRC})
16 |
17 | if(NOT BUILD_STATIC)
18 | set_target_properties(scheme PROPERTIES PREFIX "")
19 | else()
20 | target_compile_definitions(scheme INTERFACE TIC_BUILD_WITH_SCHEME=1)
21 | endif()
22 |
23 | target_link_libraries(scheme PRIVATE runtime)
24 |
25 | set_target_properties(scheme PROPERTIES LINKER_LANGUAGE CXX)
26 | target_include_directories(scheme
27 | PUBLIC ${SCHEME_DIR}
28 | PRIVATE
29 | ${CMAKE_SOURCE_DIR}/include
30 | ${CMAKE_SOURCE_DIR}/src
31 | )
32 |
33 | if (NINTENDO_3DS)
34 | target_compile_definitions(scheme PRIVATE S7_N3DS)
35 | endif()
36 |
37 | if (BAREMETALPI)
38 | target_compile_definitions(scheme PRIVATE S7_BAREMETALPI)
39 | endif()
40 |
41 |
42 | endif()
--------------------------------------------------------------------------------
/cmake/studio.cmake:
--------------------------------------------------------------------------------
1 | ################################
2 | # TIC-80 studio
3 | ################################
4 |
5 | set(TIC80LIB_DIR ${CMAKE_SOURCE_DIR}/src)
6 | set(TIC80STUDIO_SRC
7 | ${TIC80LIB_DIR}/studio/screens/run.c
8 | ${TIC80LIB_DIR}/studio/screens/menu.c
9 | ${TIC80LIB_DIR}/studio/screens/mainmenu.c
10 | ${TIC80LIB_DIR}/studio/screens/start.c
11 | ${TIC80LIB_DIR}/studio/studio.c
12 | ${TIC80LIB_DIR}/studio/config.c
13 | ${TIC80LIB_DIR}/studio/fs.c
14 | ${TIC80LIB_DIR}/ext/md5.c
15 | ${TIC80LIB_DIR}/ext/json.c
16 | )
17 |
18 | if(BUILD_EDITORS)
19 | set(TIC80STUDIO_SRC ${TIC80STUDIO_SRC}
20 | ${TIC80LIB_DIR}/studio/screens/console.c
21 | ${TIC80LIB_DIR}/studio/screens/surf.c
22 | ${TIC80LIB_DIR}/studio/editors/code.c
23 | ${TIC80LIB_DIR}/studio/editors/sprite.c
24 | ${TIC80LIB_DIR}/studio/editors/map.c
25 | ${TIC80LIB_DIR}/studio/editors/world.c
26 | ${TIC80LIB_DIR}/studio/editors/sfx.c
27 | ${TIC80LIB_DIR}/studio/editors/music.c
28 | ${TIC80LIB_DIR}/studio/net.c
29 | ${TIC80LIB_DIR}/ext/history.c
30 | ${TIC80LIB_DIR}/ext/gif.c
31 | ${TIC80LIB_DIR}/ext/png.c
32 | )
33 | endif()
34 |
35 | if(BUILD_PRO)
36 | set(TIC80STUDIO_SRC ${TIC80STUDIO_SRC}
37 | ${TIC80LIB_DIR}/studio/project.c)
38 | endif()
39 |
40 | set(TIC80_OUTPUT tic80)
41 |
42 | add_library(tic80studio STATIC
43 | ${TIC80STUDIO_SRC}
44 | ${CMAKE_SOURCE_DIR}/build/assets/cart.png.dat)
45 |
46 | target_include_directories(tic80studio
47 | PRIVATE ${THIRDPARTY_DIR}/jsmn
48 | PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
49 | )
50 |
51 | target_link_libraries(tic80studio PUBLIC tic80core PRIVATE zip wave_writer argparse giflib png)
52 |
53 | if(USE_NAETT)
54 | target_compile_definitions(tic80studio PRIVATE USE_NAETT)
55 | target_link_libraries(tic80studio PRIVATE naett)
56 | endif()
57 |
58 | if(BUILD_PRO)
59 | target_compile_definitions(tic80studio PRIVATE TIC80_PRO)
60 | endif()
61 |
62 | if(BUILD_SDLGPU)
63 | target_compile_definitions(tic80studio PUBLIC CRT_SHADER_SUPPORT)
64 | endif()
65 |
66 | if(BUILD_EDITORS)
67 | target_compile_definitions(tic80studio PUBLIC BUILD_EDITORS)
68 | endif()
69 |
--------------------------------------------------------------------------------
/cmake/tools.cmake:
--------------------------------------------------------------------------------
1 | ################################
2 | # bin2txt cart2prj prj2cart xplode wasmp2cart
3 | ################################
4 |
5 | if(BUILD_TOOLS)
6 |
7 | set(TOOLS_DIR ${CMAKE_SOURCE_DIR}/build/tools)
8 |
9 | add_executable(cart2prj ${TOOLS_DIR}/cart2prj.c ${CMAKE_SOURCE_DIR}/src/studio/project.c)
10 | target_include_directories(cart2prj PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/include)
11 | target_link_libraries(cart2prj tic80core)
12 |
13 | add_executable(prj2cart ${TOOLS_DIR}/prj2cart.c ${CMAKE_SOURCE_DIR}/src/studio/project.c)
14 | target_include_directories(prj2cart PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/include)
15 | target_link_libraries(prj2cart tic80core)
16 |
17 | add_executable(wasmp2cart ${TOOLS_DIR}/wasmp2cart.c ${CMAKE_SOURCE_DIR}/src/studio/project.c)
18 | target_include_directories(wasmp2cart PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/include)
19 | target_link_libraries(wasmp2cart tic80core)
20 |
21 | add_executable(bin2txt ${TOOLS_DIR}/bin2txt.c)
22 | target_link_libraries(bin2txt zlib)
23 |
24 | add_executable(xplode
25 | ${TOOLS_DIR}/xplode.c
26 | ${CMAKE_SOURCE_DIR}/src/ext/png.c
27 | ${CMAKE_SOURCE_DIR}/src/studio/project.c)
28 |
29 | target_include_directories(xplode PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/include)
30 | target_link_libraries(xplode tic80core png)
31 |
32 | if(LINUX)
33 | target_link_libraries(xplode m)
34 | endif()
35 |
36 | endif()
--------------------------------------------------------------------------------
/cmake/version.cmake:
--------------------------------------------------------------------------------
1 | set(VERSION_MAJOR 1)
2 | set(VERSION_MINOR 2)
3 | set(VERSION_REVISION 0)
4 | set(VERSION_STATUS "-dev")
5 | string(TIMESTAMP VERSION_YEAR "%Y")
6 |
7 | if(CMAKE_BUILD_TYPE STREQUAL "Debug")
8 | set(VERSION_BUILD ".dbg" )
9 | endif()
10 |
11 | find_package(Git)
12 | if(Git_FOUND)
13 | execute_process(
14 | COMMAND ${GIT_EXECUTABLE} status
15 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
16 | ERROR_VARIABLE RESULT_STRING
17 | OUTPUT_STRIP_TRAILING_WHITESPACE
18 | )
19 |
20 | string(LENGTH "${RESULT_STRING}" LENGTH_RESULT_STRING)
21 |
22 | if(${LENGTH_RESULT_STRING} EQUAL 0)
23 |
24 | execute_process(
25 | COMMAND ${GIT_EXECUTABLE} log -1 --format=%H
26 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
27 | OUTPUT_VARIABLE GIT_COMMIT_HASH
28 | OUTPUT_STRIP_TRAILING_WHITESPACE
29 | )
30 |
31 | string(SUBSTRING ${GIT_COMMIT_HASH} 0 7 GIT_COMMIT_HASH)
32 | set(VERSION_HASH ${GIT_COMMIT_HASH} )
33 |
34 | execute_process(
35 | COMMAND ${GIT_EXECUTABLE} rev-list HEAD --count
36 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
37 | OUTPUT_VARIABLE VERSION_REVISION
38 | OUTPUT_STRIP_TRAILING_WHITESPACE
39 | )
40 |
41 | endif()
42 | endif()
--------------------------------------------------------------------------------
/cmake/wasm.cmake:
--------------------------------------------------------------------------------
1 | ################################
2 | # WASM
3 | ################################
4 |
5 | option(BUILD_WITH_WASM "Wasm Enabled" ${BUILD_WITH_ALL})
6 | message("BUILD_WITH_WASM: ${BUILD_WITH_WASM}")
7 |
8 | if(BUILD_WITH_WASM AND PREFER_SYSTEM_LIBRARIES)
9 | find_path(wasm_INCLUDE_DIR NAMES wasm3.h)
10 | find_library(wasm_LIBRARY NAMES m3)
11 | if(wasm_INCLUDE_DIR AND wasm_LIBRARY)
12 | add_library(wasm STATIC
13 | ${CMAKE_SOURCE_DIR}/src/api/wasm.c
14 | )
15 | target_compile_definitions(wasm INTERFACE TIC_BUILD_WITH_WASM)
16 | target_link_libraries(wasm PRIVATE runtime ${wasm_LIBRARY})
17 | target_include_directories(wasm
18 | PUBLIC ${wasm_INCLUDE_DIR}
19 | PRIVATE
20 | ${CMAKE_SOURCE_DIR}/include
21 | ${CMAKE_SOURCE_DIR}/src
22 | )
23 | message(STATUS "Use system library: wasm")
24 | return()
25 | else()
26 | message(WARNING "System library wasm not found")
27 | endif()
28 | endif()
29 |
30 | if(BUILD_WITH_WASM)
31 |
32 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Dd_m3LogOutput=0")
33 | set(WASM_DIR ${THIRDPARTY_DIR}/wasm3/source)
34 | set(WASM_SRC
35 | ${WASM_DIR}/m3_bind.c
36 | ${WASM_DIR}/m3_code.c
37 | ${WASM_DIR}/m3_compile.c
38 | ${WASM_DIR}/m3_core.c
39 | ${WASM_DIR}/m3_parse.c
40 | ${WASM_DIR}/m3_env.c
41 | ${WASM_DIR}/m3_exec.c
42 | ${WASM_DIR}/m3_function.c
43 | ${WASM_DIR}/m3_info.c
44 | ${WASM_DIR}/m3_module.c
45 | )
46 |
47 | list(APPEND WASM_SRC ${CMAKE_SOURCE_DIR}/src/api/wasm.c)
48 |
49 | add_library(wasm ${TIC_RUNTIME} ${WASM_SRC})
50 |
51 | if(NOT BUILD_STATIC)
52 | set_target_properties(wasm PROPERTIES PREFIX "")
53 | else()
54 | target_compile_definitions(wasm INTERFACE TIC_BUILD_WITH_WASM=1)
55 | endif()
56 |
57 | target_link_libraries(wasm PRIVATE runtime)
58 |
59 | target_include_directories(wasm
60 | PUBLIC ${WASM_DIR}
61 | PRIVATE
62 | ${CMAKE_SOURCE_DIR}/include
63 | ${CMAKE_SOURCE_DIR}/src
64 | )
65 |
66 |
67 | endif()
--------------------------------------------------------------------------------
/cmake/wave.cmake:
--------------------------------------------------------------------------------
1 | ################################
2 | # Wave writer
3 | ################################
4 |
5 | add_library(wave_writer STATIC ${THIRDPARTY_DIR}/blip-buf/wave_writer.c)
6 | target_include_directories(wave_writer INTERFACE ${THIRDPARTY_DIR}/blip-buf)
7 |
--------------------------------------------------------------------------------
/cmake/wren.cmake:
--------------------------------------------------------------------------------
1 | ################################
2 | # WREN
3 | ################################
4 |
5 | option(BUILD_WITH_WREN "WREN Enabled" ${BUILD_WITH_ALL})
6 | message("BUILD_WITH_WREN: ${BUILD_WITH_WREN}")
7 |
8 | if(BUILD_WITH_WREN)
9 |
10 | set(WREN_DIR ${THIRDPARTY_DIR}/wren/src)
11 | set(WREN_SRC
12 | ${WREN_DIR}/optional/wren_opt_meta.c
13 | ${WREN_DIR}/optional/wren_opt_random.c
14 | ${WREN_DIR}/vm/wren_compiler.c
15 | ${WREN_DIR}/vm/wren_core.c
16 | ${WREN_DIR}/vm/wren_debug.c
17 | ${WREN_DIR}/vm/wren_primitive.c
18 | ${WREN_DIR}/vm/wren_utils.c
19 | ${WREN_DIR}/vm/wren_value.c
20 | ${WREN_DIR}/vm/wren_vm.c
21 | )
22 |
23 | list(APPEND WREN_SRC ${CMAKE_SOURCE_DIR}/src/api/wren.c)
24 | list(APPEND WREN_SRC ${CMAKE_SOURCE_DIR}/src/api/parse_note.c)
25 |
26 | add_library(wren ${TIC_RUNTIME} ${WREN_SRC})
27 |
28 | if(NOT BUILD_STATIC)
29 | set_target_properties(wren PROPERTIES PREFIX "")
30 | else()
31 | target_compile_definitions(wren INTERFACE TIC_BUILD_WITH_WREN=1)
32 | endif()
33 |
34 | target_link_libraries(wren PRIVATE runtime)
35 |
36 | target_include_directories(wren
37 | PRIVATE
38 | ${CMAKE_SOURCE_DIR}/include
39 | ${CMAKE_SOURCE_DIR}/src
40 | )
41 |
42 | target_include_directories(wren PUBLIC ${THIRDPARTY_DIR}/wren/src/include)
43 | target_include_directories(wren PRIVATE ${THIRDPARTY_DIR}/wren/src/optional)
44 | target_include_directories(wren PRIVATE ${THIRDPARTY_DIR}/wren/src/vm)
45 |
46 | endif()
--------------------------------------------------------------------------------
/cmake/zip.cmake:
--------------------------------------------------------------------------------
1 | ################################
2 | # ZIP
3 | ################################
4 |
5 | if(PREFER_SYSTEM_LIBRARIES)
6 | find_path(zip_INCLUDE_DIR NAMES zip.h PATH_SUFFIXES zip)
7 | find_library(zip_LIBRARY NAMES zip)
8 | if(zip_INCLUDE_DIR AND zip_LIBRARY)
9 | add_library(zip UNKNOWN IMPORTED GLOBAL)
10 | set_target_properties(zip PROPERTIES
11 | IMPORTED_LOCATION "${zip_LIBRARY}"
12 | INTERFACE_INCLUDE_DIRECTORIES "${zip_INCLUDE_DIR}"
13 | )
14 | message(STATUS "Use system library: kubazip")
15 | return()
16 | else()
17 | message(WARNING "System library kubazip not found")
18 | endif()
19 | endif()
20 |
21 | set(CMAKE_DISABLE_TESTING ON CACHE BOOL "" FORCE)
22 | add_subdirectory(${THIRDPARTY_DIR}/zip)
23 |
--------------------------------------------------------------------------------
/cmake/zlib.cmake:
--------------------------------------------------------------------------------
1 | ################################
2 | # ZLIB
3 | ################################
4 |
5 | if(PREFER_SYSTEM_LIBRARIES)
6 | find_package(PkgConfig)
7 | pkg_check_modules(zlib IMPORTED_TARGET GLOBAL zlib)
8 | if (zlib_FOUND)
9 | add_library(zlib ALIAS PkgConfig::zlib)
10 | message(STATUS "Use system library: zlib")
11 | return()
12 | else()
13 | message(WARNING "System library zlib not found")
14 | endif()
15 | endif()
16 |
17 | if (NOT NINTENDO_3DS)
18 |
19 | set(ZLIB_DIR ${THIRDPARTY_DIR}/zlib)
20 | set(ZLIB_SRC
21 | ${ZLIB_DIR}/adler32.c
22 | ${ZLIB_DIR}/compress.c
23 | ${ZLIB_DIR}/crc32.c
24 | ${ZLIB_DIR}/deflate.c
25 | ${ZLIB_DIR}/inflate.c
26 | ${ZLIB_DIR}/infback.c
27 | ${ZLIB_DIR}/inftrees.c
28 | ${ZLIB_DIR}/inffast.c
29 | ${ZLIB_DIR}/trees.c
30 | ${ZLIB_DIR}/uncompr.c
31 | ${ZLIB_DIR}/zutil.c
32 | )
33 |
34 | add_library(zlib STATIC ${ZLIB_SRC})
35 | target_include_directories(zlib INTERFACE ${THIRDPARTY_DIR}/zlib)
36 |
37 | else ()
38 |
39 | add_library(zlib STATIC IMPORTED)
40 | set_target_properties( zlib PROPERTIES IMPORTED_LOCATION ${DEVKITPRO}/portlibs/3ds/lib/libz.a )
41 | target_include_directories(zlib INTERFACE ${DEVKITPRO}/portlibs/3ds/include)
42 |
43 | endif ()
--------------------------------------------------------------------------------
/demos/bunny/wasmmark/README.md:
--------------------------------------------------------------------------------
1 | # Bunnymark in Zig / WASM
2 |
3 | This is a Zig project. To build it you'll need the latest Zig development release (`0.14.0-dev.1421+f87dd43c1` or newer).
4 |
5 | ### Building
6 |
7 | ```
8 | zig build --release=small
9 | ```
10 |
11 | ### Replacing the assets used to build TIC-80
12 |
13 | Copy the build over the canonical WASM file:
14 |
15 | ```
16 | cp zig-out/bin/cart.wasm wasmmark.wasm
17 | ```
18 |
19 | During a TIC-80 build the `wasm` and `wasmp` file will be merged into a single demo cartridge and embedded into the TIC-80 binary.
20 |
--------------------------------------------------------------------------------
/demos/bunny/wasmmark/build.zig:
--------------------------------------------------------------------------------
1 | const std = @import("std");
2 |
3 | pub fn build(b: *std.Build) !void {
4 | const optimize = b.standardOptimizeOption(.{});
5 | const target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding });
6 | const exe = b.addExecutable(.{
7 | .name = "cart",
8 | .root_source_file = b.path("src/main.zig"),
9 | .target = target,
10 | .optimize = optimize,
11 | });
12 |
13 | exe.rdynamic = true;
14 | exe.entry = .disabled;
15 | exe.import_memory = true;
16 | exe.stack_size = 8192;
17 | exe.initial_memory = 65536 * 4;
18 | exe.max_memory = 65536 * 4;
19 | exe.export_table = true;
20 |
21 | // all the memory below 96kb is reserved for TIC and memory mapped I/O
22 | // so our own usage must start above the 96kb mark
23 | exe.global_base = 96 * 1024;
24 |
25 | b.installArtifact(exe);
26 | }
27 |
--------------------------------------------------------------------------------
/demos/bunny/wasmmark/wasmmark.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/demos/bunny/wasmmark/wasmmark.wasm
--------------------------------------------------------------------------------
/demos/bunny/wasmmark/wasmmark.wasmp:
--------------------------------------------------------------------------------
1 | -- title: Bunnymark in Zig
2 | -- author: Josh Goebel
3 | -- desc: Benchmarking tool to see how many bunnies can fly around the screen, using Lua.
4 | -- input: gamepad
5 | -- script: wasm
6 | -- license: MIT
7 | -- version: 0.1
8 |
9 | """""""""""""""""""""""""""""""""""""""
10 |
11 | This is a WASM binary project, you
12 | won't find the Zig source here.
13 |
14 | For source code see the TIC-80
15 | repository folder:
16 |
17 | /demos/bunny/wasmmark/
18 |
19 | "
20 |
21 | --
22 | -- 001:11111100111110dd111110dc111110dc111110dc111110dc111110dd111110dd
23 | -- 002:00011110ddd0110dccd0110dccd0110dccd0110dccd0110dcddd00dddddddddd
24 | -- 003:00001111dddd0111cccd0111cccd0111cccd0111cccd0111dcdd0111dddd0111
25 | -- 004:1111111111111111111111111111111111111111111111111111111111111111
26 | -- 017:111110dd111110dd111110dd111110dd10000ddd1eeeeddd1eeeeedd10000eed
27 | -- 018:d0ddddddd0ddddddddddddddddd0000dddddccddddddccdddddddddddddddddd
28 | -- 019:0ddd01110ddd0111dddd0111dddd0111ddddd000ddddddddddddddddddddd000
29 | -- 020:1111111111111111111111111111111101111111d0111111d011111101111111
30 | -- 033:111110ee111110ee111110ee111110ee111110ee111110ee111110ee111110ee
31 | -- 034:dddcccccddccccccddccccccddccccccddccccccdddcccccdddddddddddddddd
32 | -- 035:dddd0111cddd0111cddd0111cddd0111cddd0111dddd0111dddd0111dddd0111
33 | -- 036:1111111111111111111111111111111111111111111111111111111111111111
34 | -- 049:111110ee111110ee111110ee111110ee111110ee111110ee111110ee11111100
35 | -- 050:dddeeeeeddeeeeeed00000000111111101111111011111110111111111111111
36 | -- 051:eddd0111eedd01110eed011110ee011110ee011110ee011110ee011111001111
37 | -- 052:1111111111111111111111111111111111111111111111111111111111111111
38 | --
39 |
40 | --
41 | -- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
42 | --
43 |
--------------------------------------------------------------------------------
/demos/fenneldemo.fnl:
--------------------------------------------------------------------------------
1 | ;; title: game title
2 | ;; author: game developer, email, etc.
3 | ;; desc: short description
4 | ;; site: website link
5 | ;; license: MIT License (change this to your license of choice)
6 | ;; version: 0.1
7 | ;; script: fennel
8 | ;; strict: true
9 |
10 | (var t 0)
11 | (var x 96)
12 | (var y 24)
13 |
14 | (fn _G.TIC []
15 | (when (btn 0) (set y (- y 1)))
16 | (when (btn 1) (set y (+ y 1)))
17 | (when (btn 2) (set x (- x 1)))
18 | (when (btn 3) (set x (+ x 1)))
19 | (cls 0)
20 | (spr (+ 1 (* (// (% t 60) 30) 2))
21 | x y 14 3 0 0 2 2)
22 | (print "HELLO WORLD!" 84 84)
23 | (set t (+ t 1)))
24 |
25 | ;;
26 | ;; 001:eccccccccc888888caaaaaaaca888888cacccccccacc0ccccacc0ccccacc0ccc
27 | ;; 002:ccccceee8888cceeaaaa0cee888a0ceeccca0ccc0cca0c0c0cca0c0c0cca0c0c
28 | ;; 003:eccccccccc888888caaaaaaaca888888cacccccccacccccccacc0ccccacc0ccc
29 | ;; 004:ccccceee8888cceeaaaa0cee888a0ceeccca0cccccca0c0c0cca0c0c0cca0c0c
30 | ;; 017:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
31 | ;; 018:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
32 | ;; 019:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
33 | ;; 020:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
34 | ;;
35 |
36 | ;;
37 | ;; 000:00000000ffffffff00000000ffffffff
38 | ;; 001:0123456789abcdeffedcba9876543210
39 | ;; 002:0123456789abcdef0123456789abcdef
40 | ;;
41 |
42 | ;;
43 | ;; 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
44 | ;;
45 |
46 | ;;
47 | ;; 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
48 | ;;
49 |
50 | ;;
51 | ;; 000:100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
52 | ;;
53 |
--------------------------------------------------------------------------------
/demos/fire.lua:
--------------------------------------------------------------------------------
1 | -- title: fire
2 | -- author: by Filippo
3 | -- desc: fire demo
4 | -- script: lua
5 | -- input: gamepad
6 |
7 | t=0
8 | x=120
9 | y=120
10 |
11 | particle = {}
12 | palette = {14,9,6,3,10,15}
13 |
14 | function addParticle(x,y)
15 | local p = {}
16 | p.x = x
17 | p.y = y
18 | p.dx = math.random(-10.0,10.0)/150.0
19 | p.dy = math.random(-10.0,-2)/50
20 | p.t = 0
21 | table.insert(particle,p)
22 | end
23 |
24 | function ticParticle()
25 | --print("#"..#particle)
26 | local s=0
27 | local s2=0
28 | local c=0
29 | for k,p in pairs(particle) do
30 | p.t = p.t + 1
31 | s = math.log(p.t / 2.0)
32 | s2 = s/2.0
33 | c = palette[math.ceil(p.t/70)]
34 | p.x = p.x + p.dx
35 | p.y = p.y + p.dy
36 |
37 | rect(p.x-s2,p.y-s2,s,s,c)
38 |
39 | --remove old ones
40 | if p.t > 300 then
41 | table.remove(particle,k)
42 | end
43 | end
44 | end
45 |
46 | function TIC()
47 |
48 | if btn(0) then y=y-1 end
49 | if btn(1) then y=y+1 end
50 | if btn(2) then x=x-1 end
51 | if btn(3) then x=x+1 end
52 |
53 | --warp space
54 | x = x % 240
55 | y = y % 136
56 |
57 | --reset
58 | if btn(4) then
59 | x = 120
60 | y = 120
61 | end
62 |
63 | addParticle(x,y)
64 | addParticle(30,130)
65 | addParticle(210,130)
66 |
67 | cls(8)
68 |
69 | --Update & Draw particles
70 | ticParticle()
71 |
72 | --cursor
73 | pix(x,y,7)
74 |
75 | print("! FIRE !",94,64)
76 | t=t+1
77 | end
78 |
79 | --
80 | -- 001:a000000aa0f00f0aaaaaaaaaaafaaa6aafffaaaaaafaa6aaaaaaaaaa33333333
81 | -- 002:a000000aa060060aaaaaaaaaaafaaa6aafffaaaaaafaa6aaaaaaaaaa33333333
82 | -- 017:e963af00e963af00e963af00e963af00e963af00e963af00e963af00e963af00
83 | --
84 |
85 | --
86 | -- 000:140c1c44243430346d4e4a4e854c30346524d04648757161597dced27d2c8595a16daa2cd2aa996dc2cadad45edeeed6
87 | --
88 |
89 |
--------------------------------------------------------------------------------
/demos/janetdemo.janet:
--------------------------------------------------------------------------------
1 | # title: game title
2 | # author: game developer, email, etc.
3 | # desc: short description
4 | # site: website link
5 | # license: MIT License (change this to your license of choice)
6 | # version: 0.1
7 | # script: janet
8 | # strict: true
9 |
10 | # Unlike other languages, the tic80 API
11 | # is provided as a module.
12 | (import tic80)
13 |
14 | (var t 0)
15 | (var x 96)
16 | (var y 24)
17 |
18 | (defn TIC []
19 | (when (tic80/btn 0) (-- y))
20 | (when (tic80/btn 1) (++ y))
21 | (when (tic80/btn 2) (-- x))
22 | (when (tic80/btn 3) (++ x))
23 | (tic80/cls 13)
24 | (tic80/spr (if (> (% t 60) 30) 1 3)
25 | x y 14 3 0 0 2 2)
26 | (tic80/print "HELLO WORLD!" 84 84)
27 | (++ t))
28 |
29 | #
30 | # 001:eccccccccc888888caaaaaaaca888888cacccccccacc0ccccacc0ccccacc0ccc
31 | # 002:ccccceee8888cceeaaaa0cee888a0ceeccca0ccc0cca0c0c0cca0c0c0cca0c0c
32 | # 003:eccccccccc888888caaaaaaaca888888cacccccccacccccccacc0ccccacc0ccc
33 | # 004:ccccceee8888cceeaaaa0cee888a0ceeccca0cccccca0c0c0cca0c0c0cca0c0c
34 | # 017:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
35 | # 018:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
36 | # 019:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
37 | # 020:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
38 | #
39 |
40 | #
41 | # 000:00000000ffffffff00000000ffffffff
42 | # 001:0123456789abcdeffedcba9876543210
43 | # 002:0123456789abcdef0123456789abcdef
44 | #
45 |
46 | #
47 | # 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
48 | #
49 |
50 | #
51 | # 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
52 | #
53 |
54 | #
55 | # 000:100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
56 | #
57 |
--------------------------------------------------------------------------------
/demos/jsdemo.js:
--------------------------------------------------------------------------------
1 | // title: game title
2 | // author: game developer, email, etc.
3 | // desc: short description
4 | // site: website link
5 | // license: MIT License (change this to your license of choice)
6 | // version: 0.1
7 | // script: js
8 |
9 | var t=0
10 | var x=96
11 | var y=24
12 |
13 | function TIC()
14 | {
15 | if(btn(0))y--
16 | if(btn(1))y++
17 | if(btn(2))x--
18 | if(btn(3))x++
19 |
20 | cls(13)
21 | spr(1+((t%60)/30|0)*2,x,y,14,3,0,0,2,2)
22 | print("HELLO WORLD!",84,84)
23 | t++
24 | }
25 |
26 | //
27 | // 001:eccccccccc888888caaaaaaaca888888cacccccccacc0ccccacc0ccccacc0ccc
28 | // 002:ccccceee8888cceeaaaa0cee888a0ceeccca0ccc0cca0c0c0cca0c0c0cca0c0c
29 | // 003:eccccccccc888888caaaaaaaca888888cacccccccacccccccacc0ccccacc0ccc
30 | // 004:ccccceee8888cceeaaaa0cee888a0ceeccca0cccccca0c0c0cca0c0c0cca0c0c
31 | // 017:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
32 | // 018:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
33 | // 019:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
34 | // 020:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
35 | //
36 |
37 | //
38 | // 000:00000000ffffffff00000000ffffffff
39 | // 001:0123456789abcdeffedcba9876543210
40 | // 002:0123456789abcdef0123456789abcdef
41 | //
42 |
43 | //
44 | // 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
45 | //
46 |
47 | //
48 | // 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
49 | //
50 |
51 | //
52 | // 000:100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
53 | //
54 |
--------------------------------------------------------------------------------
/demos/luademo.lua:
--------------------------------------------------------------------------------
1 | -- title: game title
2 | -- author: game developer, email, etc.
3 | -- desc: short description
4 | -- site: website link
5 | -- license: MIT License (change this to your license of choice)
6 | -- version: 0.1
7 | -- script: lua
8 |
9 | t=0
10 | x=96
11 | y=24
12 |
13 | function TIC()
14 |
15 | if btn(0) then y=y-1 end
16 | if btn(1) then y=y+1 end
17 | if btn(2) then x=x-1 end
18 | if btn(3) then x=x+1 end
19 |
20 | cls(13)
21 | spr(1+t%60//30*2,x,y,14,3,0,0,2,2)
22 | print("HELLO WORLD!",84,84)
23 | t=t+1
24 | end
25 |
26 | --
27 | -- 001:eccccccccc888888caaaaaaaca888888cacccccccacc0ccccacc0ccccacc0ccc
28 | -- 002:ccccceee8888cceeaaaa0cee888a0ceeccca0ccc0cca0c0c0cca0c0c0cca0c0c
29 | -- 003:eccccccccc888888caaaaaaaca888888cacccccccacccccccacc0ccccacc0ccc
30 | -- 004:ccccceee8888cceeaaaa0cee888a0ceeccca0cccccca0c0c0cca0c0c0cca0c0c
31 | -- 017:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
32 | -- 018:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
33 | -- 019:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
34 | -- 020:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
35 | --
36 |
37 | --
38 | -- 000:00000000ffffffff00000000ffffffff
39 | -- 001:0123456789abcdeffedcba9876543210
40 | -- 002:0123456789abcdef0123456789abcdef
41 | --
42 |
43 | --
44 | -- 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
45 | --
46 |
47 | --
48 | -- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
49 | --
50 |
51 | --
52 | -- 000:100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
53 | --
54 |
--------------------------------------------------------------------------------
/demos/moondemo.moon:
--------------------------------------------------------------------------------
1 | -- title: game title
2 | -- author: game developer, email, etc.
3 | -- desc: short description
4 | -- site: website link
5 | -- license: MIT License (change this to your license of choice)
6 | -- version: 0.1
7 | -- script: moon
8 |
9 | t=0
10 | x=96
11 | y=24
12 |
13 | export TIC=->
14 | if btn 0
15 | y-=1
16 | if btn 1
17 | y+=1
18 | if btn 2
19 | x-=1
20 | if btn 3
21 | x+=1
22 |
23 | cls 13
24 | spr 1+(t%60)//30*2,x,y,14,3,0,0,2,2
25 | print "HELLO WORLD!",84,84
26 | t+=1
27 |
28 | --
29 | -- 001:eccccccccc888888caaaaaaaca888888cacccccccacc0ccccacc0ccccacc0ccc
30 | -- 002:ccccceee8888cceeaaaa0cee888a0ceeccca0ccc0cca0c0c0cca0c0c0cca0c0c
31 | -- 003:eccccccccc888888caaaaaaaca888888cacccccccacccccccacc0ccccacc0ccc
32 | -- 004:ccccceee8888cceeaaaa0cee888a0ceeccca0cccccca0c0c0cca0c0c0cca0c0c
33 | -- 017:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
34 | -- 018:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
35 | -- 019:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
36 | -- 020:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
37 | --
38 |
39 | --
40 | -- 000:00000000ffffffff00000000ffffffff
41 | -- 001:0123456789abcdeffedcba9876543210
42 | -- 002:0123456789abcdef0123456789abcdef
43 | --
44 |
45 | --
46 | -- 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
47 | --
48 |
49 | --
50 | -- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
51 | --
52 |
53 | --
54 | -- 000:100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
55 | --
56 |
--------------------------------------------------------------------------------
/demos/pythondemo.py:
--------------------------------------------------------------------------------
1 | # title: game title
2 | # author: game developers, email, etc.
3 | # desc: short description
4 | # site: website link
5 | # license: MIT License (change this to your license of choice)
6 | # version: 0.1
7 | # script: python
8 |
9 | t=0
10 | x=96
11 | y=24
12 |
13 | def TIC():
14 | global t
15 | global x
16 | global y
17 |
18 | if btn(0): y-=1
19 | if btn(1): y+=1
20 | if btn(2): x-=1
21 | if btn(3): x+=1
22 |
23 | cls(13)
24 | spr(
25 | 1+t%60//30*2,
26 | x,y,
27 | colorkey=14,
28 | scale=3,
29 | w=2,h=2
30 | )
31 | print("HELLO WORLD!",84,84)
32 | t+=1
33 |
34 | #
35 | # 001:eccccccccc888888caaaaaaaca888888cacccccccacc0ccccacc0ccccacc0ccc
36 | # 002:ccccceee8888cceeaaaa0cee888a0ceeccca0ccc0cca0c0c0cca0c0c0cca0c0c
37 | # 003:eccccccccc888888caaaaaaaca888888cacccccccacccccccacc0ccccacc0ccc
38 | # 004:ccccceee8888cceeaaaa0cee888a0ceeccca0cccccca0c0c0cca0c0c0cca0c0c
39 | # 017:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
40 | # 018:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
41 | # 019:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
42 | # 020:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
43 | #
44 |
45 | #
46 | # 000:00000000ffffffff00000000ffffffff
47 | # 001:0123456789abcdeffedcba9876543210
48 | # 002:0123456789abcdef0123456789abcdef
49 | #
50 |
51 | #
52 | # 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
53 | #
54 |
55 | #
56 | # 000:100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
57 | #
58 |
59 | #
60 | # 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
61 | #
62 |
63 |
--------------------------------------------------------------------------------
/demos/rubydemo.rb:
--------------------------------------------------------------------------------
1 | # title: game title
2 | # author: game developer, email, etc.
3 | # desc: short description
4 | # site: website link
5 | # license: MIT License (change this to your license of choice)
6 | # version: 0.1
7 | # script: ruby
8 |
9 | $t=0
10 | $x=96
11 | $y=24
12 |
13 | def TIC
14 | $y-=1 if btn 0
15 | $y+=1 if btn 1
16 | $x-=1 if btn 2
17 | $x+=1 if btn 3
18 |
19 | cls 13
20 | spr 1+(($t%60)/30|0)*2,$x,$y,14,3,0,0,2,2
21 | print "HELLO WORLD!",84,84
22 | $t+=1
23 | end
24 |
25 | #
26 | # 001:eccccccccc888888caaaaaaaca888888cacccccccacc0ccccacc0ccccacc0ccc
27 | # 002:ccccceee8888cceeaaaa0cee888a0ceeccca0ccc0cca0c0c0cca0c0c0cca0c0c
28 | # 003:eccccccccc888888caaaaaaaca888888cacccccccacccccccacc0ccccacc0ccc
29 | # 004:ccccceee8888cceeaaaa0cee888a0ceeccca0cccccca0c0c0cca0c0c0cca0c0c
30 | # 017:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
31 | # 018:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
32 | # 019:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
33 | # 020:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
34 | #
35 |
36 | #
37 | # 000:00000000ffffffff00000000ffffffff
38 | # 001:0123456789abcdeffedcba9876543210
39 | # 002:0123456789abcdef0123456789abcdef
40 | #
41 |
42 | #
43 | # 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
44 | #
45 |
46 | #
47 | # 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
48 | #
49 |
50 | #
51 | # 000:100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
52 | #
53 |
--------------------------------------------------------------------------------
/demos/schemedemo.scm:
--------------------------------------------------------------------------------
1 | ;; title: game title
2 | ;; author: game developer, email, etc.
3 | ;; desc: short description
4 | ;; site: website link
5 | ;; license: MIT License (change this to your license of choice)
6 | ;; version: 0.1
7 | ;; script: scheme
8 |
9 | (define-macro (inc! x dx) `(set! ,x (+ ,x ,dx)))
10 |
11 | (define t 0)
12 | (define x 96)
13 | (define y 24)
14 |
15 | (define (TIC)
16 | (if (t80::btn 0) (inc! y -1))
17 | (if (t80::btn 1) (inc! y 1))
18 | (if (t80::btn 2) (inc! x -1))
19 | (if (t80::btn 3) (inc! x 1))
20 |
21 | (t80::cls 13)
22 | (t80::spr (+ 1 (* (quotient (modulo t 60) 30) 2)) x y 14 3 0 0 2 2)
23 | (t80::print "HELLO WORLD!" 84 84)
24 | (inc! t 1))
25 |
26 | ;;
27 | ;; 001:eccccccccc888888caaaaaaaca888888cacccccccacc0ccccacc0ccccacc0ccc
28 | ;; 002:ccccceee8888cceeaaaa0cee888a0ceeccca0ccc0cca0c0c0cca0c0c0cca0c0c
29 | ;; 003:eccccccccc888888caaaaaaaca888888cacccccccacccccccacc0ccccacc0ccc
30 | ;; 004:ccccceee8888cceeaaaa0cee888a0ceeccca0cccccca0c0c0cca0c0c0cca0c0c
31 | ;; 017:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
32 | ;; 018:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
33 | ;; 019:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
34 | ;; 020:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
35 | ;;
36 |
37 | ;;
38 | ;; 000:00000000ffffffff00000000ffffffff
39 | ;; 001:0123456789abcdeffedcba9876543210
40 | ;; 002:0123456789abcdef0123456789abcdef
41 | ;;
42 |
43 | ;;
44 | ;; 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
45 | ;;
46 |
47 | ;;
48 | ;; 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
49 | ;;
50 |
51 | ;;
52 | ;; 000:100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
53 | ;;
54 |
--------------------------------------------------------------------------------
/demos/sfx.lua:
--------------------------------------------------------------------------------
1 | -- title: sfx
2 | -- author: Nesbox
3 | -- desc: how to play SFX demo
4 | -- script: lua
5 | -- input: gamepad
6 |
7 | t=0
8 | id=0
9 |
10 | function TIC()
11 |
12 | if btnp(0) then sfx(id,"E-4")
13 | elseif btnp(1) then sfx(id,"E-6")
14 | elseif btnp(2) then sfx(id,"E-7")
15 | elseif btnp(3) then sfx(id,"E-5")
16 | end
17 |
18 | cls(15)
19 | spr(1+(t%20)/10,102,24,1,4)
20 | print("PRESS ANY ARROW KEY",64,64,0)
21 |
22 | t=t+1
23 |
24 | end
25 |
26 | --
27 | -- 001:1111111111110111111100111111010111110111100001110000011110001111
28 | -- 002:1111011111110011111101011111011110000111000001111000111111111111
29 | --
30 |
31 | --
32 | -- 000:00000000ffffffff00000000ffffffff
33 | -- 001:0123456789abcdeffedcba9876543210
34 | -- 002:0123456789abcdef0123456789abcdef
35 | --
36 |
37 | --
38 | -- 000:50003000300020002000200030003000300030004000400050005000600060007000800090009000a000b000b000c000c000d000e000e000f000f000304000000000
39 | --
40 |
41 | --
42 | -- 000:140c1c44243430346d4e4a4e854c30346524d04648757161597dced27d2c8595a16daa2cd2aa996dc2cadad45edeeed6
43 | --
44 |
45 |
--------------------------------------------------------------------------------
/demos/squirreldemo.nut:
--------------------------------------------------------------------------------
1 | // title: game title
2 | // author: game developer, email, etc.
3 | // desc: short description
4 | // site: website link
5 | // license: MIT License (change this to your license of choice)
6 | // version: 0.1
7 | // script: squirrel
8 |
9 | t<-0
10 | x<-96
11 | y<-24
12 |
13 | function TIC()
14 | {
15 | if (btn(0)) y=y-1;
16 | if (btn(1)) y=y+1;
17 | if (btn(2)) x=x-1;
18 | if (btn(3)) x=x+1;
19 |
20 | cls(13)
21 | spr(1+((t%60)/30)*2,x,y,14,3,0,0,2,2)
22 | print("HELLO WORLD!",84,84)
23 | t=t+1
24 | }
25 |
26 | //
27 | // 001:eccccccccc888888caaaaaaaca888888cacccccccacc0ccccacc0ccccacc0ccc
28 | // 002:ccccceee8888cceeaaaa0cee888a0ceeccca0ccc0cca0c0c0cca0c0c0cca0c0c
29 | // 003:eccccccccc888888caaaaaaaca888888cacccccccacccccccacc0ccccacc0ccc
30 | // 004:ccccceee8888cceeaaaa0cee888a0ceeccca0cccccca0c0c0cca0c0c0cca0c0c
31 | // 017:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
32 | // 018:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
33 | // 019:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
34 | // 020:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
35 | //
36 |
37 | //
38 | // 000:00000000ffffffff00000000ffffffff
39 | // 001:0123456789abcdeffedcba9876543210
40 | // 002:0123456789abcdef0123456789abcdef
41 | //
42 |
43 | //
44 | // 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
45 | //
46 |
47 | //
48 | // 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
49 | //
50 |
51 | //
52 | // 000:100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
53 | //
54 |
--------------------------------------------------------------------------------
/demos/wasm/build.zig:
--------------------------------------------------------------------------------
1 | const std = @import("std");
2 |
3 | pub fn build(b: *std.Build) !void {
4 | const optimize = b.standardOptimizeOption(.{});
5 | const target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding });
6 | const exe = b.addExecutable(.{
7 | .name = "cart",
8 | .root_source_file = b.path("src/main.zig"),
9 | .target = target,
10 | .optimize = optimize,
11 | });
12 |
13 | exe.rdynamic = true;
14 | exe.entry = .disabled;
15 | exe.import_memory = true;
16 | exe.stack_size = 8192;
17 | exe.initial_memory = 65536 * 4;
18 | exe.max_memory = 65536 * 4;
19 | exe.export_table = true;
20 |
21 | // all the memory below 96kb is reserved for TIC and memory mapped I/O
22 | // so our own usage must start above the 96kb mark
23 | exe.global_base = 96 * 1024;
24 |
25 | b.installArtifact(exe);
26 | }
27 |
--------------------------------------------------------------------------------
/demos/wasm/src/main.zig:
--------------------------------------------------------------------------------
1 | const tic = @import("tic80.zig");
2 |
3 | const TICGuy = struct {
4 | x: i32 = 96,
5 | y: i32 = 24,
6 | };
7 |
8 | var t: u16 = 0;
9 | var mascot: TICGuy = .{};
10 |
11 | export fn BOOT() void {}
12 |
13 | export fn TIC() void {
14 | tic.sync(.{ .sections = .{ .tiles = true }, .bank = 1, .toCartridge = true });
15 |
16 | if (tic.btn(0)) {
17 | mascot.y -= 1;
18 | }
19 | if (tic.btn(1)) {
20 | mascot.y += 1;
21 | }
22 | if (tic.btn(2)) {
23 | mascot.x -= 1;
24 | }
25 | if (tic.btn(3)) {
26 | mascot.x += 1;
27 | }
28 |
29 | tic.cls(13);
30 | tic.spr(@as(i32, 1 + t % 60 / 30 * 2), mascot.x, mascot.y, .{
31 | .transparent = &.{14},
32 | .scale = 3,
33 | .w = 2,
34 | .h = 2,
35 | });
36 | _ = tic.print("HELLO WORLD!", 84, 84, .{ .fixed = true });
37 |
38 | t += 1;
39 | }
40 |
41 | export fn BDR() void {}
42 |
43 | export fn OVR() void {}
44 |
--------------------------------------------------------------------------------
/demos/wasm/wasmdemo.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/demos/wasm/wasmdemo.wasm
--------------------------------------------------------------------------------
/demos/wasm/wasmdemo.wasmp:
--------------------------------------------------------------------------------
1 | -- desc: WASM Introduction
2 | -- script: wasm
3 |
4 | """""""""""""""""""""""""""""""""""""""
5 | WASM is a binary format. The demo
6 | binary code is embedded in this
7 | cartridge, the source code is not.
8 | Run the cart to see the demo.
9 |
10 | This demo exits for completeness, but
11 | you can't (yet) develop WASM projects
12 | using the built-in editor.
13 |
14 | The code used to build this project
15 | can be found in the TIC-80 repo:
16 |
17 | https://github.com/nesbox/TIC-80
18 | /demos/wasm/
19 |
20 | This demo was built with Zig, but many
21 | languages are supported. You simply
22 | build your project with your external
23 | compiler, then import the final WASM
24 | binary into your cartridge:
25 |
26 | import binary out.wasm
27 |
28 | To learn more visit our Wiki and
29 | the 'Getting Started with WASM' page.
30 |
31 | "
32 | --
33 | -- 001:eccccccccc888888caaaaaaaca888888cacccccccacc0ccccacc0ccccacc0ccc
34 | -- 002:ccccceee8888cceeaaaa0cee888a0ceeccca0ccc0cca0c0c0cca0c0c0cca0c0c
35 | -- 003:eccccccccc888888caaaaaaaca888888cacccccccacccccccacc0ccccacc0ccc
36 | -- 004:ccccceee8888cceeaaaa0cee888a0ceeccca0cccccca0c0c0cca0c0c0cca0c0c
37 | -- 017:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
38 | -- 018:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
39 | -- 019:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
40 | -- 020:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
41 | --
42 |
43 | --
44 | -- 000:00000000ffffffff00000000ffffffff
45 | -- 001:0123456789abcdeffedcba9876543210
46 | -- 002:0123456789abcdef0123456789abcdef
47 | --
48 |
49 | --
50 | -- 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
51 | --
52 |
53 | --
54 | -- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
55 | --
56 |
57 | --
58 | -- 000:100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
59 | --
60 |
--------------------------------------------------------------------------------
/demos/wrendemo.wren:
--------------------------------------------------------------------------------
1 | // title: game title
2 | // author: game developer, email, etc.
3 | // desc: short description
4 | // site: website link
5 | // license: MIT License (change this to your license of choice)
6 | // version: 0.1
7 | // script: wren
8 |
9 | class Game is TIC{
10 |
11 | construct new(){
12 | _t=0
13 | _x=96
14 | _y=24
15 | }
16 |
17 | TIC(){
18 | if(TIC.btn(0)){
19 | _y=_y-1
20 | }
21 | if(TIC.btn(1)){
22 | _y=_y+1
23 | }
24 | if(TIC.btn(2)){
25 | _x=_x-1
26 | }
27 | if(TIC.btn(3)){
28 | _x=_x+1
29 | }
30 |
31 | TIC.cls(13)
32 | TIC.spr(1+((_t%60)/30|0)*2,_x,_y,14,3,0,0,2,2)
33 | TIC.print("HELLO WORLD!",84,84)
34 |
35 | _t=_t+1
36 | }
37 | }
38 |
39 | //
40 | // 001:eccccccccc888888caaaaaaaca888888cacccccccacc0ccccacc0ccccacc0ccc
41 | // 002:ccccceee8888cceeaaaa0cee888a0ceeccca0ccc0cca0c0c0cca0c0c0cca0c0c
42 | // 003:eccccccccc888888caaaaaaaca888888cacccccccacccccccacc0ccccacc0ccc
43 | // 004:ccccceee8888cceeaaaa0cee888a0ceeccca0cccccca0c0c0cca0c0c0cca0c0c
44 | // 017:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
45 | // 018:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
46 | // 019:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
47 | // 020:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
48 | //
49 |
50 | //
51 | // 000:00000000ffffffff00000000ffffffff
52 | // 001:0123456789abcdeffedcba9876543210
53 | // 002:0123456789abcdef0123456789abcdef
54 | //
55 |
56 | //
57 | // 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
58 | //
59 |
60 | //
61 | // 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
62 | //
63 |
64 | //
65 | // 000:100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
66 | //
67 |
--------------------------------------------------------------------------------
/include/retro_inline.h:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2010-2020 The RetroArch team
2 | *
3 | * ---------------------------------------------------------------------------------------
4 | * The following license statement only applies to this file (retro_inline.h).
5 | * ---------------------------------------------------------------------------------------
6 | *
7 | * Permission is hereby granted, free of charge,
8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"),
9 | * to deal in the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | */
22 |
23 | #ifndef __LIBRETRO_SDK_INLINE_H
24 | #define __LIBRETRO_SDK_INLINE_H
25 |
26 | #ifndef INLINE
27 |
28 | #if defined(_WIN32) || defined(__INTEL_COMPILER)
29 | #define INLINE __inline
30 | #elif defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L
31 | #define INLINE inline
32 | #elif defined(__GNUC__)
33 | #define INLINE __inline__
34 | #else
35 | #define INLINE
36 | #endif
37 |
38 | #endif
39 | #endif
40 |
--------------------------------------------------------------------------------
/include/tic80_types.h:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2017 Vadim Grigoruk @nesbox // grigoruk@gmail.com
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #pragma once
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | #ifdef memcpy
30 | #undef memcpy
31 | #endif
32 | #ifdef memset
33 | #undef memset
34 | #endif
35 |
36 | typedef uint8_t u8;
37 | typedef uint16_t u16;
38 | typedef uint32_t u32;
39 | typedef uint64_t u64;
40 | typedef int8_t s8;
41 | typedef int16_t s16;
42 | typedef int32_t s32;
43 | typedef int64_t s64;
44 |
--------------------------------------------------------------------------------
/src/api/luaapi.h:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2017 Vadim Grigoruk @nesbox // grigoruk@gmail.com
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #pragma once
24 |
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 |
32 | void luaapi_init(tic_core* core);
33 | void luaapi_tick(tic_mem* tic);
34 | void luaapi_boot(tic_mem* tic);
35 | void luaapi_scn(tic_mem* tic, s32 row, void* data);
36 | void luaapi_bdr(tic_mem* tic, s32 row, void* data);
37 | void luaapi_menu(tic_mem* tic, s32 index, void* data);
38 | void luaapi_close(tic_mem* tic);
39 | void luaapi_open(lua_State *lua);
40 |
--------------------------------------------------------------------------------
/src/api/parse_note.c:
--------------------------------------------------------------------------------
1 | #include "tic.h"
2 | #include
3 |
4 | bool parse_note(const char* noteStr, s32* note, s32* octave)
5 | {
6 | if(noteStr && strlen(noteStr) == 3)
7 | {
8 | static const char* Notes[] = SFX_NOTES;
9 |
10 | for(s32 i = 0; i < COUNT_OF(Notes); i++)
11 | {
12 | if(memcmp(Notes[i], noteStr, 2) == 0)
13 | {
14 | *note = i;
15 | *octave = noteStr[2] - '1';
16 | break;
17 | }
18 | }
19 |
20 | return true;
21 | }
22 |
23 | return false;
24 | }
25 |
--------------------------------------------------------------------------------
/src/cart.h:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2020 Vadim Grigoruk @nesbox // grigoruk@gmail.com
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #pragma once
24 |
25 | #include "tic.h"
26 |
27 | void tic_cart_load(tic_cartridge* rom, const u8* buffer, s32 size);
28 | s32 tic_cart_save(const tic_cartridge* rom, u8* buffer);
29 |
--------------------------------------------------------------------------------
/src/ext/fft.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | //////////////////////////////////////////////////////////////////////////
5 |
6 | bool FFT_Open(bool CapturePlaybackDevices, const char* CaptureDeviceSearchString);
7 | void FFT_EnumerateDevices();
8 | void FFT_GetFFT(float* _samples);
9 | void FFT_Close();
10 |
11 | //////////////////////////////////////////////////////////////////////////
12 |
--------------------------------------------------------------------------------
/src/ext/gif.h:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2017 Vadim Grigoruk @nesbox // grigoruk@gmail.com
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #pragma once
24 |
25 | #include
26 |
27 | typedef struct
28 | {
29 | u8 r;
30 | u8 g;
31 | u8 b;
32 | }gif_color;
33 |
34 | typedef struct
35 | {
36 | u8* buffer;
37 |
38 | gif_color* palette;
39 |
40 | s32 width;
41 | s32 height;
42 |
43 | s32 colors;
44 | } gif_image;
45 |
46 | gif_image* gif_read_data(const void* buffer, int size);
47 | void gif_close(gif_image* image);
48 |
--------------------------------------------------------------------------------
/src/ext/history.h:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2017 Vadim Grigoruk @nesbox // grigoruk@gmail.com
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #pragma once
24 |
25 | #include
26 |
27 | typedef struct History History;
28 |
29 | History* history_create(void* data, u32 size);
30 | bool history_add(History* history);
31 | void history_undo(History* history);
32 | void history_redo(History* history);
33 | void history_delete(History* history);
34 |
--------------------------------------------------------------------------------
/src/ext/json.h:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2017 Vadim Grigoruk @nesbox // grigoruk@gmail.com
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #pragma once
24 |
25 | #include "tic.h"
26 |
27 | bool json_parse(const char *json, s32 size);
28 |
29 | s32 json_int(const char *var, s32 parent);
30 | bool json_bool(const char *var, s32 parent);
31 | bool json_string(const char *var, s32 parent, char* value, s32 size);
32 | s32 json_array(const char *var, s32 parent);
33 | s32 json_array_size(s32 array);
34 | s32 json_array_item(s32 array, s32 index);
35 | s32 json_object(const char *var, s32 parent);
36 |
--------------------------------------------------------------------------------
/src/ext/kiss_fft_log.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2010, Mark Borgerding. All rights reserved.
3 | * This file is part of KISS FFT - https://github.com/mborgerding/kissfft
4 | *
5 | * SPDX-License-Identifier: BSD-3-Clause
6 | * See COPYING file for more information.
7 | */
8 |
9 | #ifndef kiss_fft_log_h
10 | #define kiss_fft_log_h
11 |
12 | #define ERROR 1
13 | #define WARNING 2
14 | #define INFO 3
15 | #define DEBUG 4
16 |
17 | #define STRINGIFY(x) #x
18 | #define TOSTRING(x) STRINGIFY(x)
19 |
20 | #if defined(NDEBUG)
21 | # define KISS_FFT_LOG_MSG(severity, ...) ((void)0)
22 | #else
23 | # define KISS_FFT_LOG_MSG(severity, ...) \
24 | fprintf(stderr, "[" #severity "] " __FILE__ ":" TOSTRING(__LINE__) " "); \
25 | fprintf(stderr, __VA_ARGS__); \
26 | fprintf(stderr, "\n")
27 | #endif
28 |
29 | #define KISS_FFT_ERROR(...) KISS_FFT_LOG_MSG(ERROR, __VA_ARGS__)
30 | #define KISS_FFT_WARNING(...) KISS_FFT_LOG_MSG(WARNING, __VA_ARGS__)
31 | #define KISS_FFT_INFO(...) KISS_FFT_LOG_MSG(INFO, __VA_ARGS__)
32 | #define KISS_FFT_DEBUG(...) KISS_FFT_LOG_MSG(DEBUG, __VA_ARGS__)
33 |
34 |
35 |
36 | #endif /* kiss_fft_log_h */
--------------------------------------------------------------------------------
/src/ext/kiss_fftr.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003-2004, Mark Borgerding. All rights reserved.
3 | * This file is part of KISS FFT - https://github.com/mborgerding/kissfft
4 | *
5 | * SPDX-License-Identifier: BSD-3-Clause
6 | * See COPYING file for more information.
7 | */
8 |
9 | #ifndef KISS_FTR_H
10 | #define KISS_FTR_H
11 |
12 | #include "kiss_fft.h"
13 | #ifdef __cplusplus
14 | extern "C" {
15 | #endif
16 |
17 |
18 | /*
19 |
20 | Real optimized version can save about 45% cpu time vs. complex fft of a real seq.
21 |
22 |
23 |
24 | */
25 |
26 | typedef struct kiss_fftr_state *kiss_fftr_cfg;
27 |
28 |
29 | kiss_fftr_cfg KISS_FFT_API kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem);
30 | /*
31 | nfft must be even
32 |
33 | If you don't care to allocate space, use mem = lenmem = NULL
34 | */
35 |
36 |
37 | void KISS_FFT_API kiss_fftr(kiss_fftr_cfg cfg,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata);
38 | /*
39 | input timedata has nfft scalar points
40 | output freqdata has nfft/2+1 complex points
41 | */
42 |
43 | void KISS_FFT_API kiss_fftri(kiss_fftr_cfg cfg,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata);
44 | /*
45 | input freqdata has nfft/2+1 complex points
46 | output timedata has nfft scalar points
47 | */
48 |
49 | #define kiss_fftr_free KISS_FFT_FREE
50 |
51 | #ifdef __cplusplus
52 | }
53 | #endif
54 | #endif
55 |
--------------------------------------------------------------------------------
/src/ext/md5.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
3 | * MD5 Message-Digest Algorithm (RFC 1321).
4 | *
5 | * Homepage:
6 | * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
7 | *
8 | * Author:
9 | * Alexander Peslyak, better known as Solar Designer
10 | *
11 | * This software was written by Alexander Peslyak in 2001. No copyright is
12 | * claimed, and the software is hereby placed in the public domain.
13 | * In case this attempt to disclaim copyright and place the software in the
14 | * public domain is deemed null and void, then the software is
15 | * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
16 | * general public under the following terms:
17 | *
18 | * Redistribution and use in source and binary forms, with or without
19 | * modification, are permitted.
20 | *
21 | * There's ABSOLUTELY NO WARRANTY, express or implied.
22 | *
23 | * See md5.c for more information.
24 | */
25 |
26 | #ifndef _MD5_H
27 | #define _MD5_H
28 |
29 | /* Any 32-bit or wider unsigned integer data type will do */
30 | typedef unsigned int MD5_u32plus;
31 |
32 | typedef struct {
33 | MD5_u32plus lo, hi;
34 | MD5_u32plus a, b, c, d;
35 | unsigned char buffer[64];
36 | MD5_u32plus block[16];
37 | } MD5_CTX;
38 |
39 | extern void MD5_Init(MD5_CTX *ctx);
40 | extern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size);
41 | extern void MD5_Final(unsigned char *result, MD5_CTX *ctx);
42 |
43 | #endif
--------------------------------------------------------------------------------
/src/ext/png.h:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2021 Vadim Grigoruk @nesbox // grigoruk@gmail.com
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #pragma once
24 |
25 | #include
26 |
27 | typedef struct
28 | {
29 | u8* data;
30 | s32 size;
31 | } png_buffer;
32 |
33 | typedef union
34 | {
35 | struct
36 | {
37 | u8 r;
38 | u8 g;
39 | u8 b;
40 | u8 a;
41 | };
42 |
43 | u8 data[4];
44 |
45 | u32 value;
46 | } png_rgba;
47 |
48 | typedef struct
49 | {
50 | s32 width;
51 | s32 height;
52 |
53 | union
54 | {
55 | png_rgba* pixels;
56 | u32* values;
57 | u8* data;
58 | };
59 | } png_img;
60 |
61 | png_buffer png_create(s32 size);
62 |
63 | png_img png_read(png_buffer buf, png_buffer *cart);
64 | png_buffer png_write(png_img src, png_buffer cart);
65 |
66 | png_buffer png_encode(png_buffer cover, png_buffer cart);
67 | png_buffer png_decode(png_buffer cover);
68 |
--------------------------------------------------------------------------------
/src/fftdata.c:
--------------------------------------------------------------------------------
1 | #ifndef TIC80_FFT_UNSUPPORTED
2 | #include "fftdata.h"
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | float fPeakMinValue = 0.01f;
9 | float fPeakSmoothing = 0.995f;
10 | float fPeakSmoothValue = 0.0f;
11 | float fAmplification = 1.0f;
12 | float fftData[FFT_SIZE] = {0};
13 | float fftSmoothingData[FFT_SIZE] = {0};
14 | float fftNormalizedData[FFT_SIZE] = {0};
15 | float fftNormalizedMaxData[FFT_SIZE] = {0};
16 |
17 | bool fftEnabled = false;
18 |
19 | #define FFT_DEBUG
20 |
21 | FFT_LogLevel g_currentLogLevel = FFT_LOG_DEBUG;
22 |
23 | void FFT_DebugLog(FFT_LogLevel level, const char* format, ...)
24 | {
25 | #ifdef FFT_DEBUG
26 | if (level <= g_currentLogLevel)
27 | {
28 | if (level == FFT_LOG_TRACE)
29 | {
30 | time_t now = time(NULL);
31 | struct tm* tm_now = localtime(&now);
32 | char time_str[20]; // ISO 8601 format requires 19 characters + null terminator
33 | strftime(time_str, sizeof(time_str), "%Y-%m-%dT%H:%M:%S", tm_now);
34 |
35 | printf("%s ", time_str);
36 | }
37 | va_list args;
38 | va_start(args, format);
39 | switch (level)
40 | {
41 | case FFT_LOG_TRACE:
42 | printf("[FFT TRACE]: ");
43 | break;
44 | case FFT_LOG_DEBUG:
45 | printf("[FFT DEBUG]: ");
46 | break;
47 | case FFT_LOG_INFO:
48 | printf("[FFT INFO]: ");
49 | break;
50 | case FFT_LOG_WARNING:
51 | printf("[FFT WARNING]: ");
52 | break;
53 | case FFT_LOG_ERROR:
54 | printf("[FFT ERROR]: ");
55 | break;
56 | case FFT_LOG_FATAL:
57 | printf("[FFT FATAL]: ");
58 | break;
59 | case FFT_LOG_OFF:
60 | return;
61 | }
62 | vprintf(format, args);
63 | va_end(args);
64 | }
65 | #endif
66 | }
67 | #endif
68 |
--------------------------------------------------------------------------------
/src/fftdata.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #define FFT_SIZE 1024
4 | extern float fPeakMinValue;
5 | extern float fPeakSmoothing;
6 | extern float fPeakSmoothValue;
7 | extern float fAmplification;
8 | extern float fftData[FFT_SIZE];
9 | extern float fftSmoothingData[FFT_SIZE];
10 | extern float fftNormalizedData[FFT_SIZE];
11 | extern float fftNormalizedMaxData[FFT_SIZE];
12 |
13 | extern bool fftEnabled;
14 |
15 | typedef enum
16 | {
17 | FFT_LOG_OFF = 0,
18 | FFT_LOG_FATAL,
19 | FFT_LOG_ERROR,
20 | FFT_LOG_WARNING,
21 | FFT_LOG_INFO,
22 | FFT_LOG_DEBUG,
23 | FFT_LOG_TRACE
24 | } FFT_LogLevel;
25 |
26 | extern FFT_LogLevel g_currentLogLevel;
27 |
28 | void FFT_DebugLog(FFT_LogLevel level, const char* format, ...);
29 |
--------------------------------------------------------------------------------
/src/studio/config.h:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2017 Vadim Grigoruk @nesbox // grigoruk@gmail.com
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #pragma once
24 |
25 | #include "studio.h"
26 |
27 | typedef struct Config Config;
28 |
29 | struct Config
30 | {
31 | Studio* studio;
32 | tic_mem* tic;
33 | struct tic_fs* fs;
34 |
35 | StudioConfig data;
36 | tic_cartridge* cart;
37 |
38 | void(*save)(Config*);
39 | void(*reset)(Config*);
40 | };
41 |
42 | void initConfig(Config* config, Studio* studio, struct tic_fs* fs);
43 | void freeConfig(Config* config);
44 |
--------------------------------------------------------------------------------
/src/studio/editors/sfx.h:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2017 Vadim Grigoruk @nesbox // grigoruk@gmail.com
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #pragma once
24 |
25 | #include "studio/studio.h"
26 |
27 | typedef struct Sfx Sfx;
28 |
29 | struct Sfx
30 | {
31 | Studio* studio;
32 | tic_mem* tic;
33 |
34 | tic_sfx* src;
35 |
36 | u8 index:SFX_COUNT_BITS;
37 | s32 volwave;
38 | s32 hoverWave;
39 | s32 holdValue;
40 |
41 | struct
42 | {
43 | bool active;
44 | s32 note;
45 | u32 tick;
46 | } play;
47 |
48 | struct History* history;
49 | struct History* waveHistory;
50 |
51 | void(*tick)(Sfx*);
52 | void(*event)(Sfx*, StudioEvent);
53 | };
54 |
55 | void initSfx(Sfx*, Studio* studio, tic_sfx* src);
56 | void freeSfx(Sfx* sfx);
57 |
--------------------------------------------------------------------------------
/src/studio/editors/world.h:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2017 Vadim Grigoruk @nesbox // grigoruk@gmail.com
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #pragma once
24 |
25 | #include "studio/studio.h"
26 | #include "map.h"
27 |
28 | typedef struct World World;
29 |
30 | struct World
31 | {
32 | Studio* studio;
33 | tic_mem* tic;
34 | Map* map;
35 |
36 | void* preview;
37 |
38 | void (*tick)(World* world);
39 | void (*scanline)(tic_mem* tic, s32 row, void* data);
40 | };
41 |
42 | void initWorld(World* world, Studio* studio, Map* map);
43 | void freeWorld(World* world);
--------------------------------------------------------------------------------
/src/studio/net.h:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2017 Vadim Grigoruk @nesbox // grigoruk@gmail.com
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #pragma once
24 |
25 | #include "tic80_types.h"
26 |
27 | typedef struct tic_net tic_net;
28 |
29 | typedef struct
30 | {
31 | enum
32 | {
33 | net_get_progress,
34 | net_get_done,
35 | net_get_error,
36 | } type;
37 |
38 | union
39 | {
40 | struct
41 | {
42 | s32 size;
43 | s32 total;
44 | } progress;
45 |
46 | struct
47 | {
48 | s32 size;
49 | u8* data;
50 | } done;
51 |
52 | struct
53 | {
54 | s32 code;
55 | } error;
56 | };
57 |
58 | void* calldata;
59 | const char* url;
60 |
61 | } net_get_data;
62 |
63 | typedef void(*net_get_callback)(const net_get_data*);
64 |
65 | tic_net* tic_net_create(const char* host);
66 |
67 | void tic_net_get(tic_net* net, const char* url, net_get_callback callback, void* calldata);
68 | void tic_net_close(tic_net* net);
69 | void tic_net_start(tic_net *net);
70 | void tic_net_end(tic_net *net);
71 |
--------------------------------------------------------------------------------
/src/studio/project.h:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2020 Vadim Grigoruk @nesbox // grigoruk@gmail.com
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #pragma once
24 |
25 | #include "cart.h"
26 |
27 | bool tic_project_load(const char* name, const char* data, s32 size, tic_cartridge* dst);
28 | s32 tic_project_save(const char* name, void* data, const tic_cartridge* cart);
29 |
--------------------------------------------------------------------------------
/src/studio/screens/mainmenu.h:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2017 Vadim Grigoruk @nesbox // grigoruk@gmail.com
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #pragma once
24 |
25 | typedef struct StudioMainMenu StudioMainMenu;
26 |
27 | StudioMainMenu* studio_mainmenu_init(Menu *menu, Config *config);
28 | bool studio_mainmenu_keyboard(StudioMainMenu* menu);
29 | void studio_mainmenu_free(StudioMainMenu* menu);
30 |
--------------------------------------------------------------------------------
/src/studio/screens/menu.h:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2017 Vadim Grigoruk @nesbox // grigoruk@gmail.com
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #pragma once
24 |
25 | #include "tic80_types.h"
26 | #include "tic.h"
27 |
28 | typedef struct Menu Menu;
29 | struct tic_mem;
30 | struct Studio;
31 |
32 | Menu* studio_menu_create(struct Studio* studio);
33 | void studio_menu_tick(Menu* menu);
34 |
35 | typedef s32(*MenuOptionGetHandler)(void*);
36 | typedef void(*MenuOptionSetHandler)(void*, s32);
37 |
38 | typedef struct
39 | {
40 | const char** values;
41 | s32 count;
42 | MenuOptionGetHandler get;
43 | MenuOptionSetHandler set;
44 | s32 width;
45 | s32 pos;
46 | } MenuOption;
47 |
48 | typedef void(*MenuItemHandler)(void*, s32);
49 |
50 | typedef struct
51 | {
52 | const char* label;
53 | MenuItemHandler handler;
54 |
55 | MenuOption* option;
56 | const char* help;
57 | bool back;
58 | s32 width;
59 | tic_keycode hotkey;
60 | } MenuItem;
61 |
62 | void studio_menu_init(Menu* menu, const MenuItem* items, s32 rows, s32 pos, s32 backPos, MenuItemHandler handler, void* data);
63 | bool studio_menu_back(Menu* menu);
64 | void studio_menu_free(Menu* menu);
65 |
66 | void studio_menu_anim(struct tic_mem* tic, s32 ticks);
67 | void studio_menu_anim_scanline(struct tic_mem* tic, s32 row, void* data);
68 |
--------------------------------------------------------------------------------
/src/studio/screens/run.h:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2017 Vadim Grigoruk @nesbox // grigoruk@gmail.com
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #pragma once
24 |
25 | #include "../system.h"
26 | #include "studio/studio.h"
27 |
28 | typedef struct Run Run;
29 |
30 | struct Run
31 | {
32 | Studio* studio;
33 | tic_mem* tic;
34 | struct Console* console;
35 | struct tic_fs* fs;
36 | tic_tick_data tickData;
37 |
38 | bool exit;
39 |
40 | char saveid[TICNAME_MAX];
41 | tic_persistent pmem;
42 |
43 | void(*tick)(Run*);
44 | };
45 |
46 | void initRun(Run*, struct Console*, struct tic_fs*, Studio* studio);
47 | void freeRun(Run* run);
48 |
--------------------------------------------------------------------------------
/src/studio/screens/start.h:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2017 Vadim Grigoruk @nesbox // grigoruk@gmail.com
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #pragma once
24 |
25 | #include "studio/studio.h"
26 |
27 | #define CART_SIG "TIC.CART"
28 |
29 | typedef struct
30 | {
31 | u8 sig[STRLEN(CART_SIG)];
32 | s32 appSize;
33 | s32 cartSize;
34 | } EmbedHeader;
35 |
36 | typedef struct Start Start;
37 |
38 | typedef struct stage {
39 | void(*fn)(Start*);
40 | u8 ticks;
41 | } Stage;
42 |
43 | struct Start
44 | {
45 | Studio* studio;
46 | tic_mem* tic;
47 |
48 | bool initialized;
49 | Stage stages[5];
50 |
51 | u32 stage;
52 | s32 ticks;
53 | bool play;
54 |
55 | char text[STUDIO_TEXT_BUFFER_SIZE];
56 | u8 color[STUDIO_TEXT_BUFFER_SIZE];
57 |
58 | bool embed;
59 |
60 | void (*tick)(Start*);
61 | };
62 |
63 | void initStart(Start* start, Studio* studio, const char* cart);
64 | void freeStart(Start* start);
65 |
--------------------------------------------------------------------------------
/src/system/baremetalpi/customchargenerator.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "customfont.h"
4 |
5 | #define FIRSTCHAR 0x00
6 | #define LASTCHAR 0xFF
7 | #define CHARCOUNT (LASTCHAR - FIRSTCHAR + 1)
8 | CCharGenerator::CCharGenerator (void)
9 | : m_nCharWidth (width)
10 | {
11 | }
12 | CCharGenerator::~CCharGenerator (void) {
13 | }
14 | unsigned CCharGenerator::GetCharWidth (void) const {
15 | return m_nCharWidth;
16 | }
17 | unsigned CCharGenerator::GetCharHeight (void) const {
18 | return height + extraheight;
19 | }
20 | unsigned CCharGenerator::GetUnderline (void) const {
21 | return height;
22 | }
23 | boolean CCharGenerator::GetPixel (char chAscii, unsigned nPosX, unsigned nPosY) const {
24 | unsigned nAscii = (u8) chAscii;
25 | if ( nAscii < FIRSTCHAR
26 | || nAscii > LASTCHAR)
27 | {
28 | return FALSE;
29 | }
30 | unsigned nIndex = nAscii - FIRSTCHAR;
31 | assert (nIndex < CHARCOUNT);
32 | assert (nPosX < m_nCharWidth);
33 | if (nPosY >= height)
34 | {
35 | return FALSE;
36 | }
37 | return font_data[nIndex][nPosY] & (0x80 >> nPosX) ? TRUE : FALSE;
38 | }
39 |
--------------------------------------------------------------------------------
/src/system/baremetalpi/customchargenerator.h:
--------------------------------------------------------------------------------
1 | //
2 | // chargenerator.h
3 | //
4 | // Circle - A C++ bare metal environment for Raspberry Pi
5 | // Copyright (C) 2014 R. Stange
6 | //
7 | // This program is free software: you can redistribute it and/or modify
8 | // it under the terms of the GNU General Public License as published by
9 | // the Free Software Foundation, either version 3 of the License, or
10 | // (at your option) any later version.
11 | //
12 | // This program is distributed in the hope that it will be useful,
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | // GNU General Public License for more details.
16 | //
17 | // You should have received a copy of the GNU General Public License
18 | // along with this program. If not, see .
19 | //
20 | #ifndef _customchargenerator_h
21 | #define _customchargenerator_h
22 |
23 | #include
24 |
25 | class CCharGenerator
26 | {
27 | public:
28 | CCharGenerator (void);
29 | ~CCharGenerator (void);
30 |
31 | unsigned GetCharWidth (void) const;
32 | unsigned GetCharHeight (void) const;
33 | unsigned GetUnderline (void) const;
34 |
35 | boolean GetPixel (char chAscii, unsigned nPosX, unsigned nPosY) const;
36 |
37 | private:
38 | unsigned m_nCharWidth;
39 | };
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/src/system/baremetalpi/gamepads.cpp:
--------------------------------------------------------------------------------
1 | #include "gamepads.h"
2 | #include "utils.h"
3 |
4 | void initGamepads(CDeviceNameService m_DeviceNameService, TGamePadStatusHandler handler)
5 | {
6 | dbg("Searching gamepads..\n");
7 | for (unsigned nDevice = 1; nDevice<=4; nDevice++) // max 4 gamepads
8 | {
9 | CString DeviceName;
10 | DeviceName.Format ("upad%u", nDevice);
11 |
12 | CUSBGamePadDevice *pGamePad =
13 | (CUSBGamePadDevice *) m_DeviceNameService.GetDevice (DeviceName, FALSE);
14 |
15 | if (pGamePad == 0)
16 | {
17 | // no more gamepads
18 | break;
19 | }
20 |
21 | const TGamePadState *pState = pGamePad->GetInitialState ();
22 |
23 | assert (pState != 0);
24 |
25 | dbg("Prop %d\n", pGamePad->GetProperties());
26 |
27 | dbg("Gamepad %u: %d Button(s) %d Hat(s)\n", nDevice, pState->nbuttons, pState->nhats);
28 |
29 | for (int i = 0; i < pState->naxes; i++)
30 | {
31 | dbg("Gamepad %u: Axis %d: Minimum %d Maximum %d\n", nDevice, i+1, pState->axes[i].minimum, pState->axes[i].maximum);
32 | }
33 |
34 | pGamePad->RegisterStatusHandler (handler);
35 |
36 | }
37 | dbg("Finished searching gamepads\n");
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/src/system/baremetalpi/gamepads.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | void initGamepads(CDeviceNameService m_DeviceNameService, TGamePadStatusHandler handler);
8 |
--------------------------------------------------------------------------------
/src/system/baremetalpi/kernel.h:
--------------------------------------------------------------------------------
1 | //
2 | // kernel.h
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 | #ifndef _kernel_h
18 | #define _kernel_h
19 |
20 |
21 | enum TShutdownMode
22 | {
23 | ShutdownNone,
24 | ShutdownHalt,
25 | ShutdownReboot
26 | };
27 |
28 | TShutdownMode Run (void);
29 |
30 | #endif
31 |
32 |
--------------------------------------------------------------------------------
/src/system/baremetalpi/main.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // main.cpp
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 | #include "kernel.h"
18 | #include
19 | #include "utils.h"
20 | int main (void)
21 | {
22 | // cannot return here because some destructors used in CKernel are not implemented
23 |
24 | TShutdownMode s = Run();
25 |
26 | switch (s)
27 | {
28 | case ShutdownReboot:
29 | reboot ();
30 | return EXIT_REBOOT;
31 |
32 | case ShutdownHalt:
33 | default:
34 | halt ();
35 | return EXIT_HALT;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/system/baremetalpi/utils.cpp:
--------------------------------------------------------------------------------
1 | #include "utils.h"
2 |
3 |
4 | #define MAXBUFLEN (1024*1024)
5 |
6 |
7 | extern "C" {
8 |
9 | // this functions are absent for circle-stdlib for some reason
10 | // (maybe i can't link properly). Since they shouldn't be used
11 | // too much, i'll put some stub here. Chmod is ok since we're on
12 | // fat anyway, symlink won't work either. ftruncate could break
13 | // something
14 |
15 | int chmod (const char *filename, mode_t mode)
16 | {
17 | dbg("called chmod\n");
18 | return -1;
19 | }
20 |
21 | int symlink(const char *target, const char *linkpath)
22 | {
23 | dbg("called symlink\n");
24 |
25 | return -1;
26 | }
27 | }
28 |
29 | char *strdup (const char *s) {
30 | char *d = (char*)malloc (strlen (s) + 1); // Space for length plus nul
31 | if (d == NULL) return NULL; // No memory
32 | strcpy (d,s); // Copy the characters
33 | return d; // Return the new string
34 | }
35 |
36 |
37 |
38 | void* loadFile(const char *filename, u32* size)
39 | {
40 | /*
41 | // slow way to load a file since we don't have fseek
42 | / char source[MAXBUFLEN];
43 | FILE *fp = fopen(filename, "rb");
44 | if (fp != NULL) {
45 | size_t newLen = fread(source, sizeof(char), MAXBUFLEN, fp);
46 | if ( ferror( fp ) != 0 ) {
47 | fputs("Error reading file", stderr);
48 | } else {
49 | }
50 |
51 | fclose(fp);
52 | printf("STREAM SIZE is %d\n", newLen);
53 | void* cart = malloc(newLen);
54 | memcpy(cart, source, newLen);
55 | *size = newLen;
56 | return cart;
57 | }
58 | else
59 | {
60 | return NULL;
61 | }
62 | */
63 | return NULL;
64 | }
65 |
66 |
--------------------------------------------------------------------------------
/src/system/baremetalpi/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef _utils_h
2 | #define _utils_h
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 | #ifdef EN_DEBUG
15 | #define dbg(...) printf(__VA_ARGS__)
16 | #else
17 | #define dbg(...)
18 | #endif
19 |
20 |
21 | void* loadFile(const char *filename, u32* size);
22 | char *strdup (const char *s);
23 |
24 | #endif
25 |
26 |
--------------------------------------------------------------------------------
/src/system/libretro/README.md:
--------------------------------------------------------------------------------
1 | # TIC-80 libretro
2 |
3 | Provided is a [TIC-80](https://tic.computer) libretro core to render TIC-80 cartridges through the [libretro](https://www.libretro.com) API and [RetroArch](https://www.retroarch.com).
4 |
5 | ## Build
6 |
7 | To build the core by itself, run the following commands.
8 |
9 | ```
10 | git clone https://github.com/nesbox/TIC-80.git
11 | cd TIC-80
12 | git submodule update --init --recursive
13 | cd build
14 | cmake .. -DBUILD_PLAYER=OFF -DBUILD_SDL=OFF -DBUILD_TOOLS=OFF -DBUILD_LIBRETRO=ON
15 | make
16 | ```
17 |
18 | ## Usage
19 |
20 | ```
21 | retroarch -L lib/tic80_libretro.so sfx.tic
22 | ```
23 |
--------------------------------------------------------------------------------
/src/system/n3ds/keyboard.h:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2020 Adrian "asie" Siekierka
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #pragma once
24 |
25 | #include "tic.h"
26 | #include "api.h"
27 |
28 | #include <3ds.h>
29 | #include
30 |
31 | typedef struct
32 | {
33 | C3D_Tex tex;
34 | u8 kd[8];
35 | u32 kd_count;
36 | bool render_dirty;
37 |
38 | u64 scroll_debounce;
39 | } tic_n3ds_keyboard;
40 |
41 | void n3ds_keyboard_init(tic_n3ds_keyboard *kbd);
42 | void n3ds_keyboard_free(tic_n3ds_keyboard *kbd);
43 | void n3ds_keyboard_draw(tic_n3ds_keyboard *kbd);
44 | void n3ds_keyboard_update(tic_n3ds_keyboard *kbd, tic80_input* input);
45 | void n3ds_gamepad_update(tic_n3ds_keyboard *kbd, tic80_input* input);
--------------------------------------------------------------------------------
/src/system/n3ds/utils.h:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2020 Adrian "asie" Siekierka
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #pragma once
24 |
25 | #include <3ds.h>
26 | #include
27 | #include
28 |
29 | typedef enum {
30 | TEXTURE_TARGET_RAM,
31 | TEXTURE_TARGET_VRAM
32 | } texture_location;
33 |
34 | bool ctr_load_png(C3D_Tex* tex, const char *name, texture_location loc);
--------------------------------------------------------------------------------
/src/system/sdl/kbdlabels.inl:
--------------------------------------------------------------------------------
1 | {"ESC", 0*8+3, 0*8+3, true},
2 |
3 | {"F1", 2*8+4, 0*8+3, true},
4 | {"F2", 4*8+4, 0*8+3, true},
5 | {"F3", 6*8+4, 0*8+3, true},
6 | {"F4", 8*8+4, 0*8+3, true},
7 | {"F5", 10*8+4, 0*8+3, true},
8 | {"F6", 12*8+4, 0*8+3, true},
9 | {"F7", 14*8+4, 0*8+3, true},
10 | {"F8", 16*8+4, 0*8+3, true},
11 | {"F9", 18*8+4, 0*8+3, true},
12 | {"F10", 20*8+3, 0*8+3, true},
13 |
14 | {"TAB", 0*8+3, 2*8+4, true},
15 | {"`", 2*8+3, 2*8+3, false, "~"},
16 | {"[", 4*8+3, 2*8+3, false, "{"},
17 | {"]", 6*8+3, 2*8+3, false, "}"},
18 | {";", 8*8+3, 2*8+3, false, ":"},
19 | {"'", 10*8+3, 2*8+3, false, "\""},
20 | {"-", 12*8+3, 2*8+3, false, "_"},
21 | {"=", 14*8+3, 2*8+3, false, "+"},
22 | {"/", 16*8+3, 2*8+3, false, "?"},
23 | {"F11", 18*8+3, 2*8+3, true},
24 | {"F12", 20*8+3, 2*8+3, true},
25 |
26 | {"1", 0*8+3, 4*8+3, false, "!"},
27 | {"2", 2*8+3, 4*8+3, false, "@"},
28 | {"3", 4*8+3, 4*8+3, false, "#"},
29 | {"4", 6*8+3, 4*8+3, false, "$"},
30 | {"5", 8*8+3, 4*8+3, false, "%"},
31 | {"6", 10*8+3, 4*8+3, false, "^"},
32 | {"7", 12*8+3, 4*8+3, false, "&"},
33 | {"8", 14*8+3, 4*8+3, false, "*"},
34 | {"9", 16*8+3, 4*8+3, false, "("},
35 | {"0", 18*8+3, 4*8+3, false, ")"},
36 | {"BAC", 20*8+3, 4*8+4, true},
37 |
38 | {"Q", 0*8+3, 6*8+3},
39 | {"W", 2*8+3, 6*8+3},
40 | {"E", 4*8+3, 6*8+3},
41 | {"R", 6*8+3, 6*8+3},
42 | {"T", 8*8+3, 6*8+3},
43 | {"Y", 10*8+3, 6*8+3},
44 | {"U", 12*8+3, 6*8+3},
45 | {"I", 14*8+3, 6*8+3},
46 | {"O", 16*8+3, 6*8+3},
47 | {"P", 18*8+3, 6*8+3},
48 | {"\\", 20*8+3, 6*8+3, false, "|"},
49 |
50 | {"A", 1*8+3, 8*8+3},
51 | {"S", 3*8+3, 8*8+3},
52 | {"D", 5*8+3, 8*8+3},
53 | {"F", 7*8+3, 8*8+3},
54 | {"G", 9*8+3, 8*8+3},
55 | {"H", 11*8+3, 8*8+3},
56 | {"J", 13*8+3, 8*8+3},
57 | {"K", 15*8+3, 8*8+3},
58 | {"L", 17*8+3, 8*8+3},
59 | {"ENTER", 19*8+3, 8*8+4, true},
60 |
61 | {"Z", 2*8+3, 10*8+3},
62 | {"X", 4*8+3, 10*8+3},
63 | {"C", 6*8+3, 10*8+3},
64 | {"V", 8*8+3, 10*8+3},
65 | {"B", 10*8+3, 10*8+3},
66 | {"N", 12*8+3, 10*8+3},
67 | {"M", 14*8+3, 10*8+3},
68 | {",", 16*8+3, 10*8+3, false, "<"},
69 | {".", 18*8+3, 10*8+3, false, ">"},
70 |
71 | {"CTRL", 0*8+5, 12*8+4, true},
72 | {"ALT", 3*8+3, 12*8+4, true},
73 | {"INS", 12*8+3, 12*8+4, true},
74 | {"DEL", 14*8+3, 12*8+4, true},
75 |
--------------------------------------------------------------------------------
/src/tic_assert.h:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #if (defined(DINGUX) || defined(__DJGPP__)) && !defined(static_assert)
4 | #define static_assert _Static_assert
5 | #endif
6 |
7 | #if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 5
8 | #define static_assert__(x,line) static char stat_ass ## line[(x) ? +1 : -1]
9 | #define static_assert_(x,line) static_assert__(x,line)
10 | #define static_assert(x,y) static_assert_(x, __LINE__)
11 | #endif
12 |
--------------------------------------------------------------------------------
/src/zip.c:
--------------------------------------------------------------------------------
1 | // MIT License
2 |
3 | // Copyright (c) 2017 Vadim Grigoruk @nesbox // grigoruk@gmail.com
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in all
13 | // copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | #include "tools.h"
24 |
25 | #include
26 |
27 | u32 tic_tool_zip(void* dest, s32 destSize, const void* source, s32 size)
28 | {
29 | unsigned long destSizeLong = destSize;
30 | return compress2(dest, &destSizeLong, source, size, Z_BEST_COMPRESSION) == Z_OK ? destSizeLong : 0;
31 | }
32 |
33 | u32 tic_tool_unzip(void* dest, s32 destSize, const void* source, s32 size)
34 | {
35 | unsigned long destSizeLong = destSize;
36 | return uncompress(dest, &destSizeLong, source, size) == Z_OK ? destSizeLong : 0;
37 | }
38 |
--------------------------------------------------------------------------------
/templates/README.md:
--------------------------------------------------------------------------------
1 | # Compiled Language Templates
2 |
3 | This directory contains starter projects (and libs) for the compiled languages we support via `script: wasm`. Currently this list includes:
4 |
5 | - Zig (low-level)
6 | - D (low-level)
7 |
8 | We could easily support these as well, with contributor help:
9 |
10 | - C
11 | - C++
12 | - Go
13 | - Nelua
14 | - Nim
15 | - Odin
16 | - Rust
17 | - Wat
18 |
19 | What is needed? Pull over the example build/template scripts from the [WASM-4](https://wasm4.org) project [templates](https://github.com/aduros/wasm4/tree/main/cli/assets/templates). These are typically well done and well maintained so they are a great starting point.
20 |
21 | - Remove `wasm4.h`.
22 | - Replace with `tic80.h`
23 | - Implement the core API wrapper for your language
24 | - Implement "nice to haves" to make the API easier to use in your language
25 |
26 | If you're interested in helping start by posting on the overarching GitHub topic:
27 |
28 | https://github.com/nesbox/TIC-80/issues/1784
29 |
30 |
31 |
--------------------------------------------------------------------------------
/templates/c/Makefile:
--------------------------------------------------------------------------------
1 | ifndef WASI_SDK_PATH
2 | $(error Download the WASI SDK (https://github.com/WebAssembly/wasi-sdk) and set $$WASI_SDK_PATH)
3 | endif
4 |
5 | CC = "$(WASI_SDK_PATH)/bin/clang" --sysroot="$(WASI_SDK_PATH)/share/wasi-sysroot"
6 | CXX = "$(WASI_SDK_PATH)/bin/clang++" --sysroot="$(WASI_SDK_PATH)/share/wasi-sysroot"
7 |
8 | # Optional dependency from binaryen for smaller builds
9 | WASM_OPT = wasm-opt
10 | WASM_OPT_FLAGS = -Oz --zero-filled-memory --strip-producers
11 |
12 | # Whether to build for debugging instead of release
13 | DEBUG = 0
14 |
15 | # Compilation flags
16 | CFLAGS = -W -Wall -Wextra -Werror -Wno-unused -Wconversion -Wsign-conversion -MMD -MP -fno-exceptions
17 | ifeq ($(DEBUG), 1)
18 | CFLAGS += -DDEBUG -O0 -g
19 | else
20 | CFLAGS += -DNDEBUG -Oz -flto
21 | endif
22 |
23 | # Linker flags
24 | LDFLAGS = -Wl,-zstack-size=8192,--no-entry,--import-memory -mexec-model=reactor \
25 | -Wl,--initial-memory=262144,--max-memory=262144,--global-base=98304
26 | ifeq ($(DEBUG), 1)
27 | LDFLAGS += -Wl,--export-all,--no-gc-sections
28 | else
29 | LDFLAGS += -Wl,--strip-debug,--gc-sections,--lto-O3 -Oz
30 | endif
31 |
32 | OBJECTS = $(patsubst src/%.c, build/%.o, $(wildcard src/*.c))
33 | OBJECTS += $(patsubst src/%.cpp, build/%.o, $(wildcard src/*.cpp))
34 | DEPS = $(OBJECTS:.o=.d)
35 |
36 | ifeq ($(OS), Windows_NT)
37 | MKDIR_BUILD = if not exist build md build
38 | RMDIR = rd /s /q
39 | else
40 | MKDIR_BUILD = mkdir -p build
41 | RMDIR = rm -rf
42 | endif
43 |
44 | all: build/cart.wasm
45 |
46 | # Link cart.wasm from all object files and run wasm-opt
47 | build/cart.wasm: $(OBJECTS)
48 | $(CXX) -o $@ $(OBJECTS) $(LDFLAGS)
49 | ifneq ($(DEBUG), 1)
50 | ifeq (, $(shell command -v $(WASM_OPT)))
51 | @echo Tip: $(WASM_OPT) was not found. Install it from binaryen for smaller builds!
52 | else
53 | $(WASM_OPT) $(WASM_OPT_FLAGS) $@ -o $@
54 | endif
55 | endif
56 |
57 | # Compile C sources
58 | build/%.o: src/%.c
59 | @$(MKDIR_BUILD)
60 | $(CC) -c $< -o $@ $(CFLAGS)
61 |
62 | # Compile C++ sources
63 | build/%.o: src/%.cpp
64 | @$(MKDIR_BUILD)
65 | $(CXX) -c $< -o $@ $(CFLAGS)
66 |
67 | .PHONY: clean
68 | clean:
69 | $(RMDIR) build
70 |
71 | -include $(DEPS)
72 |
--------------------------------------------------------------------------------
/templates/c/README.md:
--------------------------------------------------------------------------------
1 | # C Starter Project Template
2 |
3 | ## Pre-requisites
4 |
5 | - [WASI SDK](https://github.com/WebAssembly/wasi-sdk)
6 |
7 | ## Files in this template
8 |
9 | - ```buildcart.sh``` - convenience script to build and run the game cartridge
10 | - ```buildwasm.sh``` - convenience script to build and run the Wasm program
11 | - ```Makefile``` - convenience Makefile that builds the project
12 | - ```wasmdemo.wasmp``` - TIC-80 Wasm 'script' file. Note the embedded game assets data at the end of the file.
13 |
14 | ## Building your game
15 |
16 | Define the environment variable WASI_SDK_PATH; e.g., if you installed WASI
17 | into ```$HOME/wasi-sdk```, then ```export WASI_SDK_PATH=$HOME/wasi-sdk```.
18 |
19 | Edit ```src/main.c``` to implement your game. You are of course free to
20 | organize your code in more than one C source file.
21 |
22 | If you create sprites, map, music, etc., for your game, remember to
23 | replace the game asset data at the end of ```wasmdemo.wasmp``` with
24 | your creations.
25 |
26 | To build the Wasm file, execute ```make```. This generates ```cart.wasm```
27 | in the build directory. To run:
28 |
29 | ```
30 | % tic80 --fs . --cmd 'load wasmdemo.wasmp & import binary cart.wasm & run & exit'
31 | ```
32 |
33 | The script ```buildwasm.sh``` contains above steps as a convenience.
34 |
35 | To build a TIC-80 cartridge, first build the Wasm file, then build the
36 | cartridge file:
37 |
38 | ```
39 | % tic80 --fs . --cmd 'load wasmdemo.wasmp & import binary cart.wasm & save game.tic & exit'
40 | ```
41 |
42 | You can then run your cartridge as follows:
43 |
44 | ```
45 | % tic80 --fs . --cmd 'load game.tic & run & exit'
46 | ```
47 |
48 | The script ```buildcart.sh``` does the above steps as a convenience.
49 |
50 | ## Additional Notes
51 | TIC-80 API functions that merely duplicate standard library functionality are not imported. Please use the `memcpy` and `memset` functions provided by the C standard library instead.
--------------------------------------------------------------------------------
/templates/c/buildcart.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | rm -f game.tic
3 | make clean
4 | make
5 | tic80 --fs . --cmd 'load wasmdemo.wasmp & import binary build/cart.wasm & save game.tic & exit'
6 | tic80 --fs . --cmd 'load game.tic & run & exit'
7 |
--------------------------------------------------------------------------------
/templates/c/buildwasm.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | make clean
3 | make
4 | tic80 --fs . --cmd 'load wasmdemo.wasmp & import binary build/cart.wasm & run & exit'
5 |
--------------------------------------------------------------------------------
/templates/c/src/main.c:
--------------------------------------------------------------------------------
1 | #include "tic80.h"
2 |
3 | #define max(a, b) (a > b) ? a : b
4 | #define min(a, b) (a < b) ? a : b
5 |
6 | // From WASI libc:
7 | WASM_IMPORT("snprintf")
8 | int snprintf(char* s, size_t n, const char* format, ...);
9 |
10 | int t, x, y;
11 | const char* m = "HELLO WORLD FROM C!";
12 | int r = 0;
13 | Mouse md;
14 | uint8_t transcolors = { 14 };
15 |
16 | WASM_EXPORT("BOOT")
17 | void BOOT() {
18 | t = 1;
19 | x = 96;
20 | y = 24;
21 | }
22 |
23 | WASM_EXPORT("TIC")
24 | void TIC() {
25 | cls(13);
26 |
27 | // The standard demo.
28 | if (btn(0) > 0) { y--; }
29 | if (btn(1) > 0) { y++; }
30 | if (btn(2) > 0) { x--; }
31 | if (btn(3) > 0) { x++; }
32 |
33 | spr(1+t%60/30*2, x, y, &transcolors, 1, 3, 0, 0, 2, 2);
34 | print(m, 60, 84, 15, 1, 1, 0);
35 | t++;
36 |
37 | // Mouse example demonstrating use of libc function.
38 | mouse(&md);
39 | if (md.left) { r = r + 2; }
40 | r--;
41 | r = max(0, min(32, r));
42 | line(md.x, 0, md.x, 136, 11);
43 | line(0, md.y, 240, md.y, 11);
44 | circ(md.x, md.y, r, 11);
45 |
46 | const int BUFSIZ = 10;
47 | char buf[BUFSIZ];
48 | snprintf(buf, BUFSIZ, "(%03d,%03d)", md.x, md.y);
49 | print(buf, 3, 3, 15, 0, 1, 1);
50 | }
--------------------------------------------------------------------------------
/templates/c/wasmdemo.wasmp:
--------------------------------------------------------------------------------
1 | -- desc: WASM Introduction
2 | -- script: wasm
3 |
4 | """""""""""""""""""""""""""""""""""""""
5 | WASM is a binary format. The demo
6 | binary code is embedded in this
7 | cartridge, the source code is not.
8 | Run the cart to see the demo.
9 |
10 | This demo exits for completeness, but
11 | you can't (yet) develop WASM projects
12 | using the built-in editor.
13 |
14 | The code used to build this project
15 | can be found in the TIC-80 repo:
16 |
17 | https://github.com/nesbox/TIC-80/templates/c
18 |
19 | This demo was built with C, but many
20 | languages are supported. You simply
21 | build your project with your external
22 | compiler, then import the final WASM
23 | binary into your cartridge:
24 |
25 | import binary out.wasm
26 |
27 | See README.md for details.
28 |
29 | To learn more visit our Wiki and
30 | the 'Getting Started with WASM' page.
31 |
32 | "
33 | --
34 | -- 001:eccccccccc888888caaaaaaaca888888cacccccccacc0ccccacc0ccccacc0ccc
35 | -- 002:ccccceee8888cceeaaaa0cee888a0ceeccca0ccc0cca0c0c0cca0c0c0cca0c0c
36 | -- 003:eccccccccc888888caaaaaaaca888888cacccccccacccccccacc0ccccacc0ccc
37 | -- 004:ccccceee8888cceeaaaa0cee888a0ceeccca0cccccca0c0c0cca0c0c0cca0c0c
38 | -- 017:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
39 | -- 018:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
40 | -- 019:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
41 | -- 020:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
42 | --
43 |
44 | --
45 | -- 000:00000000ffffffff00000000ffffffff
46 | -- 001:0123456789abcdeffedcba9876543210
47 | -- 002:0123456789abcdef0123456789abcdef
48 | --
49 |
50 | --
51 | -- 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
52 | --
53 |
54 | --
55 | -- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
56 | --
57 |
58 |
--------------------------------------------------------------------------------
/templates/d/Makefile:
--------------------------------------------------------------------------------
1 | DUB_FLAGS = --quiet --build release --compiler ldc2 --arch wasm32-unknown-unknown-wasm
2 | ifneq ($(origin WASI_SDK_PATH), undefined)
3 | override DUB_FLAGS += --config wasi
4 | endif
5 |
6 | build:
7 | dub build ${DUB_FLAGS}
8 |
9 | clean:
10 | rm -rf cart.wasm .dub
11 |
--------------------------------------------------------------------------------
/templates/d/README.md:
--------------------------------------------------------------------------------
1 | # D Starter Project Template
2 |
3 | ## Pre-requisites
4 |
5 | - [LDC](https://wiki.dlang.org/LDC)
6 | - [WASI libc](https://github.com/WebAssembly/wasi-libc)
7 |
8 | ### WASI libc
9 |
10 | WASI libc's [README](https://github.com/WebAssembly/wasi-libc#usage) states
11 | that "the easiest way to get started with this is to use wask-sdk, which
12 | includes a build of WASI libc in its sysroot."
13 |
14 | Just [building WASI libc from source](https://github.com/WebAssembly/wasi-libc#building-from-source)
15 | works too, for the purpose of programming TIC-80 games in D. Let's say you
16 | install into ```$HOME/wasi-sdk/share/wasi-sysroot```, which then look like this:
17 |
18 | ```
19 | % ls -l
20 | total 12
21 | drwxr-xr-x 10 pierce pierce 4096 Apr 24 16:19 include/
22 | drwxr-xr-x 3 pierce pierce 4096 Apr 24 16:19 lib/
23 | drwxr-xr-x 3 pierce pierce 4096 Apr 24 16:19 share/
24 | ```
25 |
26 | ## Files in this template
27 |
28 | - ```buildcart.sh``` - convenience script to build and run the game cartridge
29 | - ```buildwasm.sh``` - convenience script to build and run the Wasm program
30 | - ```dub.json``` - D's dub package description file
31 | - ```Makefile``` - convenience Makefile that invokes ```dub```
32 | - ```wasmdemo.wasmp``` - TIC-80 Wasm 'script' file. Note the embedded game assets data at the end of the file.
33 |
34 | ## Building your game
35 |
36 | Define the environment variable WASI_SDK_PATH; e.g., if you installed WASI
37 | libc into ```$HOME/wasi-sdk/share/wasi-sysroot```, then ```export WASI_SDK_PATH=$HOME/wasi-sdk```.
38 |
39 | Edit ```src/main.d``` to implement your game. You are of course free to
40 | organize your code in more than one D source file.
41 |
42 | If you create sprites, map, music, etc., for your game, remember to
43 | replace the game asset data at the end of ```wasmdemo.wasmp``` with
44 | your creations.
45 |
46 | To build the Wasm file, execute ```make```. This generates ```cart.wasm```
47 | in the current directory. To run:
48 |
49 | ```
50 | % tic80 --fs . --cmd 'load wasmdemo.wasmp & import binary cart.wasm & run & exit'
51 | ```
52 |
53 | The script ```buildwasm.sh``` contains above steps as a convenience.
54 |
55 | To build a TIC-80 cartridge, first build the Wasm file, then build the
56 | cartridge file:
57 |
58 | ```
59 | % tic80 --fs . --cmd 'load wasmdemo.wasmp & import binary cart.wasm & save game.tic & exit'
60 | ```
61 |
62 | You can then run your cartridge as follows:
63 |
64 | ```
65 | % tic80 --fs . --cmd 'load game.tic & run & exit'
66 | ```
67 |
68 | The script ```buildcart.sh``` does the above steps as a convenience.
69 |
70 |
--------------------------------------------------------------------------------
/templates/d/buildcart.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | rm -f game.tic
3 | make clean
4 | make
5 | tic80 --fs . --cmd 'load wasmdemo.wasmp & import binary cart.wasm & save game.tic & exit'
6 | tic80 --fs . --cmd 'load game.tic & run & exit'
7 |
--------------------------------------------------------------------------------
/templates/d/buildwasm.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | make clean
3 | make
4 | tic80 --fs . --cmd 'load wasmdemo.wasmp & import binary cart.wasm & run & exit'
5 |
--------------------------------------------------------------------------------
/templates/d/dub.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cart",
3 | "targetType": "executable",
4 | "configurations": [
5 | {
6 | "name": "raw",
7 | "dflags": [
8 | "-betterC"
9 | ],
10 | "lflags": [
11 | "--strip-all",
12 | "--allow-undefined",
13 | "--stack-first",
14 | "--no-entry"
15 | ]
16 | },
17 | {
18 | "name": "wasi",
19 | "dflags": [
20 | "-betterC",
21 | "-Xcc",
22 | "$WASI_SDK_PATH/share/wasi-sysroot"
23 | ],
24 | "lflags": [
25 | "--strip-all",
26 | "--allow-undefined",
27 | "--stack-first",
28 | "--no-entry",
29 | "$WASI_SDK_PATH/share/wasi-sysroot/lib/wasm32-wasi/libc.a"
30 | ]
31 | }
32 | ],
33 | "toolchainRequirements": {
34 | "dmd": "no",
35 | "gdc": "no",
36 | "ldc": ">=1.11.0"
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/templates/d/src/main.d:
--------------------------------------------------------------------------------
1 | import std.algorithm: min, max;
2 | import tic80;
3 |
4 | extern(C):
5 |
6 | // From WASI libc:
7 | int snprintf(scope char* s, size_t n, scope const char* format, scope const ...);
8 |
9 | int t, x, y;
10 | const char* m = "HELLO WORLD FROM D!";
11 | int r = 0;
12 | MouseData md;
13 |
14 | void BOOT() {
15 | t = 1;
16 | x = 96;
17 | y = 24;
18 | }
19 |
20 | void TIC() {
21 | cls(13);
22 |
23 | // The standard demo.
24 | if (btn(0) > 0) { y--; }
25 | if (btn(1) > 0) { y++; }
26 | if (btn(2) > 0) { x--; }
27 | if (btn(3) > 0) { x++; }
28 |
29 | spr(1+t%60/30*2, x, y, null, 0, 3, 0, 0, 2, 2);
30 | print(m, 60, 84, 15, 1, 1, 0);
31 | t++;
32 |
33 | // Mouse example demonstrating use of libc function.
34 | mouse(&md);
35 | if (md.left) { r = r + 2; }
36 | r--;
37 | r = max(0, min(32, r));
38 | line(md.x, 0, md.x, 136, 11);
39 | line(0, md.y, 240, md.y, 11);
40 | circ(md.x, md.y, r, 11);
41 |
42 | const BUFSIZ = 10;
43 | char[BUFSIZ] buf;
44 | char* bufptr = cast(char*)buf;
45 | snprintf(bufptr, BUFSIZ, "(%03d,%03d)", md.x, md.y);
46 | print(bufptr, 3, 3, 15, 0, 1, 1);
47 | }
48 |
--------------------------------------------------------------------------------
/templates/d/wasmdemo.wasmp:
--------------------------------------------------------------------------------
1 | -- desc: WASM Introduction
2 | -- script: wasm
3 |
4 | """""""""""""""""""""""""""""""""""""""
5 | WASM is a binary format. The demo
6 | binary code is embedded in this
7 | cartridge, the source code is not.
8 | Run the cart to see the demo.
9 |
10 | This demo exits for completeness, but
11 | you can't (yet) develop WASM projects
12 | using the built-in editor.
13 |
14 | The code used to build this project
15 | can be found in the TIC-80 repo:
16 |
17 | https://github.com/nesbox/TIC-80/templates/d
18 |
19 | This demo was built with D, but many
20 | languages are supported. You simply
21 | build your project with your external
22 | compiler, then import the final WASM
23 | binary into your cartridge:
24 |
25 | import binary out.wasm
26 |
27 | See README.md for details.
28 |
29 | To learn more visit our Wiki and
30 | the 'Getting Started with WASM' page.
31 |
32 | "
33 | --
34 | -- 001:eccccccccc888888caaaaaaaca888888cacccccccacc0ccccacc0ccccacc0ccc
35 | -- 002:ccccceee8888cceeaaaa0cee888a0ceeccca0ccc0cca0c0c0cca0c0c0cca0c0c
36 | -- 003:eccccccccc888888caaaaaaaca888888cacccccccacccccccacc0ccccacc0ccc
37 | -- 004:ccccceee8888cceeaaaa0cee888a0ceeccca0cccccca0c0c0cca0c0c0cca0c0c
38 | -- 017:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
39 | -- 018:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
40 | -- 019:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
41 | -- 020:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
42 | --
43 |
44 | --
45 | -- 000:00000000ffffffff00000000ffffffff
46 | -- 001:0123456789abcdeffedcba9876543210
47 | -- 002:0123456789abcdef0123456789abcdef
48 | --
49 |
50 | --
51 | -- 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
52 | --
53 |
54 | --
55 | -- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
56 | --
57 |
58 |
--------------------------------------------------------------------------------
/templates/nim/README.md:
--------------------------------------------------------------------------------
1 | # Nim Starter Project Template
2 |
3 | This is a Nim / TIC-80 starter template. To build wasm binary and import it into
4 | the 'cart.tic' file, ensure you have a Nim compiler, Wasi-SDK and Tic-80 on your system and run:
5 |
6 | ```
7 | nimble buildcart
8 | ```
9 |
10 | Run `nimble tasks` command to see more build options.
11 |
--------------------------------------------------------------------------------
/templates/nim/cart.nimble:
--------------------------------------------------------------------------------
1 | # Package
2 |
3 | version = "0.1.0"
4 | author = "archargelod"
5 | description = "tic80 wasm template for Nim language"
6 | license = "MIT"
7 | srcDir = "src"
8 |
9 |
10 | # Dependencies
11 |
12 | requires "nim >= 2.0.0"
13 |
14 | # Tasks
15 | import std/strformat
16 |
17 | let pwd = getCurrentDir()
18 |
19 | task wasmbuild, "Build wasm binary (debug)":
20 | exec("nim c -o:cart.wasm src/cart")
21 |
22 | task wasmrelease, "Build wasm binary (release)":
23 | exec("nim c -d:release -o:cart.wasm src/cart")
24 |
25 | task buildcart, "Build optimized wasm binary and import it to tic80 cart":
26 | rmFile("cart.tic")
27 | exec("nim c -d:release -o:cart.wasm src/cart")
28 | exec(&"tic80 --cli --fs=\"{pwd}\" --cmd=\"load src/cart.tic & import binary cart.wasm & save cart.tic & exit\"")
29 |
30 | task runcart, "Build optimized wasm binary and run it with tic80":
31 | rmFile("cart.tic")
32 | exec("nim c -d:release -o:cart.wasm src/cart")
33 | exec(&"tic80 --skip --fs=\"{pwd}\" --cmd=\"load src/cart.tic & import binary cart.wasm & save cart.tic & run\"")
34 |
35 | task debugcart, "Build wasm binary in debug mode and run it with tic80":
36 | rmFile("cart.tic")
37 | exec("nim c -o:cart.wasm src/cart")
38 | exec(&"tic80 --skip --fs=\"{pwd}\" --cmd=\"load src/cart.tic & import binary cart.wasm & save cart.tic & run\"")
39 |
--------------------------------------------------------------------------------
/templates/nim/config.nims:
--------------------------------------------------------------------------------
1 | import std/os
2 |
3 | let wasi = getEnv("WASI_SDK_PATH")
4 | if wasi == "" and not defined(nimsuggest):
5 | echo ""
6 | echo "Error:"
7 | echo "Download the WASI SDK (https://github.com/WebAssembly/wasi-sdk) and set the $WASI_SDK_PATH environment variable!"
8 | echo ""
9 | quit(-1)
10 |
11 | switch("cpu", "wasm32")
12 | switch("cc", "clang")
13 | switch("threads", "off")
14 |
15 | # ARC is much more embedded-friendly
16 | switch("gc", "arc")
17 | # Treats defects as errors, results in smaller binary size
18 | switch("panics", "on")
19 |
20 | # Use the common ANSI C target
21 | switch("os", "any")
22 | # Needed for os:any
23 | switch("define", "posix")
24 |
25 | # WASM has no signal handlers
26 | switch("define", "noSignalHandler")
27 | # The only entrypoints are start and update
28 | switch("noMain")
29 | # Use malloc instead of Nim's memory allocator, makes binary size much smaller
30 | switch("define", "useMalloc")
31 |
32 | switch("clang.exe", wasi / "bin" / "clang")
33 | switch("clang.linkerexe", wasi / "bin" / "clang")
34 |
35 | switch("passC", "--sysroot=" & (wasi / "share" / "wasi-sysroot"))
36 |
37 | switch("passL", "-Wl,-zstack-size=8192,--no-entry,--import-memory -mexec-model=reactor -Wl,--initial-memory=262144,--max-memory=262144,--global-base=98304")
38 |
39 | when not defined(release):
40 | switch("assertions", "off")
41 | switch("checks", "off")
42 | switch("stackTrace", "off")
43 | switch("lineTrace", "off")
44 | switch("lineDir", "off")
45 | switch("debugger", "native")
46 | # This is needed to remove all unused Nim functions that will in turn import
47 | # WASI stuff that is not available in WASM-4
48 | switch("passL", "-Wl,--gc-sections")
49 | else:
50 | switch("opt", "size")
51 | switch("passC", "-flto")
52 | switch("passL", "-Wl,--strip-all,--gc-sections,--lto-O3")
53 |
--------------------------------------------------------------------------------
/templates/nim/demo/bunny.tic:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/templates/nim/demo/bunny.tic
--------------------------------------------------------------------------------
/templates/nim/demo/bunnymark.nim:
--------------------------------------------------------------------------------
1 | import std/[random]
2 | import ../cart/tic80
3 |
4 | let ToolbarHeight = 6
5 |
6 | type
7 | Bunny = object
8 | x, y: float32
9 | width: int32 = 26
10 | height: int32 = 32
11 | speedX, speedY: float32
12 | sprite: int32
13 | FPS = object
14 | value, frames: int32
15 | lastTime: float32
16 |
17 | proc getValue(f: var FPS): int32 =
18 | if time() - f.lastTime <= 1000:
19 | inc f.frames
20 | else:
21 | f.value = f.frames
22 | f.frames = 0
23 | f.lastTime = time()
24 | f.value
25 |
26 | proc newBunny: Bunny =
27 | Bunny(
28 | x: rand(0 .. Width).float32,
29 | y: rand(0 .. Height).float32,
30 | width: 26,
31 | height: 32,
32 | speedX: rand(-100.0 .. 100.0) / 60,
33 | speedY: rand(-100.0 .. 100.0) / 60,
34 | sprite: 1,
35 | )
36 |
37 | proc draw(b: Bunny) =
38 | spr(b.sprite, b.x.int32, b.y.int32, transColor=1, w=4, h=4)
39 |
40 | proc update(b: var Bunny) =
41 | b.x += b.speedX
42 | b.y += b.speedY
43 |
44 | if b.x.int32 + b.width > Width:
45 | b.x = float32(Width - b.width)
46 | b.speedX *= -1
47 | if b.x < 0:
48 | b.x = 0
49 | b.speedX *= -1
50 |
51 | if b.y.int32 + b.height > Height:
52 | b.y = float32(Height - b.height)
53 | b.speedY *= -1
54 | if b.y < 0:
55 | b.y = 0
56 | b.speedY *= -1
57 |
58 | randomize(tstamp().int64)
59 |
60 | var fps: FPS
61 | var bunnies: seq[Bunny]
62 |
63 | proc TIC {.exportWasm.} =
64 | cls(13)
65 |
66 | if btn(P1_Up):
67 | for _ in 1..5:
68 | bunnies.add newBunny()
69 |
70 | if btn(P1_Down):
71 | for _ in 1..5:
72 | if bunnies.len > 0:
73 | bunnies.del bunnies.high
74 |
75 | for bunny in bunnies.mitems:
76 | bunny.update()
77 |
78 | for bunny in bunnies.mitems:
79 | bunny.draw()
80 |
81 | rect(0, 0, Width, ToolbarHeight, 0)
82 | print("Bunnies: " & $bunnies.len, 1, 0, 11, false, 1, false)
83 | print("FPS: " & $fps.getValue(), Width div 2, 0, 11, false, 1, false)
84 |
85 |
--------------------------------------------------------------------------------
/templates/nim/src/cart.nim:
--------------------------------------------------------------------------------
1 | import cart/tic80
2 |
3 | var
4 | t = 1
5 | x = 96
6 | y = 24
7 |
8 | proc TIC {.exportWasm.} =
9 | cls(Color13)
10 |
11 | if btn(P1_Up): dec y
12 | if btn(P1_Down): inc y
13 | if btn(P1_Left): dec x
14 | if btn(P1_Right): inc x
15 |
16 | spr(1 + t mod 60 div 30 * 2, x, y, transColor=Color14, scale=3, w=2, h=2)
17 | print("Hello from Nim!", 84, 84)
18 |
--------------------------------------------------------------------------------
/templates/nim/src/cart.tic:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nesbox/TIC-80/663d43924abf6fd7620de6bf25c009ce5b30ab83/templates/nim/src/cart.tic
--------------------------------------------------------------------------------
/templates/rust/.cargo/config.toml:
--------------------------------------------------------------------------------
1 | [build]
2 | target = "wasm32-unknown-unknown"
3 |
4 | [target.wasm32-unknown-unknown]
5 | rustflags = [
6 | "-C", "link-arg=--import-memory",
7 | "-C", "link-arg=--initial-memory=262144",
8 | "-C", "link-arg=--max-memory=262144",
9 | "-C", "link-arg=-zstack-size=106496",
10 | ]
11 |
--------------------------------------------------------------------------------
/templates/rust/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /Cargo.lock
3 |
--------------------------------------------------------------------------------
/templates/rust/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "cart"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | [lib]
7 | crate-type = ["cdylib"]
8 |
9 | [dependencies]
10 | buddy-alloc = { version = "0.4.1", optional = true }
11 |
12 | [profile.release]
13 | lto = true
14 | strip = true
15 |
16 | [features]
17 | # use `--no-default-features` or comment out next line to disable allocator
18 | default = ["buddy-alloc"]
19 |
--------------------------------------------------------------------------------
/templates/rust/README.md:
--------------------------------------------------------------------------------
1 | # Rust Starter Project Template
2 |
3 | ## Important Note
4 | Don't access TIC-80's I/O memory by dereferencing raw pointers. The optimiser will ruin attempts to do this, because Rust has no equivalent to C's `volatile` for direct access. Instead, use [`std::ptr::read_volatile`](https://doc.rust-lang.org/std/ptr/fn.read_volatile.html) and [`std::ptr::write_volatile`](https://doc.rust-lang.org/std/ptr/fn.write_volatile.html), or just use the standard TIC-80 `peek`/`poke`.
5 |
6 | This is a Rust / TIC-80 starter template. Before using it, make sure you have installed the `wasm32-unknown-unknown` target using rustup:
7 | ```
8 | rustup target add wasm32-unknown-unknown
9 | ```
10 |
11 | Then, to build a cart.wasm file, run:
12 |
13 | ```
14 | cargo build --release --target=wasm32-unknown-unknown
15 | ```
16 |
17 | To import the resulting WASM to a cartridge named `game.tic`:
18 |
19 | ```
20 | tic80 --fs . --cmd 'new wasm & import binary target/wasm32-unknown-unknown/release/cart.wasm & save game'
21 | ```
22 |
23 | Or from the TIC-80 console:
24 |
25 | ```
26 | new wasm
27 | import binary target/wasm32-unknown-unknown/release/cart.wasm
28 | save game
29 | ```
30 |
31 | This is assuming you've run TIC-80 with `--fs .` inside your project directory.
32 |
33 |
34 | ## wasm-opt
35 | It is highly recommended that you run `wasm-opt` on the output `cart.wasm` file, especially if using the usual unoptimised builds. To do so, make sure `wasm-opt` is installed, then run:
36 | ```
37 | wasm-opt -Os target/wasm32-unknown-unknown/release/cart.wasm -o cart.wasm
38 | ```
39 | This will create a new, smaller `cart.wasm` file in the working directory.
40 |
--------------------------------------------------------------------------------
/templates/rust/src/alloc.rs:
--------------------------------------------------------------------------------
1 | #![cfg(feature = "buddy-alloc")]
2 |
3 | use std::alloc::{GlobalAlloc, Layout};
4 | use std::cell::RefCell;
5 |
6 | use buddy_alloc::{BuddyAllocParam, FastAllocParam, NonThreadsafeAlloc};
7 |
8 | extern "C" {
9 | static __heap_base: u8;
10 | }
11 |
12 | const FAST_HEAP_SIZE: usize = 24 * 1024;
13 | const LEAF_SIZE: usize = 16;
14 |
15 | // This allocator implementation will, on first use, prepare a NonThreadsafeAlloc using all the remaining memory.
16 | // This is done at runtime as a workaround for the fact that __heap_base can't be accessed at compile time.
17 | struct TicAlloc(RefCell