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 ... 10 11 [12] 13 14 ... 21
166
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.

167
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.

168
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_*).

169
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):

170
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.

171
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:


172
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.

173
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.

174
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.

175
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).

176
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).

177
nSDL / Re: SDL for the TI-Nspire
« on: March 05, 2012, 06:34:21 pm »
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.

178
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. :)

179
Miscellaneous / Re: topic about yesterday
« on: March 05, 2012, 01:29:58 pm »
That's the impression I have gotten, but I'm sure it's more than just an impression.

180
Miscellaneous / Re: topic about yesterday
« on: March 05, 2012, 10:57:51 am »
Religion has absolutely nothing to do with Omnimaga and should be completely and in every way left out of here. And that means no special privileges for anyone. I've been enough on the Internet to know any "discussion" or "debate" on religion eventually turns into a massive shitfest (my yesterday's flamebait quote was there to release the Kraken and end the vicious circle of retarded arguments and one-way thinking; it thankfully got locked quickly). It's like the YouTube comment section all over again when it comes to religion and the Internet. If something does not fit with one's beliefs on Omnimaga or any other nonreligious place, then he or she must turn away or leave.

Pages: 1 ... 10 11 [12] 13 14 ... 21