Author Topic: nSDL 1.1.1 Anniversary Edition—The Ultimate TI-Nspire Graphics Library  (Read 140543 times)

0 Members and 2 Guests are viewing this topic.

Offline hoffa

  • Project Author
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: SDL for the TI-Nspire
« Reply #45 on: February 16, 2012, 01:05:57 pm »
I'm now able to fill the screen (which by itself isn't too amazing, but it does prove that the underlying stuff works) and update it (and update any part of the screen for that matter, although with a solid-colored surface it's hard to tell if it works as it should). This is where I'll leave it for a week, going to the French alps tomorrow; gotta pack my skiing gear.

« Last Edit: February 16, 2012, 02:21:09 pm by hoffa »

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: SDL for the TI-Nspire
« Reply #46 on: February 16, 2012, 01:18:27 pm »
Good :)

Make sure to make a backup before leaving ;)
« Last Edit: February 16, 2012, 01:18:40 pm by Lionel Debroux »
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline hoffa

  • Project Author
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: SDL for the TI-Nspire
« Reply #47 on: February 28, 2012, 11:38:09 am »
Alrighty back from the mountains, I can resume the work. It seems that the current code works well when it comes to drawing rectangles and updating specific parts of the screen, which is great. This might mean drawing sprites (and more generally, BMP images) will work without having to do too much work.

« Last Edit: February 28, 2012, 11:38:43 am by hoffa »

Offline alberthrocks

  • Moderator
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 876
  • Rating: +103/-10
    • View Profile
Re: SDL for the TI-Nspire
« Reply #48 on: February 28, 2012, 04:00:39 pm »
...you don't know how much I'm loving you for this! :D Keep up the great work! :D

Just a few questions:
1) Are you using any loaders or none at all? (If none, that's pretty amazing O_O)
2) What portions of the SDL API are you planning to implement? (Sound is possible if you output to certain ports - not conventional sound, unfortunately - you'd have to connect speakers to some dock pins :P) I suggest implementing SDL_DisplayFormat() so I can port one of my SDL apps rather easily. ;) (That one is actually pretty simple - it copies the format of the surface specified in the argument, and creates a new one from it.)
Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/


Proud member of ClrHome!

Miss my old signature? Here it is!
Spoiler For Signature:
Alternate "New" IRC post notification bot (Newy) down? Go here to reset it! http://withg.org/albert/cpuhero/

Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/

Activity remains limited due to busyness from school et al. Sorry! :( Feel free to PM, email, or if you know me well enough, FB me if you have a question/concern. :)

Don't expect me to be online 24/7 until summer. Contact me via FB if you feel it's urgent.


Proud member of ClrHome!

Spoiler For "My Projects! :D":
Projects:

Computer/Web/IRC Projects:
C______c: 0% done (Doing planning and trying to not forget it :P)
A_____m: 40% done (Need to develop a sophisticated process queue, and a pretty web GUI)
AtomBot v3.0: 0% done (Planning stage, may do a litmus test of developer wants in the future)
IdeaFrenzy: 0% done (Planning and trying to not forget it :P)
wxWabbitemu: 40% done (NEED MOAR FEATURES :P)

Calculator Projects:
M__ C_____ (an A____ _____ clone): 0% done (Need to figure out physics and Axe)
C2I: 0% done (planning, checking the demand for it, and dreaming :P)

Offline hoffa

  • Project Author
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: SDL for the TI-Nspire
« Reply #49 on: February 28, 2012, 04:28:31 pm »
1) None currently, but it's sometimes a bit of a mystery to know whether or not a certain issue is caused by global variables (e.g. I'm currently unable to blit BMPs although reading and loading seems to be working; it takes quite a bit of time to go through the code always having in mind the problem might not be caused by the code itself).

2) Video, events, timers and input (i.e. "joystick") are the main things I'm planning to implement. I haven't looked at audio, but it's not impossible that it'll also be included. EDIT: SDL_image and SDL_gfx shouldn't be too difficult to port.

SDL_DisplayFormat is a practically platform-independent function, so it should already work.
« Last Edit: February 28, 2012, 04:54:45 pm by hoffa »

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: SDL for the TI-Nspire
« Reply #50 on: February 29, 2012, 06:50:25 am »
Nice progress!

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: SDL for the TI-Nspire
« Reply #51 on: February 29, 2012, 08:23:16 am »
Once we get a firm grasp on the USB hardware (apparently BrandonW is getting really close) it might be a good idea to try supporting USB audio.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: SDL for the TI-Nspire
« Reply #52 on: February 29, 2012, 09:30:23 am »
Once we get a firm grasp on the USB hardware (apparently BrandonW is getting really close) it might be a good idea to try supporting USB audio.
Great !
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: SDL for the TI-Nspire
« Reply #53 on: February 29, 2012, 12:49:09 pm »
That's indeed great news :)

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: SDL for the TI-Nspire
« Reply #54 on: February 29, 2012, 01:17:52 pm »
Good progress, as usual ;)


I have barely touched the bFLT loader code since I posted in reply #38 of this topic, in that the changes since reply #38 are trivial:
Code: [Select]
--- old/binfmt_flat_mod.c       2012-02-12 20:25:14.000000000 +0100
+++ binfmt_flat.c       2012-02-14 18:54:14.624405087 +0100
@@ -15,40 +15,12 @@
  *     JAN/99 -- coded full program relocation ([email protected])
  */
 
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/mman.h>
-#include <linux/errno.h>
-#include <linux/signal.h>
-#include <linux/string.h>
-#include <linux/fs.h>
-#include <linux/file.h>
-#include <linux/stat.h>
-#include <linux/fcntl.h>
-#include <linux/ptrace.h>
-#include <linux/user.h>
-#include <linux/slab.h>
-#include <linux/binfmts.h>
-#include <linux/personality.h>
-#include <linux/init.h>
-#include <linux/flat.h> // This and arch/arm/include/asm/flat.h contain interesting stuff.
-#include <linux/syscalls.h>
-
-#include <asm/byteorder.h>
-#include <asm/system.h>
-#include <asm/uaccess.h>
-#include <asm/unaligned.h>
-#include <asm/cacheflush.h>
-#include <asm/page.h>
-
 /****************************************************************************/
 
 // Until the code has production status...
 #define DEBUG 1
 
-// We'll probably want both compressed files, and bFLT libraries
+// We want both compressed files, and bFLT libraries
 #define CONFIG_BINFMT_ZFLAT
 #define CONFIG_BINFMT_SHARED_FLAT
 
@@ -96,27 +68,6 @@
 static int load_flat_binary(struct linux_binprm *, struct pt_regs * regs);
 static int flat_core_dump(struct coredump_params *cprm);
 
-// TODO REMOVE Linux-specific
-static struct linux_binfmt flat_format = {
-       .module         = THIS_MODULE,
-       .load_binary    = load_flat_binary,
-       .core_dump      = flat_core_dump,
-       .min_coredump   = PAGE_SIZE
-};
-
-/****************************************************************************/
-/*
- * Routine writes a core dump image in the current directory.
- * Currently only a stub-function.
- */
-// TODO REMOVE Linux-specific
-static int flat_core_dump(struct coredump_params *cprm)
-{
-       printk("Process %s:%d received signr %d and should have core dumped\n",
-                       current->comm, current->pid, (int) cprm->signr);
-       return(1);
-}
-
 /****************************************************************************/
 /*
  * create_flat_tables() parses the env- and arg-strings in new user
@@ -550,10 +501,8 @@
                 */
                DBG_FLT("BINFMT_FLAT: ROM mapping of file (we hope)\n");
 
-               down_write(&current->mm->mmap_sem); // TODO REMOVE
                textpos = do_mmap(bprm->file, 0, text_len, PROT_READ|PROT_EXEC,
                                  MAP_PRIVATE|MAP_EXECUTABLE, 0); // TODO PORT we'll probably read everything to RAM
-               up_write(&current->mm->mmap_sem); // TODO REMOVE
                if (!textpos || IS_ERR_VALUE(textpos)) {
                        if (!textpos)
                                textpos = (unsigned long) -ENOMEM;
@@ -564,10 +513,8 @@
 
                len = data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long);
                len = PAGE_ALIGN(len);
-               down_write(&current->mm->mmap_sem); // TODO REMOVE
                realdatastart = do_mmap(0, 0, len,
                        PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0); // TODO PORT we'll probably copy everything to RAM
-               up_write(&current->mm->mmap_sem); // TODO REMOVE
 
                if (realdatastart == 0 || IS_ERR_VALUE(realdatastart)) {
                        if (!realdatastart)
@@ -611,10 +558,8 @@
 
                len = text_len + data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long);
                len = PAGE_ALIGN(len);
-               down_write(&current->mm->mmap_sem); // TODO REMOVE
                textpos = do_mmap(0, 0, len,
                        PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0); // TODO PORT we'll probably read everything to RAM
-               up_write(&current->mm->mmap_sem); // TODO REMOVE
 
                if (!textpos || IS_ERR_VALUE(textpos)) {
                        if (!textpos)
@@ -962,16 +907,3 @@
 
        return 0;
 }
-
-/****************************************************************************/
-// TODO REMOVE Linux-specific
-static int __init init_flat_binfmt(void)
-{
-       return register_binfmt(&flat_format);
-}
-
-/****************************************************************************/
-
-core_initcall(init_flat_binfmt);
-
-/****************************************************************************/

As I wrote above:
Quote
and I don't have time to undertake such a task alone - for a start, not this evening.
« Last Edit: February 29, 2012, 01:22:51 pm by Lionel Debroux »
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline hoffa

  • Project Author
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: SDL for the TI-Nspire
« Reply #55 on: March 01, 2012, 02:15:12 pm »
I wrote an early version of the joystick input driver (i.e. the TI-Nspire's keypad works as a SDL "joystick"). I behaves a bit weird with SDL_PollEvent (endless events once the first one is fired), but with SDL_WaitEvent it seems to be behaving as it should. It has two axes obviously (left/right and up/down) and 24 buttons (only the most used ones are currently included). No hats, but the touchpad could be used as a joystick trackball though. Anyway if you want to try it out yourself grab the tinspire_test/tinspire_test.tns on github, you should be able to paint the screen using the arrow keys and exit using esc. Check the tinspire_test.c file if you want to see what the code looks like (it's a big SDL hell though, I just quickly add code to test it).



BTW, should the joystick fire events as long as an arrow key is pressed or should it just fire the very first one? The former seems more logical to me when it's about joysticks.
« Last Edit: March 01, 2012, 02:20:52 pm by hoffa »

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: SDL for the TI-Nspire
« Reply #56 on: March 01, 2012, 02:46:32 pm »
Again, nice work :)

Offline njaddison

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 176
  • Rating: +24/-27
    • View Profile
Re: SDL for the TI-Nspire
« Reply #57 on: March 01, 2012, 11:23:33 pm »
The ti-nspire test file reboots my nspire when I open it!
<a href="http://www.nerdtests.com/ft_nt2.php">
<img src="http://www.nerdtests.com/images/badge/nt2/5f42ec78e054645d.png" alt="NerdTests.com says I'm a Highly Dorky Nerd God.  Click here to take the Nerd Test, get geeky images and jokes, and talk to others on the nerd forum!">
</a>


Offline hoffa

  • Project Author
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: SDL for the TI-Nspire
« Reply #58 on: March 02, 2012, 01:17:11 am »
You're trying it on the classical TI-Nspire I suppose (and hope)? I forgot to mention it but I'm only working on the CX right now (the classical one is another story because of its annoying 4-bit pixels, which requires some special care), and as such it should only work on that calculator (which, funnily enough, I do not own; relying fully on the emulator).

EDIT: I'd appreciate it if somebody could check if the TNS works as it should on their physical CX. :)
« Last Edit: March 02, 2012, 01:25:14 am by hoffa »

Offline atiatinini

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 19
  • Rating: +0/-0
    • View Profile
Re: SDL for the TI-Nspire
« Reply #59 on: March 02, 2012, 01:53:50 pm »
It works, but the loading cursor (the one that looks like a clock) keeps flashing on the screen when pressing the touchpad and sometimes the program freezes for some seconds.
But very nice work!  :)
« Last Edit: March 02, 2012, 01:59:18 pm by atiatinini »