Author Topic: How do I store multiple pics into single appvar?  (Read 5834 times)

0 Members and 1 Guest are viewing this topic.

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
How do I store multiple pics into single appvar?
« on: September 19, 2011, 07:42:28 am »
It's kinda not nice too see too much appvar in my calc :P (Scroll lag)
Is there a way?
Sig wipe!

Offline LincolnB

  • Check It Out Now
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1115
  • Rating: +125/-4
  • By Hackers For Hackers
    • View Profile
Re: How do I store multiple pics into single appvar?
« Reply #1 on: September 19, 2011, 09:59:18 am »
Your pictures take up 768 bytes, right? Why not store all your pics consecutively, so having a 768 byte appvar for one pic, a 1536 for two pics, etc. If you have, say, 35 pics to store, you'd need an appvar that's 26,880 bytes, and obviously it'd need to be in the user archive. If you have it loaded in Y1, you could load the first pic into a RAM location (say, GDB1) like so: Copy(Y1,GDB1,768) . You could then load, say the twenty-seventh picture like so: Copy(26*768+Y1,GDB1,768) . The pseudo code for this would be something like:
Copy(number_of_pic_to_load_counting_from_zero * 768 + Y1, RAM_location_to_load_to, 768)
Completed Projects:
   >> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
   >> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.


Spoiler For Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)



Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: How do I store multiple pics into single appvar?
« Reply #2 on: September 19, 2011, 12:33:03 pm »
Your pictures take up 768 bytes, right? Why not store all your pics consecutively, so having a 768 byte appvar for one pic, a 1536 for two pics, etc. If you have, say, 35 pics to store, you'd need an appvar that's 26,880 bytes, and obviously it'd need to be in the user archive. If you have it loaded in Y1, you could load the first pic into a RAM location (say, GDB1) like so: Copy(Y1,GDB1,768) . You could then load, say the twenty-seventh picture like so: Copy(26*768+Y1,GDB1,768) . The pseudo code for this would be something like:
Copy(number_of_pic_to_load_counting_from_zero * 768 + Y1, RAM_location_to_load_to, 768)
OK thnkx XD
It'll be helpful for making a second one.
EDIT: OK. So how do I store it?
« Last Edit: September 19, 2011, 12:41:17 pm by yeongJIN_COOL »
Sig wipe!

Offline Fast Crash

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 192
  • Rating: +45/-7
  • Virus of tomorrow
    • View Profile
Re: How do I store multiple pics into single appvar?
« Reply #3 on: September 19, 2011, 01:14:59 pm »
Your pictures take up 768 bytes, right? Why not store all your pics consecutively, so having a 768 byte appvar for one pic, a 1536 for two pics, etc. If you have, say, 35 pics to store, you'd need an appvar that's 26,880 bytes, and obviously it'd need to be in the user archive. If you have it loaded in Y1, you could load the first pic into a RAM location (say, GDB1) like so: Copy(Y1,GDB1,768) . You could then load, say the twenty-seventh picture like so: Copy(26*768+Y1,GDB1,768) . The pseudo code for this would be something like:
Copy(number_of_pic_to_load_counting_from_zero * 768 + Y1, RAM_location_to_load_to, 768)
OK thnkx XD
It'll be helpful for making a second one.
EDIT: OK. So how do I store it?

Just like you read it. You'll have to draw your pictures (on the buffer, aka L6) and copy them step by step in an appvar created for this (with the correct size) with 768 bytes steps. Like Copy(L6,APPVAR+1536,768).

Offline LincolnB

  • Check It Out Now
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1115
  • Rating: +125/-4
  • By Hackers For Hackers
    • View Profile
Re: How do I store multiple pics into single appvar?
« Reply #4 on: September 19, 2011, 11:09:39 pm »
keep in mind that when you create appvars, the appvars need to be in RAM. You can't write to the archive in Axe (well, not yet ;) )
Completed Projects:
   >> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
   >> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.


Spoiler For Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)



Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: How do I store multiple pics into single appvar?
« Reply #5 on: September 19, 2011, 11:11:23 pm »
I suppose you could use the bcalls that archive and unarchive variables in hex. That shouldn't be too horrible.

Or you could write an axiom and use that with UnArchive/Archive for the tokens :P

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: How do I store multiple pics into single appvar?
« Reply #6 on: September 20, 2011, 09:28:52 am »
OK so I tried and failed. Is something wrong here?
Code: (main) [Select]
:.θCUR // Main File
:[80003C383C2E0400→Pic1
:[8078844222413A04
:[801C3E7E7D3A3408
:[B80C8C98FC6E0703
:[90381C2E170E1C08
:GetCalc("varA")→P
:GetCalc("varB")→Q
:GetCalc("varC")→R
:GetCalc("varD")→S
:GetCalc("varF")→U
:GetCalc("uZ")→Y
:float{P}→A
:float{Q}→B
:float{R}→C
:float{S}→D
:float{U}→F
:float{Y}→Z
:0→E
:prgmAAAAA
:Repeat getKey(54)
:ClrDraw
:"PROBLEM HERE?"
:Copy(Z*768+Y1,L6,768)
:Pt-Change(A,B,Pic1+E)
:If getKey(48) and (F=1)
:32→E
:4→C
:End
:If getKey(35)
:24→E
:3→C
:End
:If getKey(18)
:16→E
:2→C
:End
:If getKey(26)
:8→E
:1→C
:End
:If getKey(34)
:0→E
:0→C
:End
:If getKey(32)
:8→C
:End
:If getKey(56)
:7→C
:End
:If getKey(2)
:A-1→A
:End
:If getKey(3)
:A+1→A
:End
:If getKey(4)
:B-1→B
:End
:If getKey(1)
:B+1→B
:End
:If A>95
:95→A
:End
:If A<1
:1→A
:End
:If B<1
:1→B
:End
:If B>63
:63→B
:End
:If getKey(55)
:9→C
:End
:DispGraph
:End
:A→float{P}
:B→float{Q}
:C→float{R}

Code: (storing appvar) [Select]
:.A //Storing appvar
:[Pic1]→Str1
:[Pic2]→Str2
:GetCalc("appvS201",1536)→A
:Copy(Str1,A,768)
:Copy(Str2,A+768,768


Code: (accessing appvar) [Select]
:..BB // Accessing appvar
:"appvS200"→Str0
:D^10*256+(D/10)+E3030→{Str0+2}r
:GetCalc(Str0,Y1)
Sig wipe!

Offline LincolnB

  • Check It Out Now
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1115
  • Rating: +125/-4
  • By Hackers For Hackers
    • View Profile
Re: How do I store multiple pics into single appvar?
« Reply #7 on: September 20, 2011, 05:34:45 pm »
Suppose you have three appvars. Each of these is 768 bytes in size. One is called "AppVarOne" (yeah, I know it's too long of a name. whatever :) ). Another is "AppVarTwo" and the third is "AppVarThree". You want to combine them into a 2304 byte appvar that you're going to call "Really_Big_AppVar". I would use the following code: (keep in mind that this code has no user interface, it just does it's thing). Oh, and AppVarOne, AppVarTwo, and AppVarThree are all in the archive.

Code: [Select]
.MAKE Make big appvars out of little ones

.load the smaller appvars, the 768 byte ones
.make sure these are in the archive, or this won't work
GetCalc("appvAppVarOne",Y1)
GetCalc("appvAppVarTwo",Y2)
GetCalc("appvAppVarThree",Y3)

.make a new, bigger appvar (make sure this appvar doesn't already exist. if it does, delete it.)
GetCalc("appvReally_Big_Appvar",2304)->W
.let's store the pointer to Really_Big_Appvar in variable W
.and make Really_Big_Appvar 2304 bytes in size.

.Now start copying the small appvars into the big one.
Copy(Y1,W,768)
Copy(Y2,W+768,768)
Copy(Y3,W+1536,768)

.archive Really_Big_Archive (optional) and you're all done!
Archive "appvReally_Big_Archive"


Ta-da! Let me know if that doesn't make any sense. :)
Completed Projects:
   >> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
   >> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.


Spoiler For Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)



Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: How do I store multiple pics into single appvar?
« Reply #8 on: September 20, 2011, 08:28:16 pm »
Thank you although I already found out the problem :D
Oh I never knew that you could just "Archive" the appvars that way XP
Sig wipe!