Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Happybobjr on September 26, 2010, 06:13:13 pm

Title: Program request. Drawing of pictures.
Post by: Happybobjr on September 26, 2010, 06:13:13 pm
ok, this is kinda hard for me to say but,

Think of builderboy's auto optimization program.

Instead of optimizing programs, it would optimize picture variables.

For a simple example, lets say i wanted this in my game...
(http://img.removedfromgame.com/imgs/1285538863-wabbitemu.gif)

but i don't want the player to have to have the pic variable on their calc... what if their ram cleared or another game required the pic variable?
what if it was a simple picture that you shouldn't need to have 700 bytes or whatever taking up your calculators memory?

If you were to run a program like Builderboy's auto optimization program, except for a picture variable, it would out put a program ie. pic1-9 + pic0
such as this,  (http://img.removedfromgame.com/imgs/1285539137-wabbitemu.gif)

where you could copy it into your game.
(http://img.removedfromgame.com/imgs/1285539181-wabbitemu.gif)


would someone be willing to write a program to do this?
Title: Re: Program request. Drawing of pictures.
Post by: meishe91 on September 26, 2010, 06:27:45 pm
Well there are some I think. I think DJ said graphmastur had one that is an app. I recently just made one for MRide that takes a image and converts it into list compression for lines. I'll find it real quick.

Edit:
Here (http://ourl.ca/6935/120449) it is.

On another note, writing that program actually gave me the idea to create one that does something like you're saying. I might be able to do one.
Title: Re: Program request. Drawing of pictures.
Post by: Happybobjr on September 26, 2010, 06:46:51 pm
i'm confused, does that do it on calc?
Title: Re: Program request. Drawing of pictures.
Post by: meishe91 on September 26, 2010, 07:11:07 pm
What do you mean? Sorry, I'm confused by what you mean. It's a TI-BASIC program that takes part, or all, of the screen and converts it into line coordinates but in list compression format.
Title: Re: Program request. Drawing of pictures.
Post by: shmibs on September 26, 2010, 08:23:19 pm
i could write up one for you in axe
im already making something similar for unit 533D
so let me clarify:
you want a program that can take a picvar and convert it to a compressed file (i would be using appvars, if that's alright) and another program to inserted as a subroutine that can recall whichever of those pics you want(in this case it would do so using the following syntax:
[pic#]:asm([drawing prog])

would that work for you?
Title: Re: Program request. Drawing of pictures.
Post by: meishe91 on September 26, 2010, 08:31:18 pm
Well what I think he wants is a program that takes the graphscreen, or a picture variable, and puts into a new program or something  syntax that would make it as optimized as possible to just draw it manually in the program, if that makes sense.
Title: Re: Program request. Drawing of pictures.
Post by: Happybobjr on September 26, 2010, 09:22:30 pm
Well what I think he wants is a program that takes the graphscreen, or a picture variable, and puts into a new program or something  syntax that would make it as optimized as possible to just draw it manually in the program, if that makes sense.

ya i think thats what i'm saying ^

think about builderboy's auto optimization program.  It changes a ti-basic program.
What i was thinking was, a similar program but would write a ti-basic program that would draw the picture.

my first pic. shows the pic that i want to be converted into a ti-basic program
the 2nd would be the output as a ti-basic program
the 3rd would be how the output would look in an optimized format compared to the 700 bytes of a pic variable.
Title: Re: Program request. Drawing of pictures.
Post by: shmibs on September 26, 2010, 11:18:37 pm
so a program that can, by simply scanning that picture above, create another program containing the 5 minimal line commands necessary to draw it? that would be very difficult indeed...
Title: Re: Program request. Drawing of pictures.
Post by: nemo on September 26, 2010, 11:32:30 pm
i mean, i suppose it's possible. but it would be an insane program to write. the first part i think you'd have to do is scroll through every column to see if every pixel is black, and then tell the program to grab the token Vertical out of a large string, then do the same for rows... it would take an insanely long amount of time on a calculator. it would have to be an assembly or axe program, as basic would take millenia to complete. personally? i would make a computer program to brute-force it. something on-calc would be slower than if you just transferred the picture to the computer, ran a computer program on it, and then transferred the output back.
Title: Re: Program request. Drawing of pictures.
Post by: Builderboy on September 27, 2010, 01:03:49 am
I think it definitely be possible with Axe, although it would be tricky to get maximum optimization.  Especially if you want to include things such as diagonal lines.  But it could mix Horizonal and Vertical lines and Pixel Plotting commands to make a reasonable optimized program.
Title: Re: Program request. Drawing of pictures.
Post by: DJ Omnimaga on September 27, 2010, 01:52:53 am
Yeah I think that might be difficult indeed x.x. I worry that it might produce much larger file if using line-based pics than if you used either regular ones or used compression such as RLE.
Title: Re: Program request. Drawing of pictures.
Post by: Happybobjr on September 27, 2010, 10:35:26 am
It could simply do horizontal lines with the line command and plx_on( command for anything only one pixle
then the user could check if the outcome was more effecient or not.
That wouldn't be too difficult right?
Title: Re: Program request. Drawing of pictures.
Post by: Builderboy on September 27, 2010, 11:50:17 am
Well it would be easy to tell if it was effective enough, it would just display a message like "Warning, Pic size would be less" or something.  Since it does give different functionality though, some people might want to use it anyway
Title: Re: Program request. Drawing of pictures.
Post by: Happybobjr on September 27, 2010, 03:52:33 pm
so do you think you could easily and quickly make program like this?
Note:  xmin, xmax, ymin,........  make a difference on where the line goes. so that will need to be preset.


Note: this would be a bigger project but,  It might be cool to have a drawing program where you can choose circle and draw it your self on the screen, and turn that into ti-basic.

Question: In axe, can you store commands into a program or something like that? or would you have to do t in asm?
Title: Re: Program request. Drawing of pictures.
Post by: ztrumpet on September 27, 2010, 04:11:46 pm
Question: In axe, can you store commands into a program or something like that? or would you have to do t in asm?
It's possible with Asm, Axe, or Celtic III/DCS7. :)
Title: Re: Program request. Drawing of pictures.
Post by: Happybobjr on September 27, 2010, 04:14:08 pm
Question: In axe, can you store commands into a program or something like that? or would you have to do t in asm?
It's possible with Asm, Axe, or Celtic III/DCS7. :)

how would i do it with axe?
Title: Re: Program request. Drawing of pictures.
Post by: ztrumpet on September 27, 2010, 05:52:29 pm
With this:
Quote
GetCalc(PTR,SIZE)     Creates an OS variable who's name is pointed to in RAM and makes it Size bytes large. Returns a pointer to the start of data, or zero if there was not enough RAM. Overwrites existing variable, even if it was in archive.
Title: Re: Program request. Drawing of pictures.
Post by: Happybobjr on September 27, 2010, 06:16:45 pm
could someone plz make a quick axample program the will make a ti-basic program with

that when run, will output a program named
prgmABC
with this coding in it V

for(a,1,100
pause A
end


?
Title: Re: Program request. Drawing of pictures.
Post by: Builderboy on September 27, 2010, 06:33:03 pm
You can load programs just as you would load variables.  Try this code (its not tested but it should work)

Code: [Select]
.AXE
GetCalc("prgmA",14)->P
[D3412B312B3130303FD8413FD43F]->Str1
Copy(Str1,P,14)

What it does is create a program with 14 bytes of space, and stores the location of the program into P.  the second line contains all of the data for the program.  Each token is represented by a number, and all 14 numbers are loaded into the program with the last line.
Title: Re: Program request. Drawing of pictures.
Post by: Happybobjr on September 27, 2010, 07:13:14 pm
IT WORKED!  thank you very much.

thanks much. now i'll try to do something with this :D :D :D :D :D :D
This is amazing.
Title: Re: Program request. Drawing of pictures.
Post by: DJ Omnimaga on September 27, 2010, 07:21:12 pm
You can load programs just as you would load variables.  Try this code (its not tested but it should work)

Code: [Select]
.AXE
GetCalc("prgmA",14)->P
[D3412B312B3130303FD8413FD43F]->Str1
Copy(Str1,P,14)

What it does is create a program with 14 bytes of space, and stores the location of the program into P.  the second line contains all of the data for the program.  Each token is represented by a number, and all 14 numbers are loaded into the program with the last line.
I'M not sure what you mean. Do you mean this creates a TI-BASIC program (empty) called prgmP?
Title: Re: Program request. Drawing of pictures.
Post by: Happybobjr on September 27, 2010, 07:39:35 pm
You can load programs just as you would load variables.  Try this code (its not tested but it should work)

Code: [Select]
.AXE
GetCalc("prgmA",14)->P
[D3412B312B3130303FD8413FD43F]->Str1
Copy(Str1,P,14)

What it does is create a program with 14 bytes of space, and stores the location of the program into P.  the second line contains all of the data for the program.  Each token is represented by a number, and all 14 numbers are loaded into the program with the last line.
I'M not sure what you mean. Do you mean this creates a TI-BASIC program (empty) called prgmP?

no, it creates a TI-BASIC program prgmA
with

for(A,1,100
pause A
end

inside it
Title: Re: Program request. Drawing of pictures.
Post by: nemo on September 27, 2010, 07:59:44 pm
Code: [Select]
.F
[DD412B422B433F32438310B04208312BB03109BC420D703441432C0D]->GDB1
GetCalc("prgrmQUAD",28)->P
Copy(GDB1,P,28)

oh yes, it's our favorite program, being spawned from Axe (:
Title: Re: Program request. Drawing of pictures.
Post by: Happybobjr on September 27, 2010, 08:50:12 pm
ummm....  is this going to be a new meme?  where we have something like, never gonna give you up, in hex?
Title: Re: Program request. Drawing of pictures.
Post by: DJ Omnimaga on September 27, 2010, 10:49:51 pm
Oh I see. It's nice we can create BASIC programs with Axe now :D
Title: Re: Program request. Drawing of pictures.
Post by: Happybobjr on September 28, 2010, 07:12:35 am
ya,  remember my etch-a-sketch?  well i am going to make a drawing program (again) an 1st release is only going to have lines availible for drawing.  but iw will that the lines you draw and turn it into ti-basic.
Title: Re: Program request. Drawing of pictures.
Post by: Raylin on September 28, 2010, 08:41:17 am
Could someone toss me a link for tokens in hex? Thanks.
This is very interesting. :)
Title: Re: Program request. Drawing of pictures.
Post by: calc84maniac on September 28, 2010, 09:25:26 am
I think you can do tokens fairly easily like so:

Data(TDisp ,T",TH,TE,TL,TL,TO,T ,TW,TO,TR,TL,TD,T!

This only works for single-byte tokens, though. If you have a two-byte token, you can do the following for example:

Data(TDisp ,TStr1/256, TStr1
Title: Re: Program request. Drawing of pictures.
Post by: Raylin on September 28, 2010, 09:40:46 am
I meant the tokens in hex.
Isn't there a sheet of them somewhere like that?
Title: Re: Program request. Drawing of pictures.
Post by: Happybobjr on September 28, 2010, 10:15:24 am
ya there is...
http://tibasicdev.wikidot.com/tokens
Title: Re: Program request. Drawing of pictures.
Post by: Raylin on September 28, 2010, 11:46:54 am
Cool! :D
And is there a converter for this or do I need to make that on my own...?

EDIT: Never mind. C3 FTW.
Title: Re: Program request. Drawing of pictures.
Post by: DJ Omnimaga on September 28, 2010, 11:56:18 am
I think you can do tokens fairly easily like so:

Data(TDisp ,T",TH,TE,TL,TL,TO,T ,TW,TO,TR,TL,TD,T!

This only works for single-byte tokens, though. If you have a two-byte token, you can do the following for example:

Data(TDisp ,TStr1/256, TStr1
woah I didn't knew we could store data this way in Axe o.o

Darn that's great! We could almost create BASIC game makers or even enhanced versions of the RPG Starter kit, for example.
Title: Re: Program request. Drawing of pictures.
Post by: Raylin on September 28, 2010, 11:57:18 am
I can has new shell? :P
Title: Re: Program request. Drawing of pictures.
Post by: Happybobjr on September 28, 2010, 04:07:54 pm
i   am a little confused but ok...  who wants to work out the bugs in my code?  I just can't focus anymore on it.

Code: [Select]
.BA
GetCalc("prgmPIC1",700)->Z
[3004630A3E393404630B3E310463023E310463033E3004630C3E363304630D3F7E093F]->Str1
conj(Str1,Z,35
35->S
0->X->Y->A->N
Repeat N=1
Repeat getKey(9)
If getKey(15):1->N:End

If X<95 and getKey(3):X+1->X:Pause 30
End
If Y>0 and getKey(4):Y-1->Y:Pause 30
End
If X>0 and getKey(2):X-1->X:Pause 30
End
If Y<62 and getKey(1):Y+1->Y:Pause 30
End
DispGraph
End


Pxl-On(X,Y)
If A=0
conj([9C],Z+S,1):S+1->S
X->D:Y->E
95-D->I:62-E->J
End
If A=1
X->F:Y->G
95-F->K:62-G->L
Line(D,E,F,G)
End
For(M,1,2)
If M=1 and (A=0):I->H:End
If M=2 and (A=0):J->H:End
If M=1 and (A=1):K->H:End
If M=2 and (A=1):L->H:End
If H(less than or equal to)9:conj([30],Z+S,1):S+1->S:End
If H(less than or equal to)19 and (H(greater than or equal to)10):conj([31],Z+S,1):S+1->S:H-10->H:End
If H(less than or equal to)29 and (H(greater than or equal to)20):conj([32],Z+S,1):S+1->S:H-20->H:End
If H(less than or equal to)39 and (H(greater than or equal to)30):conj([33],Z+S,1):S+1->S:H-30->H:End
If H(less than or equal to)49 and (H(greater than or equal to)40):conj([34],Z+S,1:S+1->S:H-40->H:End
If H(less than or equal to)59 and (H(greater than or equal to)50):conj([35],Z+S,1:S+1->S:H-50->H:End
If H(less than or equal to)69 and (H(greater than or equal to)60):conj([36],Z+S,1:S+1->S:H-60->H:End
If H(less than or equal to)79 and (H(greater than or equal to)70):conj([37],Z+S,1):S+1->S:H-70->H:End
If H(less than or equal to)89 and (H(greater than or equal to)80):conj([38],Z+S,1):S+1->S:H-80->H:End
If H(less than or equal to)99 and (H(greater than or equal to)90):conj([39],Z+S,1):S+1->S:H-90->H:End

If H=0:conj([30],Z+S,1:End
If H=1:conj([31],Z+S,1:End
If H=2:conj([32],Z+S,1:End
If H=3:conj([33],Z+S,1:End
If H=4:conj([34],Z+S,1:End
If H=5:conj([35],Z+S,1:End
If H=6:conj([36],Z+S,1:End
If H=7:conj([37],Z+S,1:End
If H=8:conj([38],Z+S,1:End
If H=9:conj([39],Z+S,1:End
S+1->S
If A=0 or ((A=1) and (M=1))
conj([2B],Z+S,1):S+1->S:End
If A=1 and (M=2):conj([3F],Z+S,1):1+S->S:End
End
A+1->A
If A=2:0->A
End
End

It would be great if someone helped me fix this.
Title: Re: Program request. Drawing of pictures.
Post by: FinaleTI on September 28, 2010, 04:19:06 pm
I just skimmed over the code right now and you shouldn't be using Copy() for 1 byte.
Quigibo said so somewhere else...
Instead store the value directly to the address.
For example:
Instead of
conj([30],Z+S,1
use
E30→{Z+S}
Title: Re: Program request. Drawing of pictures.
Post by: Happybobjr on September 28, 2010, 04:23:44 pm
y not? what happens?  is that why i get a ton of ram clears?

EDIT:  I am confused by, E30→{Z+S}
Title: Re: Program request. Drawing of pictures.
Post by: FinaleTI on September 28, 2010, 04:26:08 pm
I'm not exactly sure what happens, but I remember reading that somewhere.
Title: Re: Program request. Drawing of pictures.
Post by: Happybobjr on September 28, 2010, 04:28:29 pm
i doubt it will work but i'll try.

EDIT: i stand corrected
Title: Re: Program request. Drawing of pictures.
Post by: FinaleTI on September 28, 2010, 04:32:30 pm
There might be other problems, but I just started to skim the code and noticed that.
Title: Re: Program request. Drawing of pictures.
Post by: DJ Omnimaga on September 28, 2010, 10:52:47 pm
I can has new shell? :P
That, and it would be awesome to list external levels for a specific game :)
Title: Re: Program request. Drawing of pictures.
Post by: Happybobjr on September 29, 2010, 03:56:06 pm
I can has new shell? :P
That, and it would be awesome to list external levels for a specific game :)

This confuses me ^
Title: Re: Program request. Drawing of pictures.
Post by: DJ Omnimaga on September 29, 2010, 04:00:18 pm
Think Super Mario 1.2, for example.
Title: Re: Program request. Drawing of pictures.
Post by: Happybobjr on September 29, 2010, 04:12:56 pm
still confused.  (never played it)
Title: Re: Program request. Drawing of pictures.
Post by: DJ Omnimaga on September 29, 2010, 11:05:50 pm
It has external level support and comes with a level editor. The level editor stores your levels in 8xp files. Such level editor would be possible with Axe I am sure.