Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
23 May, 2013, 08:27:17 *
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 [2]   Go Down
  Print  
Author Topic: Calling one axe program from another -  (Read 1023 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
chattahippie
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: 27 March, 2013, 05:21:38
Date Registered: 19 July, 2011, 04:13:49
Location: Somewhere
Posts: 358


Total Post Ratings: +27

View Profile
« Reply #15 on: 25 February, 2012, 01:44:07 »
0

So is there a way to easily (on calc) fix this, manually or auto?  Or does it require changing it on the computer?
Logged
kindermoumoute
LV8 Addict (Next: 1000)
********
Offline Offline

Last Login: 20 May, 2013, 23:02:59
Date Registered: 15 May, 2010, 17:53:56
Posts: 836


Total Post Ratings: +51

View Profile
« Reply #16 on: 25 February, 2012, 01:47:35 »
0

To conclude, how to to fix it ?
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%
chattahippie
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: 27 March, 2013, 05:21:38
Date Registered: 19 July, 2011, 04:13:49
Location: Somewhere
Posts: 358


Total Post Ratings: +27

View Profile
« Reply #17 on: 25 February, 2012, 01:48:23 »
0

On IRC, Runer suggested Zoom compiling the source, and it seems to work
Logged
DrDnar
LV6 Super Member (Next: 500)
******
Offline Offline

Last Login: Today at 00:54:23
Date Registered: 29 October, 2010, 00:08:46
Posts: 460

Total Post Ratings: +76

View Profile
« Reply #18 on: 25 February, 2012, 06:39:17 »
+3

I've got an epic solution and optimization for you all. I can both eliminate the problem with Copy( and reduce the code size by about ten bytes.

1
"prgmNAME"Asm(E7EF7C4E
BAM! One-liner.
EDIT: This code causes a memory leak; see below for the fix.

For the curious:

1
2
3
ld hl, ptrToName
rst rMOV9TOOP1
bcall(_ExecutePrgm)


Also, to recap: The peep-hold optimizer is causing crashes with the Copy( command sometimes. You can stop Axe from doing the peep-hole optimization with ZOOM. However, it's all a moot point since I just replaced the Copy( command with the single assembly instruction rst rMOV9TOOP1.
« Last Edit: 03 March, 2012, 23:44:20 by DrDnar » Logged

"The tools which would teach men their own use would be beyond price."—The Republic
chattahippie
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: 27 March, 2013, 05:21:38
Date Registered: 19 July, 2011, 04:13:49
Location: Somewhere
Posts: 358


Total Post Ratings: +27

View Profile
« Reply #19 on: 25 February, 2012, 07:41:17 »
0

I've got an epic solution and optimization for you all. I can both eliminate the problem with Copy( and reduce the code size by about ten bytes.

1
"prgmNAME"Asm(E7EF7C4E
BAM! One-liner.

For curious:

1
2
3
ld hl, ptrToName
rst rMOV9TOOP1
bcall(_ExecutePrgm)


Also, to recap: The peep-hold optimizer is causing crashes with the Copy( command sometimes. You can stop Axe from doing the peep-hole optimization with ZOOM. However, it's all a moot point since I just replaced the Copy( command with the single assembly instruction rst rMOV9TOOP1.
Thanks for the fix Cheesy
Logged
Jonius7
aka jhgenius
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 20 May, 2013, 06:58:52
Date Registered: 03 September, 2010, 02:50:11
Location: Gold Coast, Australia
Posts: 1743


Total Post Ratings: +50

View Profile WWW
« Reply #20 on: 25 February, 2012, 13:01:58 »
0

Could this somehow be added to the next version of Axe? Good thought for starting this topic, penguin77.
« Last Edit: 25 February, 2012, 13:02:38 by Jonius7 » Logged



Userbars.com is down?
+9001
Intermediate TI-nspire Basic Programmer
Programmed some CASIO Basic in the past
DJ_O Music Discographist Wink
Userbars for these coming... in the process

My Released and Announced Projects (Updated 2013/01/29)
TI-nspire BASIC
TI-nspire Hold 'em | Health Bar | Scissors Paper Rock | Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled)

TI-nspire Lua
Numstrat | TI-nspire Hold 'em Lua | Terraria (coming soon)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Spoiler for Other Stuff:
Spoiler for Want your own HonestDownloads userbar?:
Hello! Do you want to show your affection for my website, HonestDownloads? Then here is a userbar I specially created earlier just for HonestDownloads users!

To add it to your signature just copy and paste the code below into your sig and you'll become an instant supporter of my website!

1
[URL=http://www.jhgenius01.webs.com][IMG]http://s1.bild.me/bilder/060112/3684792HDuserbaruser.png[/IMG][/URL]
Spoiler for My TI-nspire Basic Programs (Updated 2012/04/15):
***List of Programs in the TI-nspire Stadium***
Group Release 2012/04/07 on omnimaga.org

Games
   Noteable Release    ticalc.org Release Development/Not Publicly Released
2010/05/08 TI-nspire Hold 'em
   2012/04/07 v1.1.2   2012/04/10 v1.1.3  2012/04/14 v1.2.1
2010/08/03 Cosmic Legions
   2012/04/07 v0.2.2.2 (1st Release)
2010/08/12 Battle of 16s
   2012/04/07 v0.2.7
2010/09/10 Health Bar
   2012/04/07 v1.2     2012/04/02 v1.0   
2010/12/04 sTIck RPG
   2012/04/07 v0.1.5.2
2011/01/09 Monopoly
   2012/04/07 v0.16    (1st Release)
2012/04/09 Scissors Paper Rock
   2012/04/14 v0.8.1

Miscellaneous
2010/11/07 中文 (Chinese) Demonstration
   2012/04/07 v1.3     (1st Release)

Potential/Minor Programs
2010/09/26 Shanghai Metro
   2012/04/07 v0.2     (1st Release)
2010/12/22 TI-nspire Programming Tutorials
   2012/04/07 v0.1     (1st Release)
2010/12/28 Casino Games
   Was not released.
2011/04/22 Interlink
   2012/04/07 v0.0.4   (1st Release)
2012/03/22 Hierarchy
   2012/04/07 v0.01

Demo Programs (some may become Potential Programs)
2010/06/23 Monopoly (Board)
   2012/04/07 Prototype
2010/07/14 Strategy Battle
   2012/04/07 v0.12
2010/10/05 JRPG
   2012/04/07 v0.2
2010/11/02 PlotGrid
   2012/04/07 v0.2
2010/11/24 civilizaTIon™
   2012/04/07 v0.11

Purely Informational
2011/01/05 TI-nspire Stadium Changelog
   2012/04/07 v2
   Created to list significant releases of my programs. A page similar to this List of Programs in the TI-nspire Stadium was included in the documentation of most of my programs until sometime in Late 2011/Early 2012.

All games and programs coded in TI-nspire Basic.
© 2010-2012 Jason Ho.
Last Updated 14 April 2012

jhgenius01.webs.com
Will be moving! Stay tuned for updates.
Spoiler for Progress of Doodle God Axe:
2011/12/21 4% - Progress Suspended, ideas of graphical sprites still uncertain
Spoiler for Other Other You Know What Other Stuff I'm Talking About Stuff Stuff (Updated 2012/01/17):
kindermoumoute
LV8 Addict (Next: 1000)
********
Offline Offline

Last Login: 20 May, 2013, 23:02:59
Date Registered: 15 May, 2010, 17:53:56
Posts: 836


Total Post Ratings: +51

View Profile
« Reply #21 on: 25 February, 2012, 13:30:48 »
0

Damn, is work perfectly ! Cheesy

* kindermoumoute wonder if there is a way to start asm program compatible with shells...
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%
Quigibo
The Executioner
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: 21 May, 2013, 02:03:21
Date Registered: 22 January, 2010, 05:02:37
Location: Los Angeles
Posts: 2022


Total Post Ratings: +1019

View Profile
« Reply #22 on: 28 February, 2012, 09:55:57 »
0

Yeah sorry about that, I've fixed this problem but haven't released the update yet.
Logged

___Axe_Parser___
Today the calculator, tomorrow the world!
chattahippie
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: 27 March, 2013, 05:21:38
Date Registered: 19 July, 2011, 04:13:49
Location: Somewhere
Posts: 358


Total Post Ratings: +27

View Profile
« Reply #23 on: 02 March, 2012, 03:35:30 »
0

I think I found a bug with this... it causes my RAM to steadily decrease
I tried running both programs seperately, took out the "prgmNAME"Asm(E7EF7C4E) command, chose the same options on the menu (except no program was run from it), and no memory was lost Huh?

As you can see in the screenie, nothing was created, yet about 5000 bytes of memory disappeared (15000 at start to 10000 at finish) Sad


* Memory leak.gif (458.64 KB, 192x128 - viewed 103 times.)
Logged
Yeong
Eternally Young Scarlet Moon
LV12 Extreme Poster (Next: 5000)
************
Offline Offline

Gender: Male
Last Login: 20 May, 2013, 01:44:48
Date Registered: 15 October, 2010, 04:29:49
Location: Arden, NC
Posts: 3694


Total Post Ratings: +260

View Profile
« Reply #24 on: 02 March, 2012, 04:10:09 »
0

You can try this:

Type 1 in homescreen, press enter, and check memory again.
Logged

Project Redemption....

My project progresses:HERE
My Pastebin stuffs:HERE
Check your rate: HERE
My Animations: HERE
Spoiler for Images :D:

ノ◕ヮ◕)ノ:・゚ PENGUIN WAVE!!:„ø¤º°¨ ¨°º¤KEEP THE PENGUIN GOING ¸„ø¤º°¨ ¨°º¤øº LETS GO PENGUIN !¤¤º°¨¨°º¤øº¤ø„¸¸ø¤º°¨„ ø¤º°¨¨°º
chattahippie
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: 27 March, 2013, 05:21:38
Date Registered: 19 July, 2011, 04:13:49
Location: Somewhere
Posts: 358


Total Post Ratings: +27

View Profile
« Reply #25 on: 02 March, 2012, 04:16:32 »
0

You can try this:

Type 1 in homescreen, press enter, and check memory again.

Tried that, it doesn't fix it
Still about 2000-2500 bytes lost per run Sad
Logged
DrDnar
LV6 Super Member (Next: 500)
******
Offline Offline

Last Login: Today at 00:54:23
Date Registered: 29 October, 2010, 00:08:46
Posts: 460

Total Post Ratings: +76

View Profile
« Reply #26 on: 03 March, 2012, 07:18:29 »
0

How are you quitting from the second program? It looks like the subprogram is quitting in a manner that prevents the memory being used by the caller from being freed.
Logged

"The tools which would teach men their own use would be beyond price."—The Republic
DrDnar
LV6 Super Member (Next: 500)
******
Offline Offline

Last Login: Today at 00:54:23
Date Registered: 29 October, 2010, 00:08:46
Posts: 460

Total Post Ratings: +76

View Profile
« Reply #27 on: 03 March, 2012, 23:29:36 »
+2

Update: I blame thepenguin77's for this one. Looking at the disassembly of _ExecutePrgm, it's clear that the OS does not save the value in 89ECh (a.k.a. asm_prgm_size) before modifying it, so it turns out that the memory used by the caller will never be properly freed, unless you save it yourself. Fortunately, that's easy to do, so here's the new version:

1
"prgmNAME"Asm(E72AEC89E5EF7C4EE122EC89
Edit: calc84maniac suggested rearranging the assembly instruction sequence to make it less ugly, though no smaller or faster.

So, once again, keep these points in mind:
  • Just like running programs with the Asm( token from the homescreen, you need a quantity of free RAM equal to the size of the program being run.
  • Because the OS has to shuffle RAM around for this to work, it takes a split second for the new program to start. So if you do this a lot, it'll be really slow.
  • If you call yourself like this, the OS will make yet another copy of yourself. Duh.
  • Instant quit will return control to the calling program, not the homescreen or the shell. This is because the error handlers get nested. (The good news is that if the calling program throws an OS error, control is returned to the calling program, but I don't believe any Axe programs use error handlers.)
  • WARNING: This code will leak memory if the program throws an error! To prevent this, use the Axiom for running programs.
  • By extension, do not call a shell's instant quit routine, or the memory used by caller won't get freed.
  • Assuming Axe just makes a stub ISR that jumps to the real ISR, you're going to get a crash if you have an interrupt running and you try this, because your ISR just got moved.
  • L1 through L6 will not be modified by the OS, neither during calling nor returning. The OP registers, however, will be corrupted.


OS Disassembly:

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
OS 2.55MP _ExecutePrgm disassembly
07:5758:
ld a, 03h
call 3891h
ld a, 38h
jp nz, 2793h
call 178Bh
ex de, hl
ld c, (hl)
inc hl
ld b, (hl)
inc hl
ld a, (hl)
cp 0BBh
jp nz, 2729h
inc hl
ld a, (hl)
cp 6Dh
jr nz, 57D4h
inc hl
push hl
push bc
pop de
push de
ld hl, 2000h
or a
sbc hl, de
jp c, 2729h
ex de, hl
call 1735h
pop hl
push hl
ld de, 9D95h
call 0F81h
pop hl
ld (89ECh), hl
pop hl
ld de, 9D95h
ld bc, (89ECh)
add hl, bc
ldir
579Fh: call 1837h
jr nz, 57AEh
in a, (20)
push af
bit 5, (iy+24h)
call 0DCBh
57AEh: ld hl, 5800h
call 27DAh
call 57FDh
call 2800h
call 1837h
jr nz, 57C4h
pop af
and 01
out (20), a
57C4h: ld de, (89ECh)
ld hl, 0000h
ld (89ECh), hl
ld hl, 9D95h
jp 1368h
57D4h: rst 18h ;rPUSHREALO1
call 5717h
ld hl, 2000h
or a
sbc hl, de
jp c, 2729h
ex de, hl
push hl
call 1735h
pop hl
push hl
ld de, 9D95h
call 0F81h
pop hl
ld (89ECh), hl
call 150Fh
ld de, 9D95h
call 5734h
jr 579Fh
57FDh: jp 9D95h
5800h: call 1837h
jr nz, 580Ah
pop af
and 01
out (20), a
580Ah: ld de, (89ECh)
ld hl, 0000h
ld (89ECh), hl
ld hl, 9D95h
call 1368h
jp 2799h
« Last Edit: 06 March, 2012, 09:57:39 by DrDnar » Logged

"The tools which would teach men their own use would be beyond price."—The Republic
Pages: 1 [2]   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.296 seconds with 31 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.