Author Topic: Post your Nspire routines here!  (Read 106545 times)

0 Members and 3 Guests are viewing this topic.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Post your Nspire routines here!
« Reply #45 on: June 21, 2010, 02:37:26 am »
no problem, there are over 6 hours between the posts anyway :P

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: Post your Nspire routines here!
« Reply #46 on: June 21, 2010, 08:10:55 pm »
It's working now. At first, I thought the bounds would be (1,240) and (1,320), similar to TI-BASIC, but they really start at 0.

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: Post your Nspire routines here!
« Reply #47 on: June 22, 2010, 04:21:30 pm »
Doesn't BASIC's pixel-On follow those conventions too?

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: Post your Nspire routines here!
« Reply #48 on: July 05, 2010, 05:54:44 pm »
What is the usage of char* scrbuf in the graphics functions?

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: Post your Nspire routines here!
« Reply #49 on: July 05, 2010, 06:18:40 pm »
It's a double-buffer, allocated with malloc() in the calling program. It allows for flicker-free animation.

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: Post your Nspire routines here!
« Reply #50 on: July 06, 2010, 11:58:19 am »
How do you write code using the buffer?

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: Post your Nspire routines here!
« Reply #51 on: July 06, 2010, 05:02:39 pm »
Like so:
Code: [Select]
char* scrbuf = (char*) malloc(SCREEN_BYTES_SIZE);
line(scrbuf, x1, x2, y1, y2);
refresh(scrbuf);
« Last Edit: July 06, 2010, 05:03:03 pm by bwang »

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: Post your Nspire routines here!
« Reply #52 on: July 06, 2010, 06:07:29 pm »
BUt what value do I use for scrbuf? Also, is there a way to draw a line directly to the screen?
« Last Edit: July 06, 2010, 06:08:07 pm by fb39ca4 »

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Post your Nspire routines here!
« Reply #53 on: July 06, 2010, 06:17:07 pm »
BUt what value do I use for scrbuf? Also, is there a way to draw a line directly to the screen?
scrbuf isn't a value, it's a pointer. It is defined by the malloc statement. And to draw directly to the screen, you would use (char*)0xA4000100 instead of scrbuf as an argument to the line routine. This buffer might actually be defined somewhere already, but I'm not familiar with the Nspire include files.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: Post your Nspire routines here!
« Reply #54 on: July 06, 2010, 07:36:39 pm »
There's really no reason to draw directly to the screen. Drawing to a buffer is faster and more versatile.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Post your Nspire routines here!
« Reply #55 on: July 06, 2010, 08:28:26 pm »
What Bwang said. Plus you won't get flickering when stuff moves around (and needs to be erased to do so). I don't know how Nspire ASM/C compares to 83+ Axe, but on 83+ Axe, inverting the entire screen bit by bit takes about 20-30 seconds for 6144 pixels if you draw directly to the LCD. When storing to the buffer then only updating the screen once everything is done, it took about half a second.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Post your Nspire routines here!
« Reply #56 on: July 06, 2010, 08:59:59 pm »
What Bwang said. Plus you won't get flickering when stuff moves around (and needs to be erased to do so). I don't know how Nspire ASM/C compares to 83+ Axe, but on 83+ Axe, inverting the entire screen bit by bit takes about 20-30 seconds for 6144 pixels if you draw directly to the LCD. When storing to the buffer then only updating the screen once everything is done, it took about half a second.
Well, on Nspire there won't be any speed difference when drawing to the LCD because it is memory-mapped like the TI-85 model and up. There might be some flickering though, if the screen updates while you are drawing your graphics.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Post your Nspire routines here!
« Reply #57 on: July 06, 2010, 09:16:15 pm »
Really? I thought that despite the screen being memory-mapped, there could still be a slight difference? I guess it makes sense that there isn't a speed change if it's really tied directly to the buffer, though.

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: Post your Nspire routines here!
« Reply #58 on: July 06, 2010, 09:53:48 pm »
"Some flickering" is an understatement. Without double-buffering, animations flicker so much that they are nearly unusable.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Post your Nspire routines here!
« Reply #59 on: July 06, 2010, 09:59:38 pm »
Well, my emulators actually draw directly to the screen buffer.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman