Is it possible to change the location of the video memory? For example – on the ti89 calculator, a pointer points to the beginning to the video memory, and by changing that pointer, the screen would be updated to reflect the new video memory. Is this possible in nxc?
I have been working on getting grayscale on the nxt, but I have not been able to sync any drawing operations with the 10 Hz refresh rate. I think it would be a lot easier if I could just write to different sections of memory, and just change the active screen area every 10 milliseconds. I am aware that this is next to useless because nxc has no pointer support (or it does and I’m just an idiot).
Sorry if this was a stupid question.
Change the active video memory?
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: Change the active video memory?
That is basically another way of saying what I asked for yesterday I can see now that I am not the only one that wants this concept.
One thing though, 10 Hz would be every 100ms, not 10ms.
One thing though, 10 Hz would be every 100ms, not 10ms.
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
-
- Posts: 3
- Joined: 10 May 2011, 15:56
Re: Change the active video memory?
Stupid I, I always have to change my programs because I keep perceiving milliseconds as 1/100 of a second. I saw your thread, but I think we can probably get much better quality if we can implement this method. In fact a year ago, before nxtasy went down, I posted a similar request to this, except I asked about a specific function I believed could accomplish this (forgot the function, though).
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: Change the active video memory?
Well, don't feel too bad... in NQC, 10 WOULD be 1/10 of a second. The RCX uses 100th's of a second. Perhaps you get them mixed up (I know that I still do, only the other way around).
I tried for a few minutes the other day to implement this as a custom function, but only with text (no graphics). I got hung up on parsing the string into an array of chars, but I know of another thing to try now... Although this still wouldn't help for graphics, it could help for text.
I tried for a few minutes the other day to implement this as a custom function, but only with text (no graphics). I got hung up on parsing the string into an array of chars, but I know of another thing to try now... Although this still wouldn't help for graphics, it could help for text.
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: Change the active video memory?
Try this. I use it in my ScribblePad, which I must blog sometime.
If you look around, there may be stuff with
I'll see if I can find the "tutorial" in the waybackmachine...
-----
I'm pretty sure you can get the offset of the display. (A "pointer" to it.) Then you use
You may wish to look at the large block comments in SCR_File_Lib; they explain exactly how the display memory is organised.
-----
Fun fact: Did you know there are two buffers? Popup memory and Display memory. You can switch between them "instantly", and read/write to either of them. Look around the API for popup memory, and you'll find it's inverse (display memory), too.
-----
Try this:
There's lots of different ways to do this (IIRC), so you should try them out and test 'em for speed before you decide upon the right one. And post your findings, 'cause I'm interested, too.
Here's a bunch of Display module IOMAP offsets. (There's one for each module!)
And you may also be interested in the Command Module Constants.
-----
To enlighten you, we do have "pseudo-pointers":
Check out this amazing example I just discovered.
Some of the memory/pointer stuff is hidden in the cstring API.
-----
What I was once looking for was a way to change the pointer to the display memory... if such a thing can exist.
If you look around, there may be stuff with
addr()
in it. Replace it with addressOf()
.I'll see if I can find the "tutorial" in the waybackmachine...
-----
I'm pretty sure you can get the offset of the display. (A "pointer" to it.) Then you use
IOMapWriteById()
or something.You may wish to look at the large block comments in SCR_File_Lib; they explain exactly how the display memory is organised.
-----
Fun fact: Did you know there are two buffers? Popup memory and Display memory. You can switch between them "instantly", and read/write to either of them. Look around the API for popup memory, and you'll find it's inverse (display memory), too.
-----
Try this:
Code: Select all
byte dat[];
ArrayInit(dat, 0x00, 8*100);
GetDisplayModuleBytes(DisplayOffsetNormal(0,0), 8*100, dat);
Here's a bunch of Display module IOMAP offsets. (There's one for each module!)
And you may also be interested in the Command Module Constants.
-----
To enlighten you, we do have "pseudo-pointers":
Check out this amazing example I just discovered.
Some of the memory/pointer stuff is hidden in the cstring API.
-----
What I was once looking for was a way to change the pointer to the display memory... if such a thing can exist.
Last edited by muntoo on 11 May 2011, 02:52, edited 1 time in total.
Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE
Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
Re: Change the active video memory?
Get used to it. Milliseconds is sort of a standard now.miningmarsh wrote:Stupid I, I always have to change my programs because I keep perceiving milliseconds as 1/100 of a second.
Maybe look around the "waybackmachine"?miningmarsh wrote:In fact a year ago, before nxtasy went down, I posted a similar request to this, except I asked about a specific function I believed could accomplish this (forgot the function, though).
Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE
Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
-
- Posts: 3
- Joined: 10 May 2011, 15:56
Re: Change the active video memory?
I was looking through the source and found the function I was looking for, SetDisplayDisplay. The documentation made it seem like this was the pointer to the video memory. Unfortunately, passing the address of an empty array of bytes had no effect (I had expected it to blank the screen if the video memory was properly rerouted).muntoo wrote:Try this. I use it in my ScribblePad, which I must blog sometime.
I was aware of this, however since there was no real support for the popup memory, and I did not feel like writing any libraries, I looked for other ways. I was also worried about the OS messing with the popup memory (such as using it for the low battery message).muntoo wrote:Fun fact: Did you know there are two buffers? Popup memory and Display memory. You can switch between them "instantly", and read/write to either of them. Look around the API for popup memory, and you'll find it's inverse (display memory), too.
This is what I am trying to do, and the biggest advantage I see of this is that by just editing a pointer to the display memory, we can use the regular display memory as one of the two buffers, meaning we will only use half the memory of using two different arrays. This is what I was hoping SetDisplayDisplay would do.muntoo wrote:What I was once looking for was a way to change the pointer to the display memory... if such a thing can exist.
This just crashes every time I run it.muntoo wrote: Try this:
There's lots of different ways to do this (IIRC), so you should try them out and test 'em for speed before you decide upon the right one. And post your findings, 'cause I'm interested, too.Code: Select all
byte dat[]; ArrayInit(dat, 0x00, 8*100); GetDisplayModuleBytes(DisplayOffsetNormal(0,0), 8*100, dat);
This is one of the single thing I wanted from nxc( type casting, and this). Thank you so much for sharing this.muntoo wrote:To enlighten you, we do have "pseudo-pointers":
Check out this amazing example I just discovered.
Some of the memory/pointer stuff is hidden in the cstring API.
Who is online
Users browsing this forum: Semrush [Bot] and 1 guest