Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
20 June, 2013, 11:57:48 *
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: I need help with program creating a program!! -  (Read 465 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
TiAddict
LV3 Member (Next: 100)
***
Offline Offline

Gender: Male
Last Login: 18 March, 2013, 04:01:14
Date Registered: 10 March, 2011, 04:27:52
Location: Phoenix, Arizona
Posts: 68


Topic starter
Total Post Ratings: 0

View Profile
« on: 11 August, 2012, 01:46:45 »
0

So i want to make a program that MAKES a program from the Basic string in str9.
Please Details! Cheesy
Logged
Runer112
Anti-Riot Squad
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 07:40:10
Date Registered: 02 July, 2009, 06:38:05
Posts: 1699


Total Post Ratings: +499

View Profile
« Reply #1 on: 11 August, 2012, 02:56:18 »
+2

I'm not sure how exactly you want your program to work, but I'll give you a few basic details that should provide most of what you need.

To get a pointer to an OS variable in RAM:
GetCalc("var_name")

To find the size of an OS equation, program, appvar, or string:
{pointer_to_var-2}ʳ

To create an OS variable and get a pointer to it:
GetCalc("var_name",size)

To copy data from one memory location to another:
Copy(copy_from,copy_to,size)

Using these pieces of information, you should be able to create a simple Axe program that creates a program and copies the contents of Str9 into it. :)



If you'd like to see a simple Axe program to do this, I'll put two such Axe programs in spoilers. The first will be the normal version, which should be a bit simpler to understand, and the second will be the optimized version. But I feel confident that you won't need to peek to figure it out. :)

Spoiler for Normal Axe program:
.STR9PROG

.       This   v   is the Str9 token
!If GetCalc("Str9")→S
  .This   v   is Str9 spelled out
  Disp "Str9 was not found!"
  getKeyʳ
  Return
End

{S-2}ʳ→Z
!If GetCalc("prgmTEMP",Z)→P
  Disp "Not enough RAM!"
  getKeyʳ
  Return
End

Copy(S,P,Z)
Disp "Success!"
getKeyʳ
Return

Spoiler for Optimized Axe program:
.STR9PROG

Copy(Find(),Make(),Z)
("Success!")

Lbl Out
Disp
getKeyʳ
Returnʳ

Lbl Find
.       This   v   is the Str9 token
ReturnIf GetCalc("Str9")→S
.   v   This is Str9 spelled out
("Str9 was not found!")
Goto Out

Lbl Make
ReturnIf GetCalc("prgmTEMP",{S-2}ʳ→Z)
("Not enough RAM!")
Goto Out




EDIT

So apparently I completely misunderstood the request. It was how to create a program whose name is in Str9, which makes a lot more sense. As an added detail, TiAddict added in IRC that he wanted the program to be created with a size specified by the OS variable L. Here's how I would do it. And don't worry about that hexadecimal number, that's just a free memory location that's well-sized for what we need and shouldn't be used by anything else, which I got from thepenguin77's excellent list.

.STR9PROG
ᴇ9D8A→°Name
'prgm'→Name
GetCalc("Str9")→S
Copy(S,°Name+1,{S+2}ʳ→Z)
 and 0→{Z+°Name+1}
GetCalc(°Name,float{GetCalc("varL")})
« Last Edit: 11 August, 2012, 07:35:54 by Runer112 » Logged
p2
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: 15 April, 2013, 20:40:16
Date Registered: 11 June, 2011, 15:55:36
Location: Germany
Posts: 810


Total Post Ratings: +39

View Profile
« Reply #2 on: 11 August, 2012, 15:52:07 »
0

Already tried to do that, too, but always forgot that thing with the pointer! Tongue
Logged


FREEDOM
OF THE INTERNET
Spoiler for spoilers:
Spoiler for PICTURE:
Spoiler for userbars:



Spoiler for me:
Spoiler for Pic of me:
Spoiler for what I like:
MUSIC:
Dragonforce - Fury of the storm
Dragonforce - Through fire and flames
Skillet - Awake and alive
Skillet - Monster
Nelly - Just a dream
Linkin Park - No more Sorrow
Silbermond - An alle Krieger des Lichts
Wise Guys - Das bedeutet Krieg!
Wise Guys - Das war's wert!

GAMES:
Fancy Pants adventures - World 1
                                 - World 2
                                 - Sneak Peak
                                 - World 3 demo
Droid Assault
Age of Empires
Empire Earth

VIDEOS/FILMS:
StarGate SG1
StarTrek
TheAnnoyingOrange
V for Vendetta
War Games (1 + 2)

BOOKS:
Anthony Horowitz - Alex Rider 1: Stormbreaker
                        - Alex Rider 2: Skelleton Key
                        - Alex Rider 3: Point Blanc
                        - Alex Rider 4: Eagle Strike
                        - Alex Rider 5: Ark Angle
                        - Alex Rider 6: Scorpia
                        - Alex Rider 7: Crocodile tears
                        - Alex Rider 8: Scorpia Rising
Chris Archer - Alpha Kids 1
                 - Alpha Kids 2
                 - Alpha Kids 3
                 - Alpha Kids 4
                 - Alpha Kids 5
                 - Alpha Kids 6
                 - Alpha Kids 7
                 - Still don't have #8 Sad
                 - Alpha Kids 9
                 - Alpha Kids 10
Andreas Schlüter - Level 10 (every book)
Spoiler for Holy Necropost Batman:
Heiligen post-mortem Post, Schlägermann!
This is an example of how wonderful Google Translator works!
Spoiler for wise thing I stole from calc85maniac's profile:
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman
kindermoumoute
LV8 Addict (Next: 1000)
********
Offline Offline

Last Login: 15 June, 2013, 17:17:59
Date Registered: 15 May, 2010, 17:53:56
Posts: 837


Total Post Ratings: +51

View Profile
« Reply #3 on: 11 August, 2012, 18:33:03 »
0

.STR9PROG
ᴇ9D8A→°Name
'prgm'→Name
GetCalc("Str9")→S
Copy(S,°Name+1,{S+2}ʳ→Z)
 and 0→{Z+°Name+1}
GetCalc(°Name,float{GetCalc("varL")})


Optimized :
.STR9PROG
ᴇ9D8A→°Name+1→°Name1
'prgm'→Name
GetCalc("Str9")→S
Copy(,°Name1,{S+2}ʳ→Z)
 and 0→{Z+°Name1}
GetCalc(°Name,float{GetCalc("varL")})


-5 bytes
 w00t
Logged

Projects :

Worms armageddon z80 :
- smoothscrolling Pixelmapping : 100%
- Map editor : 80%
- Game System : 0%

Tutoriel français sur l'Axe Parser
- 1ère partie : en ligne.
- 2ème partie : en ligne.
- 3ème partie : en ligne.
- 4ème partie : 10%
- Annexe : 100%
Runer112
Anti-Riot Squad
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 07:40:10
Date Registered: 02 July, 2009, 06:38:05
Posts: 1699


Total Post Ratings: +499

View Profile
« Reply #4 on: 11 August, 2012, 23:31:47 »
+3

.STR9PROG
ᴇ9D8A→°Name
'prgm'→Name
GetCalc("Str9")→S
Copy(S,°Name+1,{S+2}ʳ→Z)
 and 0→{Z+°Name+1}
GetCalc(°Name,float{GetCalc("varL")})


Optimized :
.STR9PROG
ᴇ9D8A→°Name+1→°Name1
'prgm'→NameGetCalc("Str9")→S
Copy(,°Name1,{S+2}ʳ→Z)
 and 0→{Z+°Name1}
GetCalc(°Name,float{GetCalc("varL")})


-5 bytes
 w00t

Actually they're the same size, and I'll tell you why. Tongue

It looks like you tried to save 2 bytes by making the °Name1 constant to get rid of the two +1's later in the code. But wherever a constant addition or subtraction immediately follows another constant, the operation is performed at compile time and the two constants are combined into one, so °Name+1 is treated just like a constant.

The final 3 bytes you tried to save by removing S as the first argument in the Copy() command, which is a perfectly valid optimization because the value of S was already in HL from the line before. However, this optimization is now performed automatically by the peephole optimizer, so I chose to let the peephole optimizer handle it in favor of slightly improved readability. Smiley
« Last Edit: 11 August, 2012, 23:35:37 by Runer112 » Logged
TiAddict
LV3 Member (Next: 100)
***
Offline Offline

Gender: Male
Last Login: 18 March, 2013, 04:01:14
Date Registered: 10 March, 2011, 04:27:52
Location: Phoenix, Arizona
Posts: 68


Topic starter
Total Post Ratings: 0

View Profile
« Reply #5 on: 11 August, 2012, 23:39:24 »
0

Thank you all for helping me with this, but whenever i run it, (im sure i typed it right, i checked 5 times now) it's not creating the program!!
maybe my calc is being stupid Tongue
« Last Edit: 11 August, 2012, 23:41:16 by TiAddict » Logged
kindermoumoute
LV8 Addict (Next: 1000)
********
Offline Offline

Last Login: 15 June, 2013, 17:17:59
Date Registered: 15 May, 2010, 17:53:56
Posts: 837


Total Post Ratings: +51

View Profile
« Reply #6 on: 11 August, 2012, 23:54:29 »
0

*kindermoumoute runs
Logged

Projects :

Worms armageddon z80 :
- smoothscrolling Pixelmapping : 100%
- Map editor : 80%
- Game System : 0%

Tutoriel français sur l'Axe Parser
- 1ère partie : en ligne.
- 2ème partie : en ligne.
- 3ème partie : en ligne.
- 4ème partie : 10%
- Annexe : 100%
Runer112
Anti-Riot Squad
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 07:40:10
Date Registered: 02 July, 2009, 06:38:05
Posts: 1699


Total Post Ratings: +499

View Profile
« Reply #7 on: 11 August, 2012, 23:55:38 »
+1

Hmm, it seemed to work in my tests. Undecided The only reasons I can think of why it wouldn't work are bad name input (Str9), size input too large (L), the code being copied incorrectly, or a bad/old version of Axe.

If you can post the source 8xp and tell me what version of Axe you're using, or if you can post the compiled 8xp, I should be able to tell you if the problem is either of the latter two possibilities. The former two possibilities you could check. Alternatively, if you're testing this on your calculator and can't easily transfer files to a computer, if you've made no changes to my code and could tell me the size of the compiled program STR9PRGM in the memory management menu and your version of Axe, I may be able to tell you if the problem is one of the latter two possibilities, although I couldn't pinpoint a copying error.
« Last Edit: 11 August, 2012, 23:56:47 by Runer112 » 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.524 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.