Author Topic: Help: Screenshotting program ends up screensh*tting  (Read 7871 times)

0 Members and 1 Guest 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
Help: Screenshotting program ends up screensh*tting
« on: May 21, 2010, 02:11:51 am »
Ok so that french guy was asking how to make a program to store pics into programs, something that is impossible so far, but I decided to make an appvar version for now. However, I have problems. When I recall the pic, it's kinda glitchy. Some stuff shows fine, but other lines are garbage. I also got a crash once

Here's the code of my programs:

Code: [Select]
.SCRNSHOT
StoreGDB
"vPIC"->Str1
GetCalc(Str1)
GetCalc(Str1,768)
conj(L6,Str1,768)
DispGraph

Code: [Select]
.SCRNVIEW
"vPIC"->Str1
GetCalc(Str1)->M
If M
conj(Str1,L6,768)
DispGraph
End

Note: those two progs are launched from a TI-BASIC program so the graph screen is displayed prior launching them.

If anyone tries to debug this, please do not run on calc, or at least back up first, because my TI-Nspire froze once.

For french people, here's the original request: http://ourl.ca/4881/90891;topicseen#new
« Last Edit: May 21, 2010, 02:13:02 am by DJ Omnimaga »

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Help: Screenshotting program ends up screensh*tting
« Reply #1 on: May 21, 2010, 03:17:36 am »
Ok in the first program, remove the first getcalc, add a '->M' to the end of the second getCalc statement and change the Str1 on the line after into an M

should work :) I'm on my itouch so sorry if I messed up
« Last Edit: May 21, 2010, 03:18:33 am by Builderboy »

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Help: Screenshotting program ends up screensh*tting
« Reply #2 on: May 21, 2010, 03:35:59 am »
Yeah, Str1 is just a pointer to the name of the "vPIC" string it isn't the actual data.  You need to assign the getcalc result to a variable pointer (like M in builderboy's suggestion) becasue the appvars cannot be assigned static pointers like StrXX and PicXX since they move around a lot in ram and aren't in the same place every time you execute.
« Last Edit: May 21, 2010, 03:37:11 am by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

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: Help: Screenshotting program ends up screensh*tting
« Reply #3 on: May 21, 2010, 07:30:31 am »
Ooh wow I didn't knew variables were actually pointers. I thought they could only be like one byte lenght each. I didn't knew you could use -> at the end of the GetCalc(PTR,BYTES) command.

