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.


Messages - hoffa

Pages: 1 ... 11 12 [13] 14 15 ... 22
181
nSDL / Re: SDL for the TI-Nspire
« on: March 15, 2012, 03:14:14 pm »
Alrighty guys, I'm happy to announce the first beta version of SDL for the TI-Nspire will come out very soon. :)

But before I can do that, I need someone to check one thing on their physical CX. It's everything but complicated; download the attachment, send it to your calculator and enjoy the nice fonts and just observe how the timer increases. It should output the number of milliseconds since SDL initialization, so it should increase at a rate of 1000 a second. Press any key to update that value. If it increases way too fast, just tell me. That's all I need you to do, it should take just a few seconds. Thank you a lot for whoever helps me; the faster I get the info the faster I can release SDL. :)

I've made quite a few changes since last update. I changed to a much faster, more flexible and cleaner font system, updated the timer stuff, fixed some issues and whatnot.

182
Calculator C / Re: Issues with the TI-Nspire CX timer
« on: March 14, 2012, 04:36:23 pm »
I tried setting BASE+0x80 to 0xA later but it didn't do anything. Also I checked the ARM Linux code to see how it dealt with the same timer, and it set the Value register; tried doing the same, that's why it's there. Actually I checked the code I posted in PM, and it did work to a certain extent, but now I remember the issue was with setting the Load register. It's as if it took some time before the timer became aware of the new value, and consequently measuring intervals became a mess. Well now I just decided not to play with the Load register at all. Here's the code that works for any future wanderer that might end up in this thread:

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

int main(void) {
volatile unsigned *value = (unsigned *)0x900C0004;
volatile unsigned *control = (unsigned *)0x900C0008;
int i;
*(volatile unsigned *)0x900B0018 &= ~(1 << 11);
*(volatile unsigned *)0x900C0080 = 0xA;
*control = 0b10100010;
unsigned start = *value;
for(i = 0; i < 10; ++i) {
printf("timer: %u\n", *value);
sleep(100);
}
printf("diff: %u\n", start - *value);
return 0;
}

Thanks again.

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

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;
*control = CTRL_32BIT | CTRL_PERIODIC | CTRL_ENABLE;
printf("%u\n", *value);
sleep(3000);
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.

Thanks.

184
nSDL / Re: SDL for the TI-Nspire
« on: March 12, 2012, 06:52:57 pm »
Is nSDL far enough to start porting SDL programs to the nspire? Or do you need to do more work? (I know nothing about SDL, so I have no clue what you have to do to finish it) Also, could I put custom fonts off of my computer on my nspire using nSDL without having to make the font over again?
I wouldn't say it is yet. Depends what programs of course, but a few crucial things are missing, and it needs some testing (but that's when it comes to porting more sophisticated programs in the current state; writing your own shouldn't be that big of an issue though). Also many programs use floating point math, and it doesn't seem like Ndless in its current states supports any of that. I'd say if everything goes nicely there might be an early beta at the end of the week.

Also, the video isn't showing, maybe it's because youtube is blocked at my school? I had no problem viewing youtube videos off of omnimaga before...
Yeah it's just you, the video works.

185
nSDL / Re: SDL for the TI-Nspire
« on: March 12, 2012, 04:07:56 pm »
While I'm dealing with the timer stuff, I decided to implement fonts. There are 4 fonts included by default, but it's easily extensible. See for yourself:



Drawing fonts is as easy as calling the SDL_NSP_DrawString() function (any TI-Nspire-specific functions I add will be prefixed with SDL_NSP_*).

186
nSDL / Re: SDL for the TI-Nspire
« on: March 11, 2012, 11:19:19 am »
Yes, or more generally, I fixed most of the blitting issues. Here's a short video so you can more or less see how blitting a big image runs speed-wise:



EDIT: I actually forgot to pass the surface through SDL_DisplayFormat() to convert to the screen's pixel format. With SDL_DisplayFormat() it's a lot snappier.

EDIT2: Here's another video that gives a better impression of the blitting speed (and seems like there are some issues with timers I need to fix):


187
nSDL / Re: SDL for the TI-Nspire
« on: March 11, 2012, 09:15:02 am »
Indeed, yeah. Damn sweet.



Here's the todo list from the README, so you can see what's still left to do:
Code: [Select]
Todo:
- Add SDL_GetTicks() for CX
- Map more keys to SDLKs
- Add support for diagonal arrow keys in events & joystick
- Should the joystick continuously fire events if an arrow key is held down?
- Put all the compiled objects in one folder, along with libSDL.a?
- Add some own function to load images stored in arrays (?)
- Add mouse support
A few of those are trivial to do, but as you can see there's not much left before a beta, if everything goes well and if I don't find any other issues.

188
nSDL / Re: SDL for the TI-Nspire
« on: March 11, 2012, 09:01:02 am »
Some more great news, not sure if this even requires an explanation:


189
nSDL / Re: SDL for the TI-Nspire
« on: March 10, 2012, 03:07:29 pm »
After a long time, I finally have some results on the CX when it comes to blitting BMP images. The debugging has been very laborious without proper tools, but it seems to work now. I still need to go through the code as it currently uses a slow blitter, and there's some optimized version available, but I'm skipping the part that chooses the blitter as it's what's causing problems.
Enjoy: (and notice the silly debugging messages)



When I get the checking to work, I need to look at the non-CX model which has similar issues with blitting.

190
Oh wow didn't notice there were new posts here. Owl is on hold while I work on the SDL port, so don't expect any updates right now.

hoffa, could anything done with Ndless Lua extensions to improve the engine?
An alternative to the default key press detection?
Scrolling?
A wrapper to nRGBlib's drawTile8Multicolors()?
I think I'll keep this project as TI-Nspire's official Lua only.

[offtopic]
hoffa, I wonder why you have the North Korea propaganda poster ???
[/offtopic]
It's ironical; I found the NK propaganda videos very amusing. Beware of anything I say. I'm also supporting the Free People of the Democratic People's Republic of Korea in their heroic struggle to crush the American Imperialists.

191
TI-Nspire / Re: Graphics Drivers for the TI-Nspire
« on: March 07, 2012, 09:21:07 am »
Voilà. But as Lionel mentioned, the whole "3D graphics drivers" doesn't make much sense as there's no hardware acceleration on the TI-Nspire.

192
nSDL / Re: SDL for the TI-Nspire
« on: March 06, 2012, 10:32:32 am »
I dealt with the 16-bit/32-bit timer issue on the non-CX models by using the RTC on the calculator and add a multiple of 2^16 to the tick count variable if necessary. That way it works like a 32-bit timer, and SDL_GetTicks() works as it really should. Plus, it's set to 1024 Hz as calc84maniac suggested, which gives quite a lot of accuracy (accuracy as in ticks/s; I'm using the approximation that 1 kHz ~= 1.024 kHz though, so there's a tiny percentage of error on very long runs).

Thought it was kinda illegal to distribute roms.
But anyway, it can be done with a real CX using polydumper available on tiplanet.org
It is, and many things in life are. But in all honesty, for such trivial matters I don't really care. Although I don't want to break the forum rules, hence I'm dealing with that in private.

193
nSDL / Re: SDL for the TI-Nspire
« on: March 05, 2012, 06:41:06 pm »
Hmm, yeah, it's usually used to measure intervals so it might be a good idea to do that. I'll maybe lower it a bit just to be safe (as in 512 Hz? It would give a precision of ~0.002s and double the better-get-the-tick-value-or-else time).

194
nSDL / Re: SDL for the TI-Nspire
« on: March 05, 2012, 06:34:21 pm »
Hoffa, how did you get the boot 1 for the cx? I don't have a cx, but I've been wanting to use one with nspire_emu. I just have a regular nspire, but it would be nice to have an nspire cx on the nspire_emu.
I got it off someone else. Drop me a PM and I'll send it to you tomorrow.

Also Hoffa, how are you handling the fact that the timer is 16-bit? I think the SDL_GetTicks() is supposed to return a 32-bit value.
Well currently I just convert the timer value to milliseconds and return it. I should indeed return the number of milliseconds since SDL was initialized, and simulating a 32-bit timer is rather painstaking with a 16-bit timer unless I somehow periodically check for overlaps and add that to the overall value. I might do it sometime later, but currently it would unnecessarily complexify the code, it would be too much hassle for something that isn't that big of an issue. Currently the timer precision is only at 10 Hz (i.e. 0.1s precision), but that gives ~1.8 hours without a timer reset. I doubt anyone uses the same program on a calculator that long anyway, so I guess I'll increase the timer to 20 Hz (or more) tomorrow.

195
nSDL / Re: SDL for the TI-Nspire
« on: March 05, 2012, 05:48:17 pm »
Alrighty now SDL_GetTicks() should work on the non-CX models (thanks calc84maniac), and once I get the same done for CX's, it'll be as far as I'll go as far as timers are concerned (that makes a lot of as'). Implementing SDL_AddTimer() and whatnot requires some sort of threads or pseudo-threads, plus they're rarely used. Also the event system does actually work as it should, it was just me who used SDL_PollEvent() wrong.

So basically the things that still need to be written/fixed are the timer things for CX (should be pretty straightforward once I have the courage to read the CX timer documentation), BMP blitting and some issues with non-CX surfaces. If everything goes well those two last things are the real problems I still need to tackle. BMP blitting might not work because of some other thing that does not work as it should (something I have not yet noticed), and the issues on non-CX models seem to be caused by surfaces created with SDL_CreateRGBSurface() (in fact it fails if I try to blit a surface created with that function). Also ExtendeD might soon update Ncubate which should be great; GDB would speed up the debugging process quite a bit. :)

Pages: 1 ... 11 12 [13] 14 15 ... 22