This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - Runer112
Pages: 1 ... 149 150 [151] 152 153
2251
« on: May 31, 2010, 01:01:38 am »
Whenever you call a subroutine, you "push" the place its supposed to return to into the stack so it knows where to go back to in the code when it reaches the Return, which then "pops" the stack. Also, I wasn't sure at the time of writing if he did use any assembly code which is why I was explaining it at a lower level.
Glad you found the error
When I'm finished with it I'll make sure to post my project. It's a really nice (albeit BIG) sprite editor that can store multiple sprites of either 8x8 or 16x16, and has support for hex entry and live hex display. That messed up subroutine was the delete sprite subroutine. After that I'll probably want to add move/copy commands and it'll pretty much be done. Until I get grayscale working.
2252
« on: May 31, 2010, 12:58:29 am »
2253
« on: May 31, 2010, 12:50:03 am »
Runer, are the numbers off by 2 or by a lot? Try putting it in your other subroutines and see if you narrow down the one that changes it.
Off by a lot. I have it down to a specific line now, it's a conj() line so it could definitely be the culprit. EDIT: Well there's your problem, the conj() size is supposed to be fairly small but it's over 4000. EDIT 2: FIXED IT Thanks for the stack inspection assembly code Quigibo, that helped a lot.
2254
« on: May 31, 2010, 12:41:45 am »
What should I look for as possible causes of a leak? I don't have any Gotos, so I know that can't be it. EDIT: The two "Disp Asm(E1E5)>Dec" commands don't return the same value EDIT 2: Working down the exact line that messes up the stack. And yes DJ Omnimaga, I know how the stack works with pushing and popping. EDIT 3: Found the exact line. Checking out all the values in it now.
2255
« on: May 31, 2010, 12:32:19 am »
well maybe you can post your code so we can actualy see what is going on. Its possible there might be something you are missing, or hardware thats going wrong
Good luck, even with some explanatory comments: .SPREDIT Sprite Editor
.PIXEL SPRITES .5x5 [F8F8F8F8F8000000]→Pic1 .3x3 [E0E0E00000000000] .2x2 [C0C0000000000000]
.BLANK SPRITE [0000000000000000000000000000000000000000000000000000000000000000]→Pic0
.HEX KEYS ∆List(33,34,26,18,35,27,19,36,28,20,47,39,31,46,38,30)→GDB1
.HEX TEXT "0123456789ABCDEF"→Str1
.APPVAR NAME "vSPREDIT"→Str0
.HELP TEXT "2ND: INVERT PIXEL"→Str00 "ARROW KEYS: MOVE CURSOR"→Str01 "0-F: HEX INPUT"→Str02 "DEL/STAT: HEX NAVIGATION"→Str03 "F2: NEW 8X8 SPRITE"→Str04 "F3: NEW 16X16 SPRITE"→Str05 "+/-: CHANGE OPEN SPRITE"→Str06 "CLEAR: EXIT"→Str07
sub(I) .Disp {V}>Dec .Disp {V+1}>Dec .Disp {V+2}>Dec .Disp i .Disp {V+3}>Dec .Disp {V+4}>Dec .Disp {V+5}>Dec .Disp i .Disp {V+6}>Dec .Disp {V+7}>Dec .Disp {V+8}>Dec .Disp i .Disp {V+9}>Dec .Disp {V+10}>Dec .Disp {V+11}>Dec .Disp i .Disp {V+12}>Dec .Disp {V+13}>Dec .Disp {V+14}>Dec .Disp i .Disp {V+15}>Dec .Disp {V+16}>Dec .Disp {V+17}>Dec .Pause 10000 .<MAIN LOOP> Repeat K=15
getKey→K
.KEYPAD CHECK sub(K)
.HELP CHECK If K=53 ClrDraw Fix 0 Str00→{L₁}ʳ Str01→{L₁+2}ʳ Str02→{L₁+4}ʳ Str03→{L₁+6}ʳ Str04→{L₁+8}ʳ Str05→{L₁+10}ʳ Str06→{L₁+12}ʳ Str07→{L₁+14}ʳ For(A,0,7) Text(0,A*8,{A*2+L₁}ʳ) End DispGraph Repeat getKey≠0 End sub(L) End
.CHANGE SPRITE If K=10 and (sub(NS)≠{V}) {V}+1→{V} sub(L) End
If K=11 and ({V)≠1) {V}-1→{V} sub(L) End
.NEW 8X8 SPRITE If K=52 8sub(N) End
.NEW 16X16 SPRITE If K=51 16sub(N) End
.DELETE SPRITE If K=49 and (sub(NS)≠1) sub(D) Disp 65502>Dec Pause 5000 sub(L) End
.CHANGE PIXEL CHECK If K=54 sub(IP) End
0→H
.HEX MOVE FORWARD CHECK If K=32 0→D 3→K 3-X^4→W For(A,0,W) If sub(K)=0 65533→Z sub(MC) End End 1→D sub(DG) End
.HEX BACK UP CHECK If K=56 0→D 2→K X-1^4→W For(A,0,W) sub(K) End 1→D sub(DG) End
16→H
.HEX ENTRY CHECK For(A,0,15) If K={GDB1+A} A→H End End
.HEX ENTRY EXECUTION If H≠16 0→D 3→K H→N 0-(X^4)→Z sub(MC) For(A,0,3) A+4sub(GB)sub(SP) If sub(K)=0 65533→Z sub(MC) End End 1→D sub(DG) 16→H End
End
.<EXIT CLEANUP> ClrDraw DispGraph Fix 0 Fix 4 Fix 6 Archive Str0
.<SUBROUTINES> .CHECK IF CAN MOVE CURSOR Lbl K If K=3 and (X+Y≠14 or (S=16 and (Q≠3)))-(K=2 and (X+Y≠0 or (S=16 and (Q≠0))))→Z or (K=1 and (Y≠7 or (S=16 and (Q≤1)))-(K=4 and (Y≠0 or (S=16 and (Q≥2))))→θ)→M sub(MC) End M Return
.CHECK IF DISPGRAPH NEEDED Lbl DG If D≠0 sub(UH) If S=8 0→E 56→F Else 65→E 16→F End sub(PH) Output(0,0) DispGraph End Return
.UPDATE HEX Lbl UH If S=8 For(A,0,7) conj(A+22*12+10+L†,A+P,1) End Else For(J,0,1) For(T,0,1) For(A,0,7) conj(J*8+A*12+T+9+L†,J*2+T*8+A+P,1) End End End End Return
.PRINT HEX Lbl PH For(A,0,sub(SL)-1) If Q*8+Y=A X≥4+254→I End {A+P}sub(BH) If Q*8+Y=A A*2+(X≥4)→I End End If S=8 I*6→E 56→F For(J,0,95) Pxl-Off(J,55) End Else I^8*4+65→E I/8*6+16→F Line(64,0,64,63) For(J,0,3) J*12+16→T Line(64,T,95,T) End End If E≠0 Line(E-1,F,E-1,sub(CS)+F+5) End For(J,0,sub(CS)+4) If E+J>0 and (E+J≤96) Pxl-On(E+J-1,S=16*7+F-1) End End Return
.BYTE TO PRINTED HEX Lbl BH →B B/16+Str1sub(PC) If I≥254 I-1→I End B^16+Str1sub(PC) Return
.PRINT CHARACTER Lbl PC →U If I=254 Fix 3 End If S=16*3+90≠E Text(E,F,{U}>Frac) Else If S=8 For(J,0,sub(CS)+5) pxl-Test(91-(sub(CS)),F+J)→{J+L₁} End Text(91-(sub(CS)),F,{U}>Frac) For(J,0,sub(CS)+5) For(T,0,sub(CS)+3) If pxl-Test(94-T,F+J) xor pxl-Test(95-T,F+J) Pxl-Change(95-T,F+J) End End If {J+L₁} xor pxl-Test(91-(sub(CS)),F+J) Pxl-Change(91-(sub(CS)),F+J) End End Else Text(66,1,{U}>Frac) For(J,0,5) For(T,0,3) If pxl-Test(69-T,J+1) xor pxl-Test(96-T,F+J) and (T≠0) Pxl-Change(96-T,F+J) End Pxl-Off(69-T,J+1) End End End End If I=254 Fix 2 End S=8*2+E+4→E If 93-(sub(CS))<E S=16*65→E sub(CS)+F+6→F End Return
.MOVE CURSOR Lbl MC sub(DC) If S=8 If X+Z→X=8 0→X Y+1→Y End If X=65535 7→X Y-1→Y End Else If X+Z→X=8 0→X If H=16 Q+1→Q If sub(QX)=0 If Y+1→Y=8 0→Y Else Q-2→Q End End Else If Y+1→Y=8 0→Y Q+1→Q End End End If X=65535 7→X If H=16 Q-1→Q If sub(QX)≠0 If Y-1→Y=65535 7→Y Else Q+2→Q End End Else If Y-1→Y=65535 7→Y Q-1→Q End End End End If Y+θ→Y=8 0→Y Q+2→Q End If Y=65535 7→Y Q-2→Q End sub(DC) sub(DG) Return
.DRAW CURSOR Lbl DC If S=8 Pxl-Change(X*6+4,Y*6+4) Else Pxl-Change(sub(QX)+X*4+1,sub(QY)+Y*4+1) End Return
.INVERT PIXEL Lbl IP If S=8 Pt-Change(X*6+2,Y*6+2,Pic1) Pt-Change(X*2+57,Y*2+18,Pic1+16) Pxl-Change(X+80,Y+22) Else Pt-Change(sub(QX)+X*4,sub(QY)+Y*4,Pic1+8) Pxl-Change(sub(QX)+X+72,sub(QY)+Y) End sub(DG) Return
.SET PIXEL Lbl SP If =1 xor (sub(PT)) sub(IP) End Return
.PIXEL TEST Lbl PT If S=8 pxl-Test(X+80,Y+22) Else pxl-Test(sub(QX)+X+72,sub(QY)+Y) End Return
.GET BIT Lbl GB →B N→O For(C,1,7-B) O/2→O End O^2 Return
.SET BIT .Lbl SB
.Return
.CONVERT QUADRANT TO X Lbl QX Q=1 or (Q=3)*8 Return
.CONVERT QUADRANT TO Y Lbl QY Q≥2*8 Return
.CHARACTER SIZE MODIFIER Lbl CS S=8*2 Return
.LOAD SPRITE Lbl L ClrDraw 0→D sub(DS)+(sub(SO))+V+2→P Fix 0 Fix 3 Text({V}<10*4+81→A,0,{V}>Dec) Fix 2 If A≠81 or ({P-2}=8) Line(A-1,0,A-1,6) End Line(A,6,87,6) For(J,0,6) conj(J*12+10+L†→A,A+1,1) conj(Pic0,A,1) End If {P-2}=8 sub(8) 0→J Else sub(16) 3→J End For(Q,0,J) For(Y,0,7) sub(LR) For(X,0,7) If sub(PT) sub(IP) End End sub(LR) End End 1→D sub(IV) sub(DC) sub(DG) Return
.LOAD SPRITE ROW Lbl LR conj(Q*8+Y+P,S=8*22+(sub(QY))+Y*12+(sub(QX)≠0)+(S=8)+9+L†,1) Return
.NEW SPRITE Lbl N →S sub(DS)→J sub(NS)+1→{V+1} sub(NS)→{V} conj(V,L₁,sub(AL)) J+L₁→O If sub(AL)-J→C≠0 conj(O+C-1,O+C+1,C)ʳ End C→{O}ʳ S→{sub(AL)+L₁+2→C} 2→{C+1} conj(Pic0,C+2,sub(SL)) GetCalc(Str0,sub(AL)+(sub(SL))+4→T)→V T→{L₁+2}ʳ conj(L₁,V,T) sub(L) Return
.DELETE SPRITE Lbl D sub(SO)→{L₁}ʳ conj(P-2,L₁+2,sub(SL)+2) If sub(NS)-{V}≠0 sub(SS)→T {V}→A+1→{V} conj(T,sub(SS),sub(AL)-(sub(DS))-(sub(SO))) {V}-1→{V} Else {V}-1→A End conj({V}*2+V+2→T+2,T,sub(AL)-T-2) sub(AL)-(sub(SL)+4→T)→J→{V+2}ʳ sub(NS)-1→{V+1} A^256→{V} conj(V,T+L₁→T,J) .Disp {T}>Dec .Disp {T+1}>Dec .Disp {T+2}>Dec .Disp i .Disp {T+3}>Dec .Disp {T+4}>Dec .Disp {T+5}>Dec .Disp i .Disp {T+6}>Dec .Disp {T+7}>Dec .Disp {T+8}>Dec .Disp i .Disp {T+9}>Dec .Disp {T+10}>Dec .Disp {T+11}>Dec .Disp i .Disp {T+12}>Dec .Disp {T+13}>Dec .Disp {T+14}>Dec .Disp i .Disp {T+15}>Dec .Disp {T+16}>Dec .Disp {T+17}>Dec .Disp i .Disp J>Dec .Pause 10000 GetCalc(Str0,J)→V conj(T,V,J) .ClrDraw .ClrHome .Output(0,0) .Disp {V}>Dec .Disp {V+1}>Dec .Disp {V+2}>Dec .Disp i .Disp {V+3}>Dec .Disp {V+4}>Dec .Disp {V+5}>Dec .Disp i .Disp {V+6}>Dec .Disp {V+7}>Dec .Disp {V+8}>Dec .Disp i .Disp {V+9}>Dec .Disp {V+10}>Dec .Disp {V+11}>Dec .Disp i .Disp {V+12}>Dec .Disp {V+13}>Dec .Disp {V+14}>Dec .Disp i .Disp {V+15}>Dec .Disp {V+16}>Dec .Disp {V+17}>Dec .Disp i .Disp J>Dec .Pause 10000 Disp 65501>Dec Pause 5000 Return
.NUMBER OF SPRITES Lbl NS {V+1} Return
.APPVAR LENGTH Lbl AL {V+2}ʳ Return
.SPRITE LENGTH Lbl SL If S=8 8 Else 32 End Return
.SPRITE OFFSET Lbl SO {{V}*2+V+2}ʳ Return
.SPRITE START Lbl SS sub(DS)+(sub(SO))+V Return
.ALL SPRITE DATA START Lbl DS sub(NS)*2+4 Return
.INITIALIZE 8X8 SPRITE EDITING Lbl 8 Fix 1 sub(IV) 8→S Line(0,0,50,0) Line(50,0,50,50) Line(50,50,0,50) Line(0,50,0,0) Line(55,16,74,16) Line(74,16,74,35) Line(74,35,55,35) Line(55,35,55,16) Line(78,20,89,20) Line(89,20,89,31) Line(89,31,78,31) Line(78,31,78,20) Return
.INITIALIZE 16X16 SPRITE EDITING Lbl 16 Fix 0 sub(IV) 16→S Line(70,0,70,15) Line(89,{V}≥10*7,89,15) Return
.INITIALIZE POSITION VARIABLES Lbl IV 0→Q→X→Y Return
.PRIMARY INITIALIZATION Lbl I DiagnosticOff Full Fix 5 Fix 7 UnArchive Str0 !If GetCalc(Str0)→V GetCalc(Str0,4)→V ∆List(0,0,4r)→GDB0 conj(GDB0,V,4) 8sub(N) Else sub(L) End 0→K Return
.<VARIABLES> .A=temp .B=bit number (bit subroutine use) .C=temp .D=DispGraph needed .E=text x position .F=text y position .H=hex entry .I=invert character marker .J=temp .K=getKey .M=can move .N=number input to bit subroutines .O=bit subroutine temp .P=pointer to working sprite .Q=quadrant .R=sprite number overlay timer .S=sprite size .T=temp .U=text .V=pointer to appvar .W=temp x position .X=x position .Y=y position .Z=change in x position .θ=change in y position The problematic situation occurs when sub(D) is called here (the only place it is called) and does not return: .DELETE SPRITE If K=49 and (sub(NS)≠1) sub(D) Disp 65502>Dec Pause 5000 sub(L) End As I said, the last lines of sub(D) execute properly, and seeing as I had no problems with any of the code called in sub(D) before, I don't think the code called is the problem.
2256
« on: May 31, 2010, 12:30:02 am »
@Runer
Axe doesn't have restrictions on this other than the 150 individual label names. Its more of a hardware limitation. I think the stack size is like 400 bytes or something although I have no idea really I'm basically making up this number. Anyone actually know?
It sounds more like you have a memory leak on the programming side than on the parser side. Double check that all the subroutines end in Return and that you aren't using goto between subroutines or trapping recursive subroutines, I don't know if you're using those.
As I said, the problem can't be with the subroutines called or what they do. None of them leak memory (they never did before the addition of this subroutine call, and using a lot of displays at the end of this subroutine, I could determine that all variables and such have the same values they had at an earlier point in the program, which worked correctly) , use Gotos, etc. If they did, the program execution would never reach the last few lines of the original subroutine called, "Disp 65501>Dec," and it does. However, it doesn't reach the lines that should run immediately after the return, like "Disp 65502>Dec."
2257
« on: May 31, 2010, 12:10:25 am »
Is it possible for the stack to get so filled with embedded subroutine calls that it just fails? Because I have a subroutine call in my main program that subsequently calls many embedded subroutines over and over again, and by the time code execution is at the Return for the original subroutine, the program just stops. I put in a line to display some arbitrary value right before the final Return and right after where it should return to, and the first one displays but the second does not.
The involved code:
Repeat K=15 getKey→K If K=49 sub(D) Disp 65502>Dec Pause 5000 End End
Lbl D sub(SO)→{L}r conj(P-2,L+2,sub(SL)+2) If sub(NS)-{V}≠0 sub(SS)→T {V}→A+1→{V} conj(T,sub(SS),sub(AL)-(sub(DS))-(sub(SO))) {V}-1→{V} Else {V}-1→A End conj({V}*2+V+2→T+2,T,sub(AL)-T-2) sub(AL)-(sub(SL)+4→T)→J→{V+2}r sub(NS)-1→{V+1} A^256→{V} conj(V,T+L→T,J) GetCalc(Str0,J)→V conj(T,V,J) sub(L) Disp 65501>Dec Pause 5000 Return As you can see, there are over a dozen subroutine calls in this subroutine alone, and many of those subroutines call other subroutines. The subroutines called and what they do aren't really important; none of them overwrite memory sections they shouldn't or have Gotos to break code order or call the original subroutine again. The most damning evidence is that in the end, 65501 will display, but 65502 will not. This doesn't make much sense, as "Disp 65502>Dec" should come immediately after "Disp 65501>Dec" in code execution.
2258
« on: May 30, 2010, 06:18:35 pm »
Do you understand how if i store a 2 byte number into {L1+0}, the first byte gets stored into {L1+1} and the second byte into {L1+0}? This is what is known as Little-Endian format (since the little end goes in first)
Ok wait, I'm confused now. If I stored 1025 (0401) into {L1+2}r, I would get {L1+2}=01 and {L1+3}=04? Then what would I get if I evaluated {L1+2}r? EDIT: Shit fail, now it all makes sense... *facepalm, goes to strike out other posts*
2259
« on: May 30, 2010, 06:12:26 pm »
So if i understand you correctly, you are saying that storing 2 byte numbers works incorrectly because it stores the bytes in backwards order?
I'm really not sure anymore. I just spent over an hour trying to get two-byte data manipulations to work in my program. What works in one case doesn't work in another case. I can't explain what is wrong anymore, it doesn't even seem to be a constant flaw.jk again
2260
« on: May 30, 2010, 04:29:29 pm »
I don't think that retrieving and storing two-byte expressions work correctly. Both of the following examples would be affected:
{V+2}r→T T→{L1+2}r
I believe this is because, although the r modifier is supposed to simply signify two bytes in this case, it signifies both two bytes and it swaps the bytes. Taking the first line as an example, if {V+2}=01 and {V+3}=F0, T becomes F001, although one would think that it should become 01F0. The second example acts even more oddly, the incorrect behavior of which I am spending a lot of time trying to counteract.
EDIT: This really needs looking into. I've spend the last hour just trying to get a few two-byte values to work correctly. And I haven't even been successful yet.
ANOTHER EDIT: I finally got it to work, but the code that makes it work took a lot of trial and error and doesn't logically make sense. This is still a problem that needs to be checked.
jk
2261
« on: May 30, 2010, 02:23:12 pm »
In the command list, "UnArchive" is incorrectly capitalized as "Unarchive"
2262
« on: May 30, 2010, 01:35:00 am »
what would sub-routine usage in expression do?
In my example: 91-(sub(CS)) I have: Lbl CS S=8*2 Return This allows me to return a calculation I use in many places throughout the program without having to retype the expression everywhere it is needed, thereby reducing program size.
2263
« on: May 30, 2010, 12:20:59 am »
I think this is a bug. If not just tell me. The following fails to compile:
91-sub(CS) But this successfully compiles:
91-(sub(CS))
2264
« on: May 29, 2010, 04:21:15 pm »
alright. Err: Undefined Tribal said this compiled correctly in 2.4... I used 2.5
.SCREEN DiagnosticOff [FFFFFFFFFDFDFDFD]->Pic1 ClrDraw DrawInv While getkey (doesn't equal symbol here) 15 pause 100 DispGraph Vertical + For(A,0,95 Pt-Off(A,0,pic1 end Pt-On(rand^96,A,Pic1 end
Is "pic1" not being capitalized in "Pt-Off(A,0,pic1" just a typo in your message?
2265
« on: May 27, 2010, 09:14:52 pm »
Looks like your look-ahead parsing still has room for improvement I hadn't recompiled a program using a version newer than 0.2.2 until now, and I've run into a slight annoyance. Your parser threw an error I hadn't seen before, that a static pointer I used was undefined. This is because, to make program editing on my calculator easier, I moved all the sprite data to the bottom of the program and just call it as a subroutine at the start of the program. However, because the program is parsed from top to bottom, it ran into a reference to sprite data in the body of the program "before" the sprite was defined, throwing the error. Any chance this could be fixed? Or an option to disable this part of error checking? EDIT: So as not to double post, here's another problem I think I may have found, although this may just be inherent in the way text printing works: when large font is enabled, Text() will not display for X=90.
Pages: 1 ... 149 150 [151] 152 153
|