Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
19 May, 2013, 03:31:54 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1]   Go Down
  Print  
Author Topic: Finished my first project! And it doesn't work mostly. :'C -  (Read 386 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Link
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: Yesterday at 23:49:04
Date Registered: 28 August, 2012, 22:32:37
Location: Canada/USA
Posts: 116


Topic starter
Total Post Ratings: +4

View Profile WWW
« on: 30 August, 2012, 20:03:54 »
0

Well, I created my first Axe project program, Its a port of a Ti-Basic program, and it doesn't seem to work, even though I check everything. Asked for help in some other threads, as well as referencing the docs.

It's a locking mechanism, but whenever I try to use it, Ram just gets cleared. Is there anything else that I seem to be missing?

Lock Mechanism

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
:.CALCLOCK
:ClrHome
:GetCalc("appvTEMP")→T
:If T
:GetCalc("appvTEMP",100)→T
:End
:GetCalc("appvPASS",100)→P
:Disp "CALCLOCK3 By M.A"
:Output(7,1,"{-}{-}")
:Output(6,2,"!  !")
:Output(6,3,"{-}{-}{-}{-}")
:Output(6,4,"!{box} !")
:Output(6,5,"{-}{-}{-}{-}")
:Output(6,6,"Pass")
:For(B,1,4)
:Repeat K
:getKey→K
:End
:K→{B+T}
:Output(5+B,7,"*")
:0→K
:End
:For(B,1,4)
:If {B+T}≠{B+P}
:Asm(FDCB1696)
:Return
:End:End
:DelVar B
:DelVar K

Password changing utility

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
:.PASSUTIL
:ClrHome
:GetCalc("appvPASS",100)→P
:Disp "PASSUTIL3 By M.A"
:Disp "PASS?:"
:For(B,1,4)
:Repeat K
:getKey→K
:End
:K→{B+P}
:Output(6+B,1,"*")
:0→K
:End
:Disp "PASS CHANGED!"
« Last Edit: 30 August, 2012, 20:04:27 by The Elite Noob » Logged

Deep Thought
So much to do, so much time, so little motivation
Administrator
LV13 Extreme Addict (Next: 9001)
*
Offline Offline

Gender: Male
Last Login: Today at 02:55:47
Date Registered: 19 May, 2009, 08:00:00
Location: The Universe
Posts: 7813


Total Post Ratings: +706

View Profile WWW
« Reply #1 on: 30 August, 2012, 20:25:14 »
0

I haven't read through all your code, but here are some things I noticed:
  • You seem to have the parameters for Output( backwards (like in TI-BASIC). In Axe it's X, then Y. You'll probably end up writing outside the screen, which corrupts RAM.
  • I don't think you meant to do this:
    Quote from: Axe
    :GetCalc("appvTEMP")T
    :If T
    :GetCalc("appvTEMP",100)T
    :End
    You're checking if the appvar exists, and if it exists you overwrite it with a new appvar. Did you mean to use !If T?
  • Since you use the string "appvTEMP" twice, you can save a few bytes by storing it to a static variable (like Str1) and using that instead. That way, there's only one copy of the string in the program data, rather than two. ("appvTEMP"→Str1:GetCalc(Str1) is exactly the same as GetCalc("appvTEMP"), except that you can reuse Str1 in another line.)
Logged




Link
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: Yesterday at 23:49:04
Date Registered: 28 August, 2012, 22:32:37
Location: Canada/USA
Posts: 116


Topic starter
Total Post Ratings: +4

View Profile WWW
« Reply #2 on: 30 August, 2012, 20:32:35 »
0

No, it's not backwards, that's how I meant to do it.Thanks for the string trick, I'll do that now. Finally, Yea, I meant !If T instead :p.
Logged

Hayleia
Programming Absol
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Last Login: Yesterday at 09:26:23
Date Registered: 01 June, 2011, 20:12:47
Location: ud-ud ?
Posts: 2043


Total Post Ratings: +254

View Profile
« Reply #3 on: 30 August, 2012, 20:38:04 »
0

You seem to have the parameters for Output( backwards (like in TI-BASIC). In Axe it's X, then Y. You'll probably end up writing outside the screen, which corrupts RAM.
And note that in Basic coordinates are between (1,1) and (16,8) while in Axe it is between (0,0) and (15,7). But it seems fine in your program Smiley

Also, I guess the TEMP appvar is a temp appvar ? Tongue
Which means that you don't need it to be saved after you ran your prog and you don't need to have it at the launching of your program ?
If so, I'd advise you to use a DelVar "appvTEMP" (or DelVar Str1 is you use Deep Thought's tip) at the beginning and at the end of your program.
This way:
 - the appv is deleted after the program ran and doesn't waste any RAM
 - the appv is deleted at the beginning of the program so you don't need to check if it already exists: you deleted it.
(note that DelVar deletes the appvar if it exists and does nothing otherwise Wink)
Logged





Spoiler for what I am according to...:
me: useless
Pokemon Test: an Absol
turiqwalrus: an eggplant
p2: A HUMAN BEING !
Blackpilar and p2: iplantonlyplantwantplanttoplantknowplantifplantyouplantareplantaplantboyplantorplantaplantgirlplant
click here to know where you got your last +1s
Deep Thought
So much to do, so much time, so little motivation
Administrator
LV13 Extreme Addict (Next: 9001)
*
Offline Offline

Gender: Male
Last Login: Today at 02:55:47
Date Registered: 19 May, 2009, 08:00:00
Location: The Universe
Posts: 7813


Total Post Ratings: +706

View Profile WWW
« Reply #4 on: 30 August, 2012, 20:39:57 »
0

- the appv is deleted at the beginning of the program so you don't need to check if it already exists: you deleted it.
You don't need to delete it anyway because GetCalc( will automatically delete the appvar if it exists.
Logged




Hayleia
Programming Absol
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Last Login: Yesterday at 09:26:23
Date Registered: 01 June, 2011, 20:12:47
Location: ud-ud ?
Posts: 2043


Total Post Ratings: +254

View Profile
« Reply #5 on: 30 August, 2012, 20:42:23 »
0

- the appv is deleted at the beginning of the program so you don't need to check if it already exists: you deleted it.
You don't need to delete it anyway because GetCalc( will automatically delete the appvar if it exists.
shocked I didn't know that. I thought it could try to create a second appvar and cause some corruption Tongue
So the beginning should just be GetCalc("appvTEMP",100)→T without deleting anything and without checking if it already exists ?
Logged





Spoiler for what I am according to...:
me: useless
Pokemon Test: an Absol
turiqwalrus: an eggplant
p2: A HUMAN BEING !
Blackpilar and p2: iplantonlyplantwantplanttoplantknowplantifplantyouplantareplantaplantboyplantorplantaplantgirlplant
click here to know where you got your last +1s
Deep Thought
So much to do, so much time, so little motivation
Administrator
LV13 Extreme Addict (Next: 9001)
*
Offline Offline

Gender: Male
Last Login: Today at 02:55:47
Date Registered: 19 May, 2009, 08:00:00
Location: The Universe
Posts: 7813


Total Post Ratings: +706

View Profile WWW
« Reply #6 on: 30 August, 2012, 20:43:44 »
0

Yep.

I didn't realize appvTEMP was supposed to be a temporary appvar <_<

EDIT: Why do you need a temporary appvar at all? You could just create a buffer in the program itself, with Buff(100)→Str0 or something similar. That way you won't have problems if there's not enough RAM to create the appvar, and you don't have to worry about creating it and deleting it and stuff.

EDIT2: Ninja'd by a Runerpost.
« Last Edit: 30 August, 2012, 20:46:40 by Deep Thought » Logged




Runer112
Anti-Riot Squad
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 01:30:08
Date Registered: 02 July, 2009, 06:38:05
Posts: 1679


Total Post Ratings: +492

View Profile
« Reply #7 on: 30 August, 2012, 20:43:54 »
0

A few notes about the locking program:

  • Since it looks like you're just using appvTEMP for 4 bytes of temporary storage, you don't really need an appvar for it at all. You could read the password the user enters into any 4-byte section of static RAM, like L1. To clarify a little bit, "static RAM" is RAM that is always allocated for certain things. Many static RAM location do no hold essential data during assembly program execution, so you can use them as temporary storage without having to request dynamically-allocated storage in user memory.
  • Get rid of the two DelVar commands that you have at the end of the program. In Axe, the A-theta variables are assigned to a section of static RAM, so there's no need to delete them when your program ends because they aren't real variables that consume user memory. Also, DelVar expects the argument passed to it to be a string containing the name of the variable to be deleted, not an actual variable token. I wouldn't be surprised if this is what's causing the RAM clear.
« Last Edit: 30 August, 2012, 20:49:29 by Runer112 » Logged
Hayleia
Programming Absol
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Last Login: Yesterday at 09:26:23
Date Registered: 01 June, 2011, 20:12:47
Location: ud-ud ?
Posts: 2043


Total Post Ratings: +254

View Profile
« Reply #8 on: 30 August, 2012, 20:48:55 »
0

Also, when the program arrives here, in the for loop:
  :Repeat K
  :getKey→K
  :End
I don't see where you initialized K to 0 so it is probably not at 0 and all this is skipped.
You may need to do this
  :0→K
  :Repeat K
  :getKey→K
  :End
Or more optimized:
  :0
  :Repeat
  :getKey
  :End
  :→K
« Last Edit: 30 August, 2012, 20:49:22 by Hayleia » Logged





Spoiler for what I am according to...:
me: useless
Pokemon Test: an Absol
turiqwalrus: an eggplant
p2: A HUMAN BEING !
Blackpilar and p2: iplantonlyplantwantplanttoplantknowplantifplantyouplantareplantaplantboyplantorplantaplantgirlplant
click here to know where you got your last +1s
Deep Thought
So much to do, so much time, so little motivation
Administrator
LV13 Extreme Addict (Next: 9001)
*
Offline Offline

Gender: Male
Last Login: Today at 02:55:47
Date Registered: 19 May, 2009, 08:00:00
Location: The Universe
Posts: 7813


Total Post Ratings: +706

View Profile WWW
« Reply #9 on: 30 August, 2012, 20:51:49 »
0

Or more optimized:
:While 1
:EndIf getKey
:→K
EDIT: IRC ninja'd Tongue
« Last Edit: 30 August, 2012, 20:52:25 by Deep Thought » Logged




Link
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: Yesterday at 23:49:04
Date Registered: 28 August, 2012, 22:32:37
Location: Canada/USA
Posts: 116


Topic starter
Total Post Ratings: +4

View Profile WWW
« Reply #10 on: 30 August, 2012, 21:22:30 »
0

Thanks guys, but I have a problem, when I create the pass appvar, it isn't actually being created?
This code should create an appvar called PASS, but it doesn't? Whats wrong?

Pass:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
:.PASSUTIL
:ClrHome
:GetCalc("appvPASS",100)→P
:Disp "PASSUTIL3 By M.A"
:Disp "PASS?:"
:For(B,1,4)
:0
:Repeat
:getKey
:End
:→K
:K→{B+P}
:Output(6+B,1,"*")
:End
:ClrHome
« Last Edit: 31 August, 2012, 01:01:51 by Link » Logged

Link
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: Yesterday at 23:49:04
Date Registered: 28 August, 2012, 22:32:37
Location: Canada/USA
Posts: 116


Topic starter
Total Post Ratings: +4

View Profile WWW
« Reply #11 on: 31 August, 2012, 04:25:27 »
0

Also, when my appvar is being created, it isn't.

I did this:

1
2
3
:GetCalc("appvPASS",100)→P
:Disp P>Dec
It returns 41111, but when I check for the appvar in the memory menu, it isn't there? Whats wrong?
Logged

Runer112
Anti-Riot Squad
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 01:30:08
Date Registered: 02 July, 2009, 06:38:05
Posts: 1679


Total Post Ratings: +492

View Profile
« Reply #12 on: 31 August, 2012, 04:30:03 »
0

You are checking in the appvar section of the memory management menu, correct? And you are sure that you are using the actual "appv" token (2nd + 8), not just spelling it out?
« Last Edit: 31 August, 2012, 04:56:31 by Runer112 » Logged
Link
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: Yesterday at 23:49:04
Date Registered: 28 August, 2012, 22:32:37
Location: Canada/USA
Posts: 116


Topic starter
Total Post Ratings: +4

View Profile WWW
« Reply #13 on: 31 August, 2012, 16:21:34 »
0

Hmm, that might actually be the problem. I'll check, thank you!
Edit:Yup! That was it, it works now thanks!
« Last Edit: 31 August, 2012, 18:04:02 by Link » Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.272 seconds with 30 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.