Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: p2 on September 09, 2011, 11:03:22 am

Title: I need help with a code!
Post by: p2 on September 09, 2011, 11:03:22 am
I'm trying to code "TapTapRevenge" for TI84+
But I need to know how to write a few things in Axe:

---How to copy a text into the code of a progam?

---How to read numbers of the code of a program an save them as Vars?

---Is it possible to play a sound WHILE calculating things and displaying pictures (so that the program wont stop while playing the sound)



(maybe more questions will follow later)
Title: Re: I need help with a code!
Post by: Munchor on September 09, 2011, 11:06:34 am
This could have been asked in Q&A, but I'll still try to answer...

1) Where do you want to copy it from? I don't understand that question.
2) This (http://www.omnimaga.org/index.php?action=articles;sa=view;article=58) might be useful.
3) I don't think so, the last time I used sound, I couldn't have like background music, only little sounds now and then, but I haven't been keeping up with Axe a lot, so don't take my answer as a solution.
Title: Re: I need help with a code!
Post by: Ashbad on September 09, 2011, 11:23:34 am
3) practically no.  they're separate actions and can't be done simultaneously, unless you do it a certain way that isn't worth the time or space.  You could, but then the game would be very slow.  Though, what's so bad about rendering *then* playing?
Title: Re: I need help with a code!
Post by: JosJuice on September 09, 2011, 11:27:24 am
Playing sounds while calculating stuff is pretty much impossible if using Axe, and if you're using assembly, it will be incredibly hard and you probably won't get much done while playing sound.
Title: Re: I need help with a code!
Post by: p2 on September 09, 2011, 11:28:19 am
Thanx for the link, ephan!

I need:

1.     copying text from a string into a code

2.     sopying a var into a code (not "A", it should be the number that is saved as the var!)

3.     loading (reading) such a number from a code (like in 2.) and saving it as a var again



Is it possible to run two programs at the same time??
I don't thing so, or?





How is ththe thing working in the "MarkTheSuperkidQuest"-app?
I tried to load the appvar and wanted to watch it.
I haven't changed anything.

But the app told me that the App-var had been manipulated, and deleted it!

how hase the App noticed anything of what I made??
Title: Re: I need help with a code!
Post by: Munchor on September 09, 2011, 12:02:42 pm
p2, you can't double post in so short time. Use the Modify button or the Quick Modify button:

(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)

(http://www.omnimaga.org/Themes/omnimaga4/images/icons/modify_inline.gif)

Maybe you should reread the rules (http://www.omnimaga.org/index.php?action=ezportal;sa=page;p=22), in particular rule 4.

-------------------------

Is it possible to run two programs at the same time??
I don't thing so, or?
[/quote]

No, the 84+ doesn't have multithreading.

-------------------------

Now, concerning the rest of the questions, show us what you have coded so far, we are not going to make your program for you ;)

Also, if you haven't made anything and don't know where to start, be more specific in your questions, don't just tell us what you want to make, but also tell us what you have difficulties with.
Title: Re: I need help with a code!
Post by: AngelFish on September 09, 2011, 12:34:08 pm

---Is it possible to play a sound WHILE calculating things and displaying pictures (so that the program wont stop while playing the sound)

If you want to be technical, not on the calculators. They can only handle one thread. That means you can do one thing at a time and no more. On the other hand, you can "fake" simultaneity by using interrupts.
Title: Re: I need help with a code!
Post by: p2 on September 09, 2011, 12:49:52 pm
ephan, my problem is: I have no idea how to do tthat. I've tried very often in very much difficult ways, but never made it! (in all the cases!)
Querty.55, Hä??? How to do that???? I've never used "interrupts" before (or I have and don't know it)!

(http://img.removedfromgame.com/imgs/000002.gif)(http://img.removedfromgame.com/imgs/000003.gif)

The program is reacting on the keys [7], [8] and [9]
But I will change:

It should read a program like that:
Code: [Select]
:000
:000
:100
:200
:200
:011
:022
the three numbers should be like the three keys - but 0 is like not pressing the key, 1 is like pressing it once, 2 is like holding the key!



And I also need a second program, which should react on the keys, but writes it into such a code!



sorry, I know I'm making veeeery much mistakes and I'm sometimes really too stupid to code!  :-\

Spoiler For surcecode:
:.TAPTAP01
:Full
:
:
:
:Line(14,13,82,13)r
:Line(14,51,82,51)r
:
:
:Repeat getKey(15)
:DispGraphr
:getKey(36)→A
:getKey(28)→B
:getKey(20)→C
:
:
:
:
:Lbl 1
:If C
:32→E
:End
:If B
:18→E
:End
:If A
:4→E
:End
:
:
:If A+B+C≠0
:If pxl-Test(18,50-E) or pxl-Test(17,50-E)r or pxl-Test(16,50-E)r
:For(X,13,15
:Line(X,48-E,X,52-E,1
:Line(X,48-E,X,52-E)r
:End
:End
:!If pxl-Test(18,50-E
:!If pxl-Test(17,50-E)r
:Line(16,47-E,16,53-E
:Line(17,46-E,17,54-E
:Line(18,46-E,18,54-E
:Line(19,46-E,19,54-E
:Line(20,47-E,20,53-E
:End
:End
:
:
:DispGraphr
:
:
:If A
:0→A
:Goto 1
:End
:
:If B
:0→B
:Goto 1
:End
:
:If C
:0→C
:Goto 1
:End
:
:End
:
:
:
:
:For(X,1,9
:Line(X,1,X,63
:End
:
:
:For(X,1,63
:Pxl-Off(10,X
:End
:
:DispGraphr
:DispGraph
:Horizontal +r
:Horizontal +
:Pxl-Off(83,13)r
:Pxl-Off(83,51)r
:Pxl-On(14,13)r
:Pxl-On(14,51)r
:
:End


EDIT:
Sorry, was the ASM-program surce-code is coming...
Title: Re: I need help with a code!
Post by: Munchor on September 09, 2011, 01:18:03 pm
Querty.55, Hä??? How to do that???? I've never used "interrupts" before (or I have and don't know it)!

I recommend you read this (http://ourl.ca/11099) (the attached file), it's very good!
Title: Re: I need help with a code!
Post by: p2 on September 09, 2011, 01:58:29 pm
Thanx, Querty!

But may someone please tell me, if there's a bug in my code?
Title: Re: I need help with a code!
Post by: Munchor on September 09, 2011, 03:40:50 pm
Code: [Select]
.Change "NAME" to the name of your program
"prgmNAME"→Str1
Unarchive Str1
GetCalc(Str1)→H

So change "NAME" in "prgmNAME" to the name of your program, and make sure it exists.

After running that code, the code of the prgmNAME will be in variable H. And then you can access it byte by byte like:


Save first byte in variable A and the second byte in variable B:
Code: [Select]
{H}→A
{H+1}→B

I think this it how it works :)
Title: Re: I need help with a code!
Post by: LincolnB on September 09, 2011, 05:26:29 pm
If you're interested in sound and stuff, look around for Quigibo's Axe to Midi converter. I think it came with a set of subroutines/interrupts that allowed you to play the game while listening...
Title: Re: I need help with a code!
Post by: p2 on September 10, 2011, 04:26:49 am
Thanx, Ephan!!!! Can I also write a number from 1-7 into every line of the program and load them then??
For example, how to load the number in line number eight?
How can I tell the program to write a number in a new line?

And a second question:
I have such a code:
Code: [Select]
:001
:102
:202
:202
:210
How can I load the X-th number  in line Y??




Buttsfredkin, I thought it was a midi-to-axe-converter     ;)
Can you please post an example-code for me (I can learn it easier if I can exit a complete code with the new part in it)
I was planning g to use that converter, but don't really know how I must write that!
Title: Re: I need help with a code!
Post by: Munchor on September 10, 2011, 06:16:45 am
How can I tell the program to write a number in a new line?

And a second question:
I have such a code:
Code: [Select]
:001
:102
:202
:202
:210
How can I load the X-th number  in line Y??

I think this is how you do it:

1. You save the original file in a variable, let's say H.
Code: [Select]
.Change "NAME" to the name of your program
"prgmNAME"→Str1
Unarchive Str1
GetCalc(Str1)→H

2. If every line has 3 numbers, then each line has 3 bytes, so you do like this:

Line 1: Byte $0, $1 and $2
Line 2: Byte $3, $4, and $5
Line 3, Byte $6, $7, and $8
Line 4, Byte $9, $A, and $B

Then it's easy. You make a loop that loops all lines. Thus, you can access each of the 3 bytes in each line, to get the first, the second and the third number and save it into a variable ;)
Title: Re: I need help with a code!
Post by: p2 on September 10, 2011, 08:43:02 am
so I cant write {Str1+18}???
(Str1 because your older post...)
Title: Re: I need help with a code!
Post by: Munchor on September 10, 2011, 08:47:40 am
so I cant write {Str1+18}???
(Str1 because your older post...)

Yes you can, that's the way to do it ;)
Title: Re: I need help with a code!
Post by: p2 on September 10, 2011, 09:38:28 am
Tried it, but It's ignoring me!!!
It's showing random "tappers" on the screen, not like I've told it in the code!!
Title: Re: I need help with a code!
Post by: LincolnB on September 10, 2011, 04:50:10 pm
Buttsfredkin, I thought it was a midi-to-axe-converter     ;)
Can you please post an example-code for me (I can learn it easier if I can exit a complete code with the new part in it)
I was planning g to use that converter, but don't really know how I must write that!

haha my bad. :)


I think the thread here http://ourl.ca/6263/102339 has some example code you can download.
Title: Re: I need help with a code!
Post by: saintrunner on October 30, 2011, 01:02:16 pm
tap tap revenge???? really...1st question ...why???? its a calculator...if anything make a game not involving music or sound...2nd question.....do u realy feel comfortable wearing head fones plugged into ur calc??
Title: Re: I need help with a code!
Post by: BlakPilar on October 30, 2011, 01:06:34 pm
Why not make a game with sound? It's entirely possible. And why not put headphones into a calculator?
Title: Re: I need help with a code!
Post by: mrmprog on October 30, 2011, 01:07:33 pm
tap tap revenge???? really...1st question ...why???? its a calculator...if anything make a game not involving music or sound...2nd question.....do u realy feel comfortable wearing head fones plugged into ur calc??
Well, it is his game. And yes, if the game needs it, I would use headphones.
By the way, if you haven't already, you should introduce yourself. (http://www.omnimaga.org/index.php?board=10.0)
Title: Re: I need help with a code!
Post by: Hayleia on October 30, 2011, 01:08:26 pm
tap tap revenge???? really...1st question ...why???? its a calculator...if anything make a game not involving music or sound...2nd question.....do u realy feel comfortable wearing head fones plugged into ur calc??
I didn't give you a -1 because you already had one four, but:
First of all, it is against the rules to discourage people from doing their projects (I had a -1 for that in the past).
Secondly, you are a bit hard to read.
Thirdly, "calculators were never meant for just maths" :P
Else, what do you think the CX and the Prizm have colors for ?

EDIT: I was severely ninja'd O.O
Title: Re: I need help with a code!
Post by: Xeda112358 on October 30, 2011, 01:11:45 pm
[rant]
It is usually advised not to post such negative remarks. We are hobbyists here so we code for enjoyment and often for others and it is all for free. We like to experiment with the limits of the calculator and we have pushed the limitations of these much outdated devices because of doing things like this. Could you believe that a calculator could be used to chat via the internet? Or how about having a wifi connection? Or listen to the radio?

Do you understand the consequences of this? What do you think happens when we move on to more up to date devices? We have the experience and drive to get all that we can out of our devices. We don't waste resources here. Can you imagine just how wasteful other programmers are? Have you ever opened up a piece of software and been able to cringe because most people code the easy way, not the most effective way?

So please, before you want to treat somebody like crap, think of the consequences of what they are doing and avoid looking at things on the superficial level.

[/rant]
Title: Re: I need help with a code!
Post by: saintrunner on October 30, 2011, 01:25:27 pm
my apologizes
Title: Re: I need help with a code!
Post by: Hayleia on November 02, 2011, 02:27:57 am
http://ourl.ca/8355/153971
This would help for a Tap Tap game ;)

Btw, Xeda, I bookmarked your post :P
Title: Re: I need help with a code!
Post by: p2 on November 02, 2011, 04:26:53 am
ephan, my problem is: I have no idea how to do tthat. I've tried very often in very much difficult ways, but never made it! (in all the cases!)
Querty.55, Hä??? How to do that???? I've never used "interrupts" before (or I have and don't know it)!

(http://img.removedfromgame.com/imgs/000002.gif)(http://img.removedfromgame.com/imgs/000003.gif)

The program is reacting on the keys [7], [8] and [9]
But I will change:

It should read a program like that:
Code: [Select]
:000
:000
:100
:200
:200
:011
:022
the three numbers should be like the three keys - but 0 is like not pressing the key, 1 is like pressing it once, 2 is like holding the key!



And I also need a second program, which should react on the keys, but writes it into such a code!



sorry, I know I'm making veeeery much mistakes and I'm sometimes really too stupid to code!  :-\

Spoiler For surcecode:
:.TAPTAP01
:Full
:
:
:
:Line(14,13,82,13)r
:Line(14,51,82,51)r
:
:
:Repeat getKey(15)
:DispGraphr
:getKey(36)→A
:getKey(28)→B
:getKey(20)→C
:
:
:
:
:Lbl 1
:If C
:32→E
:End
:If B
:18→E
:End
:If A
:4→E
:End
:
:
:If A+B+C≠0
:If pxl-Test(18,50-E) or pxl-Test(17,50-E)r or pxl-Test(16,50-E)r
:For(X,13,15
:Line(X,48-E,X,52-E,1
:Line(X,48-E,X,52-E)r
:End
:End
:!If pxl-Test(18,50-E
:!If pxl-Test(17,50-E)r
:Line(16,47-E,16,53-E
:Line(17,46-E,17,54-E
:Line(18,46-E,18,54-E
:Line(19,46-E,19,54-E
:Line(20,47-E,20,53-E
:End
:End
:
:
:DispGraphr
:
:
:If A
:0→A
:Goto 1
:End
:
:If B
:0→B
:Goto 1
:End
:
:If C
:0→C
:Goto 1
:End
:
:End
:
:
:
:
:For(X,1,9
:Line(X,1,X,63
:End
:
:
:For(X,1,63
:Pxl-Off(10,X
:End
:
:DispGraphr
:DispGraph
:Horizontal +r
:Horizontal +
:Pxl-Off(83,13)r
:Pxl-Off(83,51)r
:Pxl-On(14,13)r
:Pxl-On(14,51)r
:
:End


EDIT:
Sorry, was the ASM-program surce-code is coming...



I already changed a lot of things in it.

Spoiler For PROGRAM:TAP00003:
.TAPTAP003
ClrDraw
ClrDrawr
Full

"prgmTapTI001"->Str1
UnArchieve Str1
If GetCalc(Str1)=0
"RAMprgmTapTapTIprgmFil"->Str2
"esprgmExternalFiles"->Str3
"prgmTrackPack1prgmNonE"->Str4
"execprgmprgmTapTI001"->Str5
"ERR: MissingFile"->Str6
"Press ENTER"->Str7
Output(0,0,Str2
Output(0,1,Str3
Output(0,2,Str4
Output(0,3,Str5
Fix 3
Output(0,4,Str6
Fix 2
Output(2,6,Str7
getKeyr
Goto ZZ
End

GetCalc(Str1)->H

length(H)->Z
getkeyr

28->T
Repeat getKey(15)

If T=Z
Goto ZZ
End

T+1->T
DispGraphr

.001
If {H+T}={H+1} or ({H+T}={H+4}) or ({H+T}={H+7}) or ({H+T}={H+10}) or ({H+T}={H+13}) or ({H+T}={H+16}) or ({H+T}={H+19}) or ({H+T}={H+22}) or ({H+T}={H+25})
Line(16,15,16,21)r
Line(17,14,17,22)r
Line(18,14,18,22)r
Line(19,14,19,22)r
Line(20,15,20,21)r
End

.002
If {H+T}={H+2} or ({H+T}={H+5}) or ({H+T}={H+8}) or ({H+T}={H+11}) or ({H+T}={H+14}) or ({H+T}={H+17}) or ({H+T}={H+20}) or ({H+T}={H+23}) or ({H+T}={H+26})
Line(13,26,13,20)r
End

.010
If {H+T}={H+3} or ({H+T}={H+4}) or ({H+T}={H+5}) or ({H+T}={H+12}) or ({H+T}={H+13}) or ({H+T}={H+14}) or ({H+T}={H+21}) or ({H+T}={H+22}) or ({H+T}={H+23})
Line(16,29,16,35)r
Line(17,28,17,34)r
Line(18,28,18,34)r
Line(19,28,19,34)r
Line(20,29,20,35)r
End

.020
If {H+T}={H+6} or ({H+T}={H+7}) or ({H+T}={H+8}) or ({H+T}={H+15}) or ({H+T}={H+16}) or ({H+T}={H+17}) or ({H+T}={H+24}) or ({H+T}={H+25}) or ({H+T}={H+26})
Line(13,30,13,34)r
End

.100
If {H+T}={H+9} or ({H+T}={H+10}) or ({H+T}={H+11}) or ({H+T}={H+12}) or ({H+T}={H+13}) or ({H+T}={H+14}) or ({H+T}={H+15}) or ({H+T}={H+16}) or ({H+T}={H+17})
Line(16,43,16,49)r
Line(17,42,17,50)r
Line(18,42,18,50)r
Line(19,42,19,50)r
Line(20,43,20,49)r
End

.200
If {H+T}={H+18} or ({H+T}={H+19}) or ({H+T}={H+20}) or ({H+T}={H+21}) or ({H+T}={H+22}) or ({H+T}={H+23}) or ({H+T}={H+24}) or ({H+T}={H+25}) or ({H+T}={H+26})
Line(13,44,13,48)r
End

DispGraphr
DispGraph
Horizontal+r
Horizontal+
End
Lbl ZZ
ClrDraw
ClrDrawr
There may be a few mistakes in that code - I had to type it on the computer because I'm having problems with the linking softwares!
And I also know that there are a few mistakes in the code!
I'll soon post how the TapTI001-program is looking like - I can't find the code for it now