It still doesn't work, though. Now I changed what Builderboy told me to change and I got
Code: [Select]
.SCRNSHOT
StoreGDB
"vPIC"->Str1
GetCalc(Str1)
GetCalc(Str1,768)->M
conj(L6,M,768)
DispGraph
And it's even worse it seems, cuz it no longer actually manages to store even a single byte of the screen data. :/

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Help: Screenshotting program ends up screensh*tting
« Reply #4 on: May 21, 2010, 07:45:18 am »
I don't think you need the first "GetCalc" (did someone already say that?) and the "DispGraph" at the end seems superfluous, but it should work. Let me try...
Also, scrnview should have that last Str1 (the one in the conj( line) be M also.
As an afterthought, though I doubt this is your problem, just be aware that if there isn't enough free ram when you try to create vPIC, nothing will actually be created (since you are then proceeding to try to write to ROM, nothing bad will happen.)
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

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: Help: Screenshotting program ends up screensh*tting
« Reply #5 on: May 21, 2010, 06:55:36 pm »
didn't I need to use GetCalc(Str1) to point to the appvar name? Else IIRC it couldn't find the appvar

I definitively think someone needs to write a tutorial on how to use Getcalc. It is getting way too complicated and confusing

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Help: Screenshotting program ends up screensh*tting
« Reply #6 on: May 21, 2010, 10:16:54 pm »
no, calling GetCalc(Str1,768) creates vPIC it if it doesn't exist, deletes it and recreates it if it does, and then proceeds to return the pointer to the 768 bytes of data.
And yeah, variable management can be difficult. The "correct" way to create an appvar is a bit unwieldy, as this code that loads the value in an appvar demonstrates:
Code: [Select]
"vSCORE"->Str1
GetCalc(Str1)->X
.If it's non-zero, we're good, otherwise it's archived or non existent.
!If
    UnArchive Str1
    .If 0, it failed. Try to create the appvar
    !If
        GetCalc(Str1,2)
        .If it's 0, not enough RAM. Err and give up.
        !If
            "Not enough RAM"->Str2
            Disp Str2,i
            Return
        End
    End
    GetCalc(Str1)->X
    .This next If should never be reached
    !If
        "Serious Error"->Str3
        Disp Str3,i
        Return
    End
End
.X should now contain the pointer to the data. Phew!
Even w/o comments and indents, it still looks like this:
Code: [Select]
"vSCORE"->Str1
GetCalc(Str1)->X
!If
UnArchive Str1
!If
GetCalc(Str1,2)
!If
"Not enough RAM"->Str2
Disp Str2,i
Return
End
End
GetCalc(Str1)->X
!If
"Serious Error"->Str3
Disp Str3,i
Return
End
End
Oh, if an If has on condition following it, it's the condition on the previous line.
« Last Edit: May 21, 2010, 10:17:43 pm by calcdude84se »
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

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: Help: Screenshotting program ends up screensh*tting
« Reply #7 on: May 21, 2010, 10:24:03 pm »
Is !If with nothing after the equivalent of If not(Ans) in BASIC?

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Help: Screenshotting program ends up screensh*tting
« Reply #8 on: May 21, 2010, 10:25:58 pm »
pretty much. and "If" is about the equivalent of "If Ans"
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

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: Help: Screenshotting program ends up screensh*tting
« Reply #9 on: May 21, 2010, 10:31:55 pm »
ooh that's good to know. I did not even know Axe supported some sort of Ans style feature (where the last value is stored after doing something). I guess that's why stuff like 1->A->B->C->D can be done

EDIT: Well I give up, I tried what you all told me to do and to no avail.

I think making a program to store pictures to appvars in Axe is impossible. It just starts reading the appvar content from the wrong location and that stuff is too much for me anyway.

If anyone wants to attempt at writing such program, feel free to do so. Kindermoumoute would appreciate very well.

EDIT: Example of what happens wrong. Both myself and him tried and we got similar results:

The image being stored to the appvar


The image being recalled


In my case it was more off, though.
« Last Edit: May 22, 2010, 01:13:40 am by DJ Omnimaga »

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Help: Screenshotting program ends up screensh*tting
« Reply #10 on: May 22, 2010, 01:23:13 am »
I'm using minimal error testing, basically if there is a problem, the program will just exit.

Copy the drawing buffer to the appvar
Code: [Select]
"vPIC"->Str1
Return!If GetCalc(Str1,768)->A
conj(L6,A,768)

Or if you want the current LCD instead
Code: [Select]
"vPIC"->Str1
StoreGDB
Return!If GetCalc(Str1,768)->A
conj(L6,A,768)

Copy the appvar to the buffer and then to the screen
Code: [Select]
"vPIC"->Str1
Unarchive Str1
Return!If GetCalc(Str1)->A
conj(A,L6,768)
DispGraph

Or simply display it on the LCD directly
Code: [Select]
"vPIC"->Str1
Unarchive Str1
Return!If GetCalc(Str1)->A
A->DispGraph
___Axe_Parser___
Today the calculator, tomorrow the world!

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: Help: Screenshotting program ends up screensh*tting
« Reply #11 on: May 22, 2010, 01:31:42 am »
Code: [Select]
"vPIC"->Str1
StoreGDB
Return!If GetCalc(Str1,768)->A
conj(L6,A,768)
That gives an ERR:BAD SYMBOL error at 76%

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Help: Screenshotting program ends up screensh*tting
« Reply #12 on: May 22, 2010, 01:38:17 am »
You just found a new bug x.x  I'll fix it later, just do this for now, it does the same thing and seems to work:

Replace:
Code: [Select]
Return!If GetCalc(Str1,768)->A
With:
Code: [Select]
GetCalc(Str1,768)->A
Return!If
___Axe_Parser___
Today the calculator, tomorrow the world!

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: Help: Screenshotting program ends up screensh*tting
« Reply #13 on: May 22, 2010, 01:41:42 am »
Ok that works, but now Quigibo I think I found a second bug, and I fear this might be the source of all my problems. Hold on I'll try my original program on another calc model...

Offline kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: Help: Screenshotting program ends up screensh*tting
« Reply #14 on: May 22, 2010, 03:51:22 am »
This time there are two results, the first picture that displays whatever and another that displays a portion of the picture :/

The second picture uses "A => dispgraph" and third I do not know :/
Projects :

Worms armageddon z80 :
- smoothscrolling Pixelmapping : 100%
- Map editor : 80%
- Game System : 0%

Tutoriel français sur l'Axe Parser
- 1ère partie : en ligne.
- 2ème partie : en ligne.
- 3ème partie : en ligne.
- 4ème partie : 10%
- Annexe : 100%