Author Topic: Axe Parser  (Read 565432 times)

0 Members and 4 Guests are viewing this topic.

SirCmpwn

  • Guest
Re: Axe Parser
« Reply #1260 on: September 27, 2010, 10:39:17 pm »
Recursive subroutines FTW

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Axe Parser
« Reply #1261 on: September 27, 2010, 10:45:42 pm »
Recursive subroutines FTW
Agreed.  This will help Blox like nothing else. ;D

SirCmpwn

  • Guest
Re: Axe Parser
« Reply #1262 on: September 27, 2010, 10:47:01 pm »
Advance Wars as well.  And HL2.  And pretty much everything.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #1263 on: September 27, 2010, 10:51:23 pm »
I am still unsure what are recursive sub-routines for, but I would need someone who is more visual to explain it to me, otherwise it won't work just with code x.x. I will probably stay away from those personally.

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Axe Parser
« Reply #1264 on: September 27, 2010, 10:53:56 pm »
Direct Nibble manipulation!
DispGraphrr can be used in an interrupt routine now.
Optimized Copy() Fill() and Exch() commands.

each of these will be incredibly helpful in the projects im working on right now. thank you SO much!

SirCmpwn

  • Guest
Re: Axe Parser
« Reply #1265 on: September 27, 2010, 10:54:33 pm »
Here you go:
You call subroutine AB with sub(AB,0
0 is stored to R1.  AB is called.
Within AB, you call subroutine CD with sub(CD,1
1 is stored to R1.  CD is called.
CD executes and returns to AB.  R1 still equals 1, though it should equal 0.

Recursive subroutines fix this.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Axe Parser
« Reply #1266 on: September 27, 2010, 11:00:57 pm »
I am still unsure what are recursive sub-routines for, but I would need someone who is more visual to explain it to me, otherwise it won't work just with code x.x. I will probably stay away from those personally.

Here is an example of a factorial routine using recursion:
Quote
:Lbl FCT
:!If r1
:1
:Return
:End
:sub(FCTr,r1-1)*r1
:Return

I think that should work. But factorial routine isn't very optimized this way. Kinda cool anyway, though :P
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #1267 on: September 27, 2010, 11:21:06 pm »
Ah ok, I see. I assume this is like the following BASIC program

PROGRAM:A
prgmA

but minus the memory leak? Isn't it very hard to exit, though?

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Axe Parser
« Reply #1268 on: September 27, 2010, 11:26:02 pm »
It's the !If r1:1:Return:End that allows it to return (so it doesn't continue the recursion once it is called with r1=0)
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #1269 on: September 27, 2010, 11:26:44 pm »
Mhmm ok. I guess I'll have to experiment later x.x

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Axe Parser
« Reply #1270 on: September 27, 2010, 11:29:46 pm »
Just be careful not to let it recurse too many times, cause the stack could overflow, causing corruption :O
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #1271 on: September 27, 2010, 11:30:36 pm »
yeah my concern was also the stack. It seems a bit confusing to deal with, though, anyway x.x

I wonder in which kind of game it would be necessary?

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Axe Parser
« Reply #1272 on: September 27, 2010, 11:32:54 pm »
I remember writing a Minesweeper game in TI-Basic, and I used a list for a "stack" when flood-filling. I guess it could apply to algorithms like that in Axe, too.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #1273 on: September 27, 2010, 11:33:35 pm »
Ah ok. Would it be particulary necessary in a strategy game or RPG with fog of war like the Joltima RPG?

SirCmpwn

  • Guest
Re: Axe Parser
« Reply #1274 on: September 27, 2010, 11:41:39 pm »
It would be useful for calling subroutines within subroutines, which has many applications.