Author Topic: Request: Post a pre compiled dev version of Ndless 2.0  (Read 16031 times)

0 Members and 1 Guest are viewing this topic.

Offline shrear

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 193
  • Rating: +17/-0
    • View Profile
Re: Request: Post a pre compiled dev version of Ndless 2.0
« Reply #30 on: February 25, 2011, 05:06:09 pm »
I currently need more development workforce than testing. How about implementing the Touchpad keypad protocol from Goplat's spec? :)
I may give that a try tomorrow...(and probably fail epic at it :p)
but this line I can contribute now:
#define KEY_NSPIRE_FRAC      KEYTPAD_(_KEY_DUMMY_ROW, _KEY_DUMMY_COL, 0x1A, 0x100)
that key is still missing in common.h, even though I doubt that somebody will use this one in near future

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: Request: Post a pre compiled dev version of Ndless 2.0
« Reply #31 on: February 25, 2011, 05:13:52 pm »
Thanks! Just commited to the trunk.
Ndless.me with the finest TI-Nspire programs

Offline merauder75

  • LV3 Member (Next: 100)
  • ***
  • Posts: 75
  • Rating: +1/-1
    • View Profile
Re: Request: Post a pre compiled dev version of Ndless 2.0
« Reply #32 on: February 25, 2011, 05:16:42 pm »
Well, I cant code really, but Im totally willing to risk my nspire for testing
Known Programming Languages:
C++,C#,Java,Python,Lua,PHP,x86 ASM,TI-Basic(Z80 and Nspire),C

Offline Goplat

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 289
  • Rating: +82/-0
    • View Profile
Re: Request: Post a pre compiled dev version of Ndless 2.0
« Reply #33 on: February 25, 2011, 05:37:21 pm »
I currently need more development workforce than testing. How about implementing the Touchpad keypad protocol from Goplat's spec? :)

Did you want to implement the I2C code? It might be easier to just make syscalls for the OS functions for read/write. Quick example of usage: (for OS 2.0.1 non-CAS)

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

// returns 0 on failure, 1 on success
// addresses are for 2.0.1 non-CAS
#define touchpad_read ((int (*)(unsigned char start, unsigned char end, void *buf))0x10174A48)
#define touchpad_write ((int (*)(unsigned char start, unsigned char end, const void *buf))0x10174B38)

static inline void clearScreen() {
  memset(SCREEN_BASE_ADDRESS, 0xFF, SCREEN_BYTES_SIZE);
}

static inline void setPixel(int x, int y, int color) {
  unsigned char* p = (unsigned char*)(SCREEN_BASE_ADDRESS + ((x >> 1) + (y << 7) + (y << 5)));
  *p = (x & 1) ? ((*p & 0xF0) | color) : ((*p & 0x0F) | (color << 4));
}

int main() {
  int cpsr;
struct {
unsigned char width[2];
unsigned char height[2];
} size;
int width, height;

// be sure to turn interrupts off when accessing a different touchpad page
// TI's interrupt handler expects it to be set to page 4
asm ("mrs %0, cpsr" : "=r" (cpsr));
asm ("msr cpsr_c, %0" : : "r" (cpsr | 0xC0));
touchpad_write(0xFF, 0xFF, "\x10");
touchpad_read(0x04, 0x07, &size);
touchpad_write(0xFF, 0xFF, "\x04");
asm ("msr cpsr_c, %0" : : "r" (cpsr));

width = size.width[0] << 8 | size.width[1];
height = size.height[0] << 8 | size.height[1];

clearScreen();

while (*(int *)0x900E001C & 0x80) { // loop until ESC pressed
struct {
unsigned char contact;
unsigned char proximity;
unsigned char x[2];
unsigned char y[2];
} cur;
int x, y;
touchpad_read(0x00, 0x05, &cur);
if (cur.contact) {
x = cur.x[0] << 8 | cur.x[1];
y = cur.y[0] << 8 | cur.y[1];
x = x * 319 / width;
y = 239 - (y * 239 / height);
if (x >= 0 && y >= 0 && x < 320 && y < 240)
setPixel(x, y, 0);
}
}

return 0;
}
Numquam te deseram; numquam te deficiam; numquam circa curram et te desolabo
Numquam te plorare faciam; numquam valedicam; numquam mendacium dicam et te vulnerabo

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: Request: Post a pre compiled dev version of Ndless 2.0
« Reply #34 on: February 25, 2011, 06:07:57 pm »
Great! I like it.
I suppose Ndless should both make available the current isKeyPressed() function to detect left/right/...  and a new touchpad-specific scanning function. Touchpad-based games may be fun to play!
Ndless.me with the finest TI-Nspire programs

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Request: Post a pre compiled dev version of Ndless 2.0
« Reply #35 on: February 25, 2011, 06:10:43 pm »
I really wish I had a touchpad. Manipulating the clickpad to play nDoom and a few other games can be annoying sometimes. X.x


Offline merauder75

  • LV3 Member (Next: 100)
  • ***
  • Posts: 75
  • Rating: +1/-1
    • View Profile
Re: Request: Post a pre compiled dev version of Ndless 2.0
« Reply #36 on: February 25, 2011, 06:36:17 pm »
Hey, ive just tested nDoom with a clickpad and a touchpad, the clickpad doesnt entirely work, it spazzes out on exit and the right arrow key doesnt function.
The touchpad works alright, I just hope you guys get the touchpad jeys mapped sooner or later. No rush though
Known Programming Languages:
C++,C#,Java,Python,Lua,PHP,x86 ASM,TI-Basic(Z80 and Nspire),C

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Request: Post a pre compiled dev version of Ndless 2.0
« Reply #37 on: February 25, 2011, 10:45:22 pm »
On the clickpad, as I reported in the nDoom thread, the clickpad worked but the game froze when I shot and moved at the same time.

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Request: Post a pre compiled dev version of Ndless 2.0
« Reply #38 on: February 26, 2011, 02:36:06 am »
Quote
I suppose Ndless should both make available the current isKeyPressed() function to detect left/right/...  and a new touchpad-specific scanning function. Touchpad-based games may be fun to play!
Indeed, I think that there should be a mode providing direct access to the touchpad.
In addition to this, perhaps left/right/up/down/click should be removed from the key macros used with isKeyPressed(), and pushed to a new way of checking those keys, which would make it easier to abstract Clickpad vs. Touchpad ?
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: Request: Post a pre compiled dev version of Ndless 2.0
« Reply #39 on: March 03, 2011, 09:30:47 am »
I currently need more development workforce than testing. How about implementing the Touchpad keypad protocol from Goplat's spec? :)

Did you want to implement the I2C code? It might be easier to just make syscalls for the OS functions for read/write. Quick example of usage: (for OS 2.0.1 non-CAS)

Ok, I now have both isKeyPressed() working with an emulated Touchpad, and a Touchpad API for  x/y coordinates scanning.

But I should I detect a click?

[edit]Also I see that the OS doesn't call touchpad_read() until a key is pressed. Would there be a lighter way to just check if the Touchpad is currently touched (to update Ndless's any_key_pressed())?
« Last Edit: March 03, 2011, 10:54:31 am by ExtendeD »
Ndless.me with the finest TI-Nspire programs