Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - hoffa

Pages: [1] 2
Miscellaneous / Just Do Whatever the Fuck You Wanna Do Public License
« on: January 07, 2013, 08:12:45 pm »
I decided to give a license to one of the projects I'm working on. However, none of the licenses available are truly free. The GPL is a joke, the Beerware notice requires you to retain the notice, the Do What the Fuck You Want to Public License requires you to change the name if modified, and all the other ones force me to read a headache-inducing novel of legalese.

That's why I decided to create my own, genuinely permissive and free (in every single sense of the word) software license.

Behold, I hereby present you the Just Do Whatever the Fuck You Wanna Do Public License! (or FuPL)

Without further ado, here is the full license:

Code: [Select]
                        Version 1, January 2013

  Copyright (C) 2013 Jane Doe <[email protected]>

  Everyone is permitted to copy and distribute verbatim or modified copies
of this license document, and changing it is allowed.


  0. Just do whatever the fuck you wanna do. Seriously.

I will from now on use it in quite a few of my projects. FSF better approve this software license.

Fight for your freedom! Don't let those brainwashed GPL fanboys hinder your vision!

nSDL / Frequently Asked Questions
« on: January 05, 2013, 04:48:04 pm »
  • What is nSDL?
    nSDL is a port of the widely used, cross-platform and open source SDL graphics library for the Ndless-fueled TI-Nspire.

  • What is SDL?
    According to Wikipedia, "SDL acts as a thin, cross-platform wrapper, providing support for 2D pixel operations, sound, file access, event handling, timing, threading, and more." It's basically a graphics library with event handling, timing and other nice little things.

  • Where can I download nSDL?
    On the nSDL website.

  • How do I install/use nSDL?
    Copy lib and include folders' content in the nSDL package to the respective folders in your Ndless SDK folder. To build your nSDL programs, use and adapt the Makefile.sample file.

  • Is there some nSDL wiki?

  • Which version of SDL is nSDL based on?

  • Do I need to recompile my code for each machine separately?
    No, compile it once and it'll work on any of the calculators. If however it doesn't, check out some other part of the code isn't causing the trouble.

  • What functionalities of SDL are/aren't supported?
    Supported: video, events, SDL_GetTicks()
    Not supported: audio, threads, timers, mouse

  • Will there ever be mouse support?
    Most probably yes. There was partial mouse support in an earlier nSDL version, but it was removed in a later release because the behavior on CX and non-CX calculators was different, making it desperately frustrating to debug as I only have a Touchpad.

  • Are SDL_image or SDL_gfx supported?
    Yes, both have been ported and can be found here.

  • How do I draw text?
    Using the included nSDL-exclusive functions. First load the font with whatever color you want using nSDL_LoadFont(), then draw your stuff with nSDL_DrawString(), and finally free the font using nSDL_FreeFont(). Simple as that. Here's an example:

    nSDL_Font *font = nSDL_LoadFont(NSDL_FONT_TINYTYPE, 255, 0, 0);
    nSDL_DrawString(screen, font, 10, 10, "I love your string, baby.");

    For more information about the different fonts and available flags, check this page out.

  • What are those nSDL-exclusive functions?
    Here's a list of them.

  • Can I draw text in different sizes?

  • How do I use cos(), sin() and other mathematical functions?
    Using the ported fdlibm library which can be found here. Just include libfdm.h in your code. It implements all of the functions defined in math.h. Install it the same way as you'd install nSDL. Remember to link fdlibm using the -lfdm switch.

  • Can I draw text in different sizes?

  • Where do I see which key is mapped to which SDL key value?
    Check out the last part of this file for the latest keymap.

  • Does it run Crysis?
    Yes, the latest tests show that nSDL runs Crysis at about 47 FPS in ultra (note to Fox News: the TI-Nspire doesn't actually run Crysis at 47 FPS). nSDL has been designed with performance in mind.

Many people have trouble setting up their TI-Nspire emulator. Numerous cases of worried moms and fractured frontal bones have been reported as a direct consequence of that very fact.

The time has come for me to step out of my cave and help my comrades out of their misery!

As such, I now deliver to you a single-executable no-bullshit Ndless-already-installed CX-and-Touchpad/Clickpad TI-Nspire emulator! It's isn't even the first of April!

Screenshot for the interested:

It is very much based on Goplat's wonderful nspire_emu, as you might have guessed.

Latest version: 0.1 (EDIT: I need to update the Ndless to the newest one, as with some programs the emulator reboots. I'll do it shortly)

No instructions needed, just launch the executable and enjoy the ride. Both have Ndless already installed and are completely clean otherwise. I'll keep 'em updated.

Have fun! :)

EDIT (by Deep Thought): Removed links. They're basically emulators with ROM images packed inside.

TI-Nspire / nFrotz—Endless adventure games on the TI-Nspire!
« on: June 28, 2012, 09:26:33 am »

I decided to port the Frotz Z-machine interpreter to the TI-Nspire, and here we are!

Basically it allows you to play various text adventure games, even some best-selling extremely popular game from the old times. Here's a short excerpt from Frotz's how-to-play guide, you'll quickly understand if you've never played text adventures:

With Interactive Fiction, you type your commands in plain English each
time you see the prompt which looks like this:



There are many differnet kinds of sentences used in interactive fiction.
Here are some examples:

> walk to the north
> west
> ne
> down
> take the birdcage
> read about dimwit flathead
> look up megaboz in the encyclopedia
> lie down in the pink sofa
> examine the shiny coin
> put the rusty key in the cardboard box
> show my bow tie to the bouncer
> hit the crawling crab with the giant nutcracker
> ask the cowardly king about the crown jewels

You can use multiple objects with certain verbs if you separate them by
the word "and" or by a comma. Here are some examples:

> take the book and the frog
> drop the jar of peanut butter, the spoon, and the lemming food
> put the egg and the pencil in the cabinet

(More information here and here.)

Here for example I'm playing the still popular Zork of the 80's:

Or The Hitchhiker's Guide to the Galaxy:

This is still an early version of nFrotz, so some games do not work at all. But I've included three games that have at some point been very popular (the two mentioned above and The Lurking Horror), they should work fairly well; have had zero issues myself.

Download the latest nFrotz (attached), copy it on your calculator and launch it. It should ask you to install nFrotz (all it does is it adds a file association rule to your ndless.cfg.tns file), once done you should be able to play any games with a .z extension. You need a recent version of Ndless that supports file associations! (couldn't be arsed to write a file browser, it's more elegant this way)

Here are the download links for the games I talked about that you can try out yourself:

Aaand some on-calc footage:

Oh yes, to save your progress, type "save" and confirm. To restore your progress, type "restore".

Latest source code can be viewed on github.

TI-Nspire / PTTKillerSE v1 — Press-to-Test Killer, Stealth Edition
« on: June 07, 2012, 03:07:39 pm »
After compu shared his exploit on how to access documents in Press-to-Test mode (only possible thanks to TI's competence), I decided to write a ripoff of his tool (which you can access here). At this stage it pretty much does the same thing as his program except with a few minor changes, so all credit goes to him. I will however update this for your enjoyment and comfort.

PTTKillerSE's features:
  • Will never display anything on the screen
  • Will get you caught by a teacher watching over your shoulder. You will consequently get kicked out of school and you'll end up on the streets as a miserable hobo. Don't cheat, kids

1. Install Ndless 3.1
2. Copy PTTKillerSE.tns to ndless/startup
3. Put all of the documents you want in Press-to-Test mode in the MyLib folder

Once in Press-to-Test mode, all of your documents will be in the Press-to-Test folder.

Happy cheating!

Edit: Files removed by administrative decision.

TI-Nspire / Ndless Commander 0.4 -- TI-Nspire File Browser
« on: June 02, 2012, 05:16:10 pm »
I'm dumping here one quick hack I put together one night for whoever who might find it interesting. It's called Ndless Commander (à la Midnight Commander), a Ndless file browser. Well actually browsing files and having a preview of the file is the only thing it can do, as I never really finished it (as said in the nSDL thread, I'm leaving soon so I won't have the time to take care of it myself). If anyone's up for the task, be my guest. You can basically venture into the dark abyss of your TI-Nspire's memory.

Screenshots, as usual:

Download's attached (TNS & source code). (oh and it uses nSDL for those who want to play around with the source)

TI-Nspire / Dodgin' Diamond 2X (60 FPS)
« on: May 18, 2012, 02:11:53 pm »
This is an improved port of a SDL game (as such, it uses nSDL) called Dodgin' Diamond 2 (which has been ported to quite a few platforms EDIT: he even mentioned this port on his page 8)). Improved in this case means graphics improvements, gameplay improvements and bug fixes.

It's a vertical shooter à la SNES and has single player mode, co-op mode and high scores.

The controls are as follows:
- For player 1 you can use the whole numpad to move around (7 to go up-left, 6 to go right, etc.) and 5 is for shooting
- For player 2 the keys E,F,G,L,N,S,T,U are used to move around (the same way as player 1) and M is used for shooting
Press CTRL to pause the game.
Press I to show/hide FPS.

Here are a few screenshots:

EDIT: And a new one:

Gameplay video:

The game is attached to this post. (note that it could have been at least twice as small as its current size if I had the time to rearrange the sprite sheet)

Thanks for Pomi for some CX-related testing.
Source code is here.

Click here for latest version (0.3.0)

Calculator C / Issues with the TI-Nspire CX timer
« on: March 14, 2012, 02:20:08 pm »

I've been trying to get the CX timer working for a few days now, but I still haven't succeeded. I based my code on the official documentation; here's the said code:

Code: [Select]
#include <os.h>

#define BASE 0x900C0000
#define LOAD 0x00
#define VALUE 0x04
#define CTRL 0x08

#define CTRL_32BIT 0b00000010
#define CTRL_PERIODIC 0b01000000
#define CTRL_ENABLE 0b10000000

int main(void) {
volatile unsigned *load = (unsigned *)(BASE + LOAD);
volatile unsigned *value = (unsigned *)(BASE + VALUE);
volatile unsigned *control = (unsigned *)(BASE + CTRL);
*(volatile unsigned *)0x900B0018 &= ~(1 << 11);
*(volatile unsigned *)(BASE + 0x80) = 0xA;
*control = 0;
*load = 0xFFFFFFFF;
printf("%u\n", *value);
printf("%u\n", *value);
return 0;

The timer just stays the same, and seems like it breaks the sleep() function after a first run of the program (I checked, and sleep() uses the second timer, while my code uses the first one). If anyone knows how to fix that, I'd greatly appreciate.


TI-Nspire / NGL — TI-Nspire Graphics Library
« on: January 30, 2012, 07:40:05 am »
NGL is a very lightweight graphics library that I've written that provides buffered access to the TI-Nspire's framebuffer. It provides only a few functions and is not supposed to be a full-fledged graphics library with every drawing routine available, it only includes the basic bricks required (i.e. drawing pixels, filling rectangles and drawing sprites). If it even means anything, I'd say I'm sticking to the SDL philosophy.

It is compatible with CX and non-CX calculators, although binaries are not interchangeable between the two, for flexibility- and speed-related reasons. You can find the "documentation" on the project's github, although the code should be self-documenting and not too difficult to grasp.


I have one last issue to tackle/understand before I can provide a nice package of the library (and there are still a few bugs to hunt down and improvements to be made). How am I supposed to declare sprite data? ngl_load_image takes as input raw image data and then parses it, but the problem with defining the raw data array is that either the resulting binary cannot be sent to the calculator, or then that GCC doesn't compile the code (with some undefined reference's to memcpy). If I put the array in another translation unit (i.e. in some header or other file) the former happens. If I declare the array in main's scope, I get the memcpy issues. I see little logic in this, maybe the TI-Nspire doesn't like big chunks of statically allocated data (but GCC itself is a very good compressor). Once I manage to deal with that, drawing sprites would be no issue. Any help regarding that?

EDIT: on hold; working on the SDL port.

Calculator C / Linking static libraries on the TI-Nspire
« on: January 25, 2012, 05:17:38 pm »
I'm porting SDL for the TI-Nspire and ran into some issues while trying to link the resulting static library. I (or rather, the Makefile) first compiled all the SDL source files into objects:

nspire-gcc -Iinclude -nostdlib -lgcc -c in.c -o out.o

It all compiles well, and then I put those objects through ar and ranlib to create a nice libSDL.a. Now when I tried to link that library with some very basic code (just in order to test at least some function is recognized):

Code: [Select]
#include "SDL.h"

int main(void) {
return 0;


nspire-gcc test.c libSDL.a -Iinclude -lc -lgcc

GCC complains:

Code: [Select]
$ nspire-gcc test.c libSDL.a -Iinclude -lc -lgcc
C:\Users\Hoffa\AppData\Local\Temp\ccSJ5EA5.o: In function `exit':
sdl.c:(.text+0x220): undefined reference to `__crt0_savedsp'
sdl.c:(.text+0x224): undefined reference to `__crt0exit'
c:/program files (x86)/yagarto/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib\libc.a(lib_a-exit.o): In function `exit':
C:\msys\1.0\home\yagarto\newlib-build\arm-none-eabi\newlib\libc\stdlib/../../../../../newlib-1.19.0/newlib/libc/stdlib/exit.c:65: undefined reference to `_exit'
c:/program files (x86)/yagarto/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib\libc.a(lib_a-abort.o): In function `abort':
C:\msys\1.0\home\yagarto\newlib-build\arm-none-eabi\newlib\libc\stdlib/../../../../../newlib-1.19.0/newlib/libc/stdlib/abort.c:63: undefined reference to `_exit'
c:/program files (x86)/yagarto/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib\libc.a(lib_a-signalr.o): In function `_kill_r':
C:\msys\1.0\home\yagarto\newlib-build\arm-none-eabi\newlib\libc\reent/../../../../../newlib-1.19.0/newlib/libc/reent/signalr.c:61: undefined reference to `_kill'
c:/program files (x86)/yagarto/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib\libc.a(lib_a-signalr.o): In function `_getpid_r':
C:\msys\1.0\home\yagarto\newlib-build\arm-none-eabi\newlib\libc\reent/../../../../../newlib-1.19.0/newlib/libc/reent/signalr.c:96: undefined reference to `_getpid'
c:/program files (x86)/yagarto/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib\libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
C:\msys\1.0\home\yagarto\newlib-build\arm-none-eabi\newlib\libc\reent/../../../../../newlib-1.19.0/newlib/libc/reent/sbrkr.c:60: undefined reference to `_sbrk'
collect2: ld returned 1 exit status

If I do not link it with libc/newlib (which would actually be better as far as I can see), it would complain about undefined references to memset(). (something warned about in the GCC man pages)
If any of you know how to deal with this issue, it would help me quite a lot; I could start testing some real code.

This is the output when compiling without newlib (i.e., -nostdlib instead of -lc):

Code: [Select]
$ nspire-gcc test.c libSDL.a -Iinclude -nostdlib -lgcc
c:/program files (x86)/yagarto/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/bin/ld.exe: warning: cannot find entry symbol _start; defaulting to 00008000
C:\Users\Hoffa\AppData\Local\Temp\ccqMjuGx.o: In function `exit':
sdl.c:(.text+0x220): undefined reference to `__crt0_savedsp'
sdl.c:(.text+0x224): undefined reference to `__crt0exit'
libSDL.a(SDL_cursor.o): In function `SDL_MouseRect':
SDL_cursor.c:(.text+0x164): undefined reference to `memcpy'
libSDL.a(SDL_keyboard.o): In function `SDL_PrivateKeyboard':
SDL_keyboard.c:(.text+0x390): undefined reference to `memcpy'
libSDL.a(SDL_surface.o): In function `SDL_GetClipRect':
SDL_surface.c:(.text+0x34c): undefined reference to `memcpy'
libSDL.a(SDL_surface.o): In function `SDL_LowerBlit':
SDL_surface.c:(.text+0x3e8): undefined reference to `memcpy'
SDL_surface.c:(.text+0x424): undefined reference to `memcpy'
libSDL.a(SDL_surface.o):SDL_surface.c:(.text+0x838): more undefined references to `memcpy' follow
c:/program files (x86)/yagarto/bin/../lib/gcc/arm-none-eabi/4.6.2\libgcc.a(unwind-arm.o): In function `unwind_phase2':
C:\msys\1.0\home\yagarto\gcc-build\arm-none-eabi\libgcc/../../../gcc-4.6.2/libgcc/../gcc/config/arm/unwind-arm.c:698: undefined reference to `abort'
c:/program files (x86)/yagarto/bin/../lib/gcc/arm-none-eabi/4.6.2\libgcc.a(unwind-arm.o): In function `__gnu_Unwind_Resume':
C:\msys\1.0\home\yagarto\gcc-build\arm-none-eabi\libgcc/../../../gcc-4.6.2/libgcc/../gcc/config/arm/unwind-arm.c:885: undefined reference to `abort'
C:\msys\1.0\home\yagarto\gcc-build\arm-none-eabi\libgcc/../../../gcc-4.6.2/libgcc/../gcc/config/arm/unwind-arm.c:903: undefined reference to `abort'
c:/program files (x86)/yagarto/bin/../lib/gcc/arm-none-eabi/4.6.2\libgcc.a(pr-support.o): In function `_Unwind_GetDataRelBase':
C:\msys\1.0\home\yagarto\gcc-build\arm-none-eabi\libgcc/../../../gcc-4.6.2/libgcc/../gcc/config/arm/pr-support.c:394: undefined reference to `abort'
c:/program files (x86)/yagarto/bin/../lib/gcc/arm-none-eabi/4.6.2\libgcc.a(pr-support.o): In function `_Unwind_GetTextRelBase':
C:\msys\1.0\home\yagarto\gcc-build\arm-none-eabi\libgcc/../../../gcc-4.6.2/libgcc/../gcc/config/arm/pr-support.c:400: undefined reference to `abort'
collect2: ld returned 1 exit status

SDL for the TI-Nspire

nSDL is a port of the widely used, cross-platform and open source SDL graphics library for the Ndless-fueled TI-Nspire.

nSDL 1.1.1 is here! Click here for the new updates.

To download the latest nSDL build and access the wiki, check out the nSDL website.

nSDL also has its own little wiki, which you can access by clicking here.

nSDL features:
  • Full one-binary-for-all support on every TI-Nspire calculator.
  • Very fast & stable buffered drawing.
  • Supports all graphics-related functions, events, non-threaded timer functions, and more.
  • Supports 8- and 16-bit display bit depth.
  • Supports resolutions up to 320 × 240.
  • Draw text using fonts you choose.
  • Load images directly from the executable (image converter included) or use BMPs.
  • SDL_image (supports GIF, LBM, PCX, PNM, TGA and XCF formats) and SDL_gfx available.
  • Full-featured sample program included (it has Link in it!).
  • Based on the robust SDL 1.2.15.


I've been working on a tile engine I named Owl. I had tried it before, but it was generally quite slow and a pain in the butt to use and adapt. I tried it again, but this time a lot more seriously, and it's been progressing nicely. My goal is to make a fast (fast as in TI-Nspire Lua fast), clean, flexible and lightweight tile map engine that anyone can use. The engine currently supports arbitrary-sized maps with scrolling, easy tile, object (anything that can change state during the game), and event (detonate the nuke when Link reads that sign) management. To keep the games responsive, playable and frustration-free, scrolling and movement is blocky, i.e. no smooth scrolling or fancy walking animations (although there will be basic animation management).

As mentioned up there, graphics-heavy TI-Nspire Lua programs (read: programs that use the TI.Image format to draw images a lot) are usually rather slow. But because sprites with a lot of transparent pixels and primitive shapes can be drawn relatively quickly, to tackle the issue of slowness I decided that every tile is defined by an optional background color and and a (hopefully) partially transparent sprite that comes on top of it. That in most cases improves the speed quite a bit. Also I'm working on a map format that will increase the FPS by a good 10%—40%.

All I can give you right now is the current source code, which is kept and updated whenever I commit a change on github (I repeat, it's not ready for public use):

I'll at some point write some sort of documentation and release a public version (when I feel it works and am generally pleased with it, might take some time), but until then you can play around with the code on github if you wish.

EDIT: on hold while I work on the SDL port.

Other Calculators / Classic Pong
« on: December 05, 2011, 09:56:45 pm »
Classic Pong;sa=view;down=756

This is the classic Pong game on the TI-Nspire. You can either play against a friend or against an opponent that adjusts its skill according to yours.

1/0: move left paddle up/down
3/(-): move right paddle up/down
8: toggle game mode (i.e., one or two players)
i: invert colors
r: reset the game

TI-Nspire / Pong (the classic one)
« on: December 02, 2011, 02:35:51 pm »

I wrote this Pong game so I can play it during boring classes with my buddies, nothing too fancy. You can either play against a friend or against an opponent that adjusts its skill according to yours.

  • 1/0: move left paddle up/down
  • 3/(-): move right paddle up/down
  • 8: toggle game mode (i.e., one or two players)
  • i: invert colors
  • r: reset the game

Note: if you have the TouchPad and can't see the ball very well, play around with the brightness settings.

TI-Nspire / [Lua] Tactical Wars CX
« on: November 04, 2011, 01:37:03 pm »
I've been working for some time on a game I named "Tactical Wars CX" (CX as in TI-Nspire CX, as it is targeted for colored displays), a two-player turn-based strategy game. Frankly, it is still missing quite a few things and there are stuff that needs to be changed. There is no AI for the moment, and although I cannot promise you anything, I'll see if I can add some sort of AI in a later version (and considering the fact it's a field I find interesting, there might very well be one in the future), as soon as I have dealt with more important issues. You may find it is lacking in features and everything might not be well-balanced, and I fully agree, and as I said earlier, I'm going to work on them later.

The first thing each player does is choose his or her military units, and then places those units on the map. Right after the units have been placed, the HQ (that spiky tower you can see on one of the screenshots) needs to be built somewhere. If during the game the HQ is destroyed, the player who destroyed it automatically wins. If all of the soldiers of an army are killed, the remaining army (i.e., player) wins. Each army has a certain morale, and that morale evolves during the game based on different actions and variables. The said morale can affect the amount of damage each unit inflict. Every unit--along with an attack, defense, and range value--also has a certain fatigue- or fuel-level, which both replenish if the unit is let to rest (tanks and helicopters get more fuel thanks to the magical Fuel Fairy™), which affects the range of that unit. Special units ("Spetsnaz Team" or "SAS Team") are not visible by the enemy as long as they do not shoot or are not shot. Just to make it clear, that "0 +0" thing you can see in the primitive HUD on the right, shows how much damage you've done during the game and the amount of damage you did on your last hit.

You can download the current version here, but be aware that it's an early version that requires some further developing:

  • 0.2
    • Fixed a typo in the code that might have caused issues at the end of a game
    • Fixed an issue that caused the game to crash at the end, if the user had returned from the unit selection screen to the menu before playing
    • Fixed total damage & previous damage sometimes showing wrong values
    • Fixed an issue with Blue special units disappearing when placing them
    • Added a simple in-game menu
    • Added a proper victory screen
    • Added a help screen
    • Implemented a proper algorithm that generates a list of cells within a certain range (rather than being hard coded)
    • If the player presses the "0" key, circles are drawn around the units for more visibility
    • The fuel/fatigue now decreases/increases based on the distance moved
    • Changed the attributes of different units for more balance
    • The initial available area (on the only map) for placing units has been reduced
    • Only one loop is now used to draw the units, rather than two
    • Units now face the correct direction when the y-coordinate doesn't change while moving
    • After placing the units, the cursor goes to the last unit placed rather than the HQ
    • When attacking, only attackable units are drawn over
    • If a move or an attack is canceled, the cursor returns to the unit
    • Blue units now initially face left
    • Some minor code & UI changes
  • 0.1
    • First release

And finally, a few screenshots: (if you're as anal as me about stuff not being aligned perfectly, well every drawn string is actually one pixel too low on the emulator)

If you want to know how to return to the menu after a game, read this:

Pages: [1] 2