Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: FinaleTI on October 03, 2010, 07:05:27 pm

Title: Why is this failing?
Post by: FinaleTI on October 03, 2010, 07:05:27 pm
I've been working on Pokemon TI a lot recently, but in my current build of the map engine the music no longer works.
I just can't seem to figure out why it doesn't work.

Here's the code for the engine:
Code: [Select]
:.A66
:[00FFD0FF50FFD0FF000000000000000000FFFFFF00FFFFFF00FF0BFF0AFF0BFF50FFD0FF00FFFFFF0AFF0BFF00FFFFFF3F407F8080FFFFE1→Pic1
:[FF7F787FF87F787F8040201028448201FF000000FF000000FFFE0EFE0FFE0EFEF87F787FFF0000000FFE0EFEFF0000003F5F7FBFBF80BFBE→Pic2
:[030F1F3F7F3F7F3FC0F0F8FCFEFCFEFC3F3F3F3F3F1F0F06FCFCFCFCFCF8F060030F1F3F7F3F7F3FC0F0F8FCFEFCFEFC3F3F3F1F0F0F0703FCFEFEFEFCF8F000030F1F3F7F3F7F3FC0F0F8FCFEFCFEFC3F7F7F7F3F1F0F00FCFCFCF8F0F0E0C0030F1F3F7F3F7F3FC0F0F8FCFEFCFEFC7F7F3F1F3F1F0F06FCF8F8F8F0E0C000030F1F3F7F3F7F3FC0F0F8FCFEFCFEFC3F1F1F1F0F070300FEFEFCF8FCF8F060030F1F3F3F1F1F1FC0F0F8FCFEFEFEFC1F0F070307030301FCFCFCFCF8F0E0C0030F1F3F3F1F1F1FC0F0F8FCFEFEFEFC1F0F0703070F0703FEFEFEFEFCFCF830030F1F3F7F7F7F3FC0F0F8FCFCF8F8F83F3F3F3F1F0F0703F8F0E0C0E0C0C080030F1F3F7F7F7F3FC0F0F8FCFCF8F8F87F7F7F7F3F3F1F0CF8F0E0C0E0F0E0C0→Pic3G
:[030F1C337F3D7022C0F038CCFE5C0E4432393F372F1F09064C9CFCECF4F89060030F1C337F3A7022C0F038CCFEBC0E4432393F170F0F04034C9EEECE9CF8F000030F1C337F3D7022C0F038CCFE5C0E4432797773391F0F004C9CFCE8F0F020C0030F1C386B3F6F3FC0F0381CD6FCF6FC3F3F3F3F2F1F0906FCFCFCFCF4F89060030F1C386B3F6F3FC0F0381CD6FCF6FC7F7F3F1F2F1F0906FCF8F8E8D0E0C000030F1C386B3F6F3FC0F0381CD6FCF6FC3F1F1F170B070300FEFEFCF8F4F89060030F1F3F37111515C0F0188CFEFE4AFC110C070307020301FCFCFC7C78F020C0030F1F3F37111515C0F0188CFEFE4AFC110C0703040F0603FEFEFE7EFCECD830030F18317F7F523FC0F0F8FCEC88A8A83F3F3F3E1E0F04038830E0C0E040C080030F18317F7F523FC0F0F8FCEC88A8A87F7F7F7E3F371B0C8830E0C020F060C0→Pic1G
:[030C102040205022C030080402040A44322827342B1009064C14E42CD4089060030C102040205022C030080402040A44322827140B0804034C12E20A9408F000030C102040205022C030080402040A443248475029100F004C14E428D01020C0030C102040204020C0300804020402042020302C2314090604040C34C4289060030C102040204020C0300804020402044040201827180906041828489060C000030C102040204020C030080402040204201814120906030002020418E4189060030C102020101415C03008040A064244110807020402020144848444781020C0030C102020101415C03008040A06424411080702040B040342828242BC24C830030C102050604222C0300804040828A8222121221E0804038810E04020404080030C102050604222C0300804040828A8424141423D24130C8810E04020D020C0→Pic2G
:DeltaList(0,1,0,2,0,3,4,3,5,3,6,7,6,8,9,8)→GDB1
:DeltaList(0,1,0,2,0,0,3,0,4,0,5,6,5,7,8,7)→GDB2
:Lbl DG
:DispGraphrr
:GetCalc("Str1")→Q
:16→{L1}
:16→{L1+1}
:ClrDraw
:ClrDrawr
:Full
:GetCalc("vMDATA")→L→S
:0→Y→E→F+1→K→T
:FnInt(GT,0)
:Full
:Goto MP
:
:Lbl RND
:Full
:For(θ,0,7
:Full
:FnOff
:For(B,0,11
:θ+E*{L1}+B+F→Y
:Pt-Off(B*8,θ*8,{Q+Y}*8+Pic1
:Pt-Off(B*8,θ*8,{Q+Y}*8+Pic2)r
:Pt-Off(B*8,θ+1*8,{θ+1+E*{L1}+B+F+Q}*8+Pic1
:Pt-Off(B*8,θ+1*8,{θ+1+E*{L1}+B+F+Q}*8+Pic2)r
:For(Y,0,1
:If ((B+F)≥({L1+1})) or ((θ+E)≥({L1}-Y
:If ((B+F)≥({L1+1})) or ((θ+E+1)≥({L1}-Y
:Pt-On(B*8,θ+1*8,[FFFFFFFFFFFFFFFF]
:Pt-On(B*8,θ+1*8,[FFFFFFFFFFFFFFFF])r
:End
:Pt-On(B*8,θ*8,[FFFFFFFFFFFFFFFF]
:Pt-On(B*8,θ*8,[FFFFFFFFFFFFFFFF])r
:End
:End
:End
:θ+1→θ
:{H+J+GDB2}*32→N
:Pt-On(32,28,N+Pic3G
:Pt-On(40,28,N+8+Pic3G
:Pt-On(32,36,N+16+Pic3G
:Pt-On(40,36,N+24+Pic3G
:Pt-Change(32,28,N+Pic3G
:Pt-Change(40,28,N+8+Pic3G
:Pt-Change(32,36,N+16+Pic3G
:Pt-Change(40,36,N+24+Pic3G
:Pt-On(32,28,Pic1G+G
:Pt-On(40,28,Pic1G+8+G
:Pt-On(32,36,Pic1G+16+G
:Pt-On(40,36,Pic1G+24+G
:Pt-On(32,28,N+Pic3G)r
:Pt-On(40,28,N+8+Pic3G)r
:Pt-On(32,36,N+16+Pic3G)r
:Pt-On(40,36,N+24+Pic3G)r
:Pt-Change(32,28,N+Pic3G)r
:Pt-Change(40,28,N+8+Pic3G)r
:Pt-Change(32,36,N+16+Pic3G)r
:Pt-Change(40,36,N+24+Pic3G)r
:Pt-On(32,28,Pic2G+G)r
:Pt-On(40,28,Pic2G+8+G)r
:Pt-On(32,36,Pic2G+16+G)r
:Pt-On(40,36,Pic2G+24+G)r
:FnOn
:End
:K-1→K
:Return
:
:Lbl MP
:0→T→G→H→J+1→K
:sub(RND)
:Repeat getKey(15)
:If getKey(1) and (K=0
:E→T
:If H≥4
:0→H
:End
:For(J,0,2
:3-J→K
:{H+J+GDB1}*32→G
:sub(RND)
:E+1→E
:For(θ,0,649
:End
:End
:T+2→E
:!If H
:2→H
:Else
:0→H
:End
:End
:If getKey(4) and (K=0
:E→T
:If (H≠5) and (H≠7
:5→H
:End
:For(J,0,2
:3-J→K
:{H+J+GDB1}*32→G
:sub(RND)
:E-1→E
:For(θ,0,649
:End
:End
:T-2→E
:If H=5
:7→H
:Else
:5→H
:End
:End
:If getKey(2) and (K=0
:F→T
:If H≠10
:10→H
:End
:For(J,0,2
:3-J→K
:{H+J+GDB1}*32→G
:sub(RND)
:F-1→F
:For(θ,0,649
:End
:End
:10→H
:T-2→F
:End
:If getKey(3) and (K=0
:F→T
:If H≠13
:13→H
:End
:For(J,0,2
:3-J→K
:{H+J+GDB1}*32→G
:sub(RND)
:F+1→F
:For(θ,0,649
:End
:End
:13→H
:T+2→F
:End
:End
:LnReg
:Return
:
:Lbl GT
:.T+1→T
:.Q+1→Q
:.If T=2
:.0→T
:Normal
:DispGraphrr
:Full
:.End
:sub(MI)
:Return
:
:.MUSIC PLAYER
:[0020341E821CE91A6619F917A1165C1529140713F611F41000101A0F410E740DB30CFD0B500BAE0A140A8309FB087A0800088D072107BA065906FE05A80557050A05C2047D043D040004C70390035D032D03FF02D402AB02850261023F021E020002E301C801AF01960180016A015601430130011F010F010001F200E400D700CB00C000B500AB00A1009800900088008000790072006C00660060005B00550051004C004800440040003C0039003600330030002D002B00280026002400220020001E001D001B001900180017001500140013001200110010000F000E000D000D000C000B000B000A000A00090008000800080007000700060006000600]→Str9N
:Lbl MI
:Return!If GetCalc("vMDATA")
:!If L
:+1→C
:Return
:End
:ReturnIf C-1→C
:Lbl I2
:If {L+1}
:SinReg{{L}+Str9N}r,1900)
:If {L+2→L-1}→C=1
:Goto I2
:End
:Else
:S→L:90→C
:End
:Return
Title: Re: Why is this failing?
Post by: calc84maniac on October 03, 2010, 07:45:49 pm
I don't think you're going to want to put a GetCalc() in your music routine. That can take a significant amount of time, especially if there are a lot of files on your calc. And I think the problem could be that you are not initializing the C variable, so there is a very large random delay before the music will even start.
Title: Re: Why is this failing?
Post by: FinaleTI on October 03, 2010, 08:20:21 pm
I initialized C to 1 and removed the GetCalc() in the player, yet it still doesn't work...
Title: Re: Why is this failing?
Post by: Runer112 on October 03, 2010, 08:55:13 pm
How does it fail? And do you have a version of the code from before the music stopped working?
Title: Re: Why is this failing?
Post by: FinaleTI on October 03, 2010, 08:57:50 pm
The music doesn't play at all.
Here's an old version of the code that should work:
Code: [Select]
:.A66
:[00FFD0FF50FFD0FF000000000000000000FFFFFF00FFFFFF00FF0BFF0AFF0BFF50FFD0FF00FFFFFF0AFF0BFF00FFFFFF3F407F8080FFFFE1→Pic1
:[FF7F787FF87F787F8040201028448201FF000000FF000000FFFE0EFE0FFE0EFEF87F787FFF0000000FFE0EFEFF0000003F5F7FBFBF80BFBE→Pic2
:[030F1C337F3D7022C0F038CCFE5C0E4432393F372F1F09064C9CFCECF4F89060030F1C337F3A7022C0F038CCFEBC0E4432393F170F0F04034C9EEECE9CF8F000030F1C337F3D7022C0F038CCFE5C0E4432797773391F0F004C9CFCE8F0F020C0030F1C386B3F6F3FC0F0381CD6FCF6FC3F3F3F3F2F1F0906FCFCFCFCF4F89060030F1C386B3F6F3FC0F0381CD6FCF6FC7F7F3F1F2F1F0906FCF8F8E8D0E0C000030F1C386B3F6F3FC0F0381CD6FCF6FC3F1F1F170B070300FEFEFCF8F4F89060→Pic1G
:[030C102040205022C030080402040A44322827342B1009064C14E42CD4089060030C102040205022C030080402040A44322827140B0804034C12E20A9408F000030C102040205022C030080402040A443248475029100F004C14E428D01020C0030C102040204020C0300804020402042020302C2314090604040C34C4289060030C102040204020C0300804020402044040201827180906041828489060C000030C102040204020C030080402040204201814120906030002020418E4189060→Pic2G
:DeltaList(0,32,0,64,0,96,128,96,160,96)→GDB1
:
:Lbl DG
:DispGraphrr
:GetCalc("Str1")→Q
:16→{L1}
:16→{L1+1}
:ClrDraw
:ClrDrawr
:Full
:GetCalc("vMDATA")→L→S
:0→Y→E→F+1→C→K→T
:FnInt(GT,0)
:Full
:Goto MP
:
:Lbl RND
:Full
:For(θ,0,7
:Full
:FnOff
:For(B,0,11
:θ+E*{L1}+B+F→Y
:Pt-Off(B*8,θ*8,{Q+Y}*8+Pic1
:Pt-Off(B*8,θ*8,{Q+Y}*8+Pic2)r
:Pt-Off(B*8,θ+1*8,{θ+1+E*{L1}+B+F+Q}*8+Pic1
:Pt-Off(B*8,θ+1*8,{θ+1+E*{L1}+B+F+Q}*8+Pic2)r
:For(Y,0,1
:If ((B+F)≥({L1+1}-Y)) or ((θ+E)≥({L1}-Y
:If ((B+F)≥({L1+1}-Y)) or ((θ+E+1)≥({L1}-Y
:Pt-On(B*8,θ+1*8,[FFFFFFFFFFFFFFFF]
:Pt-On(B*8,θ+1*8,[FFFFFFFFFFFFFFFF])r
:End
:Pt-On(B*8,θ*8,[FFFFFFFFFFFFFFFF]
:Pt-On(B*8,θ*8,[FFFFFFFFFFFFFFFF])r
:End
:End
:End
:θ+1→θ
:FnOn
:Pt-Off(32,28,Pic1G+G
:Pt-Off(40,28,Pic1G+8+G
:Pt-Off(32,36,Pic1G+16+G
:Pt-Off(40,36,Pic1G+24+G
:Pt-Off(32,28,Pic2G+G)r
:Pt-Off(40,28,Pic2G+8+G)r
:Pt-Off(32,36,Pic2G+16+G)r
:Pt-Off(40,36,Pic2G+24+G)r
:End
:K-1→K
:Return
:
:Lbl MP
:0→T→G→H+1→K
:sub(RND)
:Repeat getKey(15)
:If getKey(1) and (K=0
:E→T
:If H≥4
:0→H
:End
:For(J,0,2
:3-J→K
:{H+J+GDB1}→G
:sub(RND)
:E+1→E
:For(θ,0,649
:End
:End
:T+2→E
:!If H
:2→H
:Else
:0→H
:End
:End
:If getKey(4) and (K=0
:E→T
:If (H≠5) and (H≠7
:5→H
:End
:For(J,0,2
:3-J→K
:{H+J+GDB1}→G
:sub(RND)
:E-1→E
:For(θ,0,649
:End
:End
:T-2→E
:If H=5
:7→H
:Else
:5→H
:End
:End
:If getKey(2) and (K=0
:F→T
:For(J,0,2
:3-J→K
:0→G
:sub(RND)
:F-1→F
:End
:T-2→F
:End
:If getKey(3) and (K=0
:T→F
:For(J,0,2
:F+2→F
:2-J→K
:sub(RND)
:End
:T+2→F
:End
:End
:LnReg
:Return
:
:Lbl GT
:.T+1→T
:.Q+1→Q
:.If T=2
:.0→T
:Normal
:DispGraphrr
:Full
:.End
:sub(MI)
:Return
:
:.MUSIC PLAYER
:[0020341E821CE91A6619F917A1165C1529140713F611F41000101A0F410E740DB30CFD0B500BAE0A140A8309FB087A0800088D072107BA065906FE05A80557050A05C2047D043D040004C70390035D032D03FF02D402AB02850261023F021E020002E301C801AF01960180016A015601430130011F010F010001F200E400D700CB00C000B500AB00A1009800900088008000790072006C00660060005B00550051004C004800440040003C0039003600330030002D002B00280026002400220020001E001D001B001900180017001500140013001200110010000F000E000D000D000C000B000B000A000A00090008000800080007000700060006000600]→Str9N
:Lbl MI
:Return!If GetCalc("vMDATA")
:!If L
:+1→C
:Return
:End
:ReturnIf C-1→C
:Lbl I2
:If {L+1}
:SinReg{{L}+Str9N}r,1900)
:If {L+2→L-1}→C=1
:Goto I2
:End
:Else
:S→L:90→C
:End
:Return
Title: Re: Why is this failing?
Post by: Runer112 on October 03, 2010, 09:37:41 pm
I initially checked for anything that might have been disabling the music in your code, but I couldn't see anything, so I figured I'd try to compile and debug it myself. After much sifting through the code and replacing forum-friendly characters with the real tokens so I could compile this on a calculator, the music appears to work fine for me. Are you sure the version of the failing source you posted is the version that isn't working for you?
Title: Re: Why is this failing?
Post by: Quigibo on October 03, 2010, 10:41:02 pm
You need a fnOn after any DispGraph command while your custom interrupt is running or else it gets disabled after a while (It's a bug in the z80 hardware).
Title: Re: Why is this failing?
Post by: calc84maniac on October 03, 2010, 10:48:18 pm
That's not a good idea, the DispGraph command is *inside* the custom interrupt.
Title: Re: Why is this failing?
Post by: FinaleTI on October 04, 2010, 05:32:58 am
Oddly enough, I just tried this on my calc and it worked.
Maybe the problem was that I just didn't have the latest version of wabbit?
Title: Re: Why is this failing?
Post by: DJ Omnimaga on October 04, 2010, 02:08:32 pm
Someone else reported a recent issue about Wabbitemu, where most keys wouldn't respond at all.
Title: Re: Why is this failing?
Post by: FinaleTI on October 04, 2010, 05:16:47 pm
It would seem that this isn't a wabbit issue, as the working version I uploaded to my computer from my calc works perfectly in wabbit.
I believe the music problem has been solved, aside from the lag when moving, but that's just because of how I update my map, so I'll see about a way to fix that.
Title: Re: Why is this failing?
Post by: DJ Omnimaga on October 04, 2010, 05:34:40 pm
Weird...
 
I hope you can get everything sorted out x.x. Also check for closed parhentesises and brackets. I heard that in some cases, forgetting to close some can cause issues x.x
Title: Re: Why is this failing?
Post by: Deep Toaster on October 04, 2010, 06:30:26 pm
Yeah, especially with getKey(#).

EDIT: And even if it's allowed, never mix different sets of brackets, for example
Code: (Axe) [Select]
:(X+2}
Title: Re: Why is this failing?
Post by: Quigibo on October 04, 2010, 09:17:37 pm
Actually, the closing parenthesis are interchangeable and behave the exact same way.  In fact, they are sometimes implied when you don't see them.  For instance "Disp A" is actually parsed as "Disp(A" and thus you can add the unneeded parenthesis "Disp A)" and it will parse fine.  Since they are interchangeable, you can even do "Disp A}".  It saves code for me not to have to do all these formatting checks.
Title: Re: Why is this failing?
Post by: DJ Omnimaga on October 04, 2010, 09:18:38 pm
Ah nice, I didn't knew that.
Title: Re: Why is this failing?
Post by: Deep Toaster on October 04, 2010, 11:04:19 pm
Really? How do you know when to pop it then? Do you do it at the end of the line?