Author Topic: Axe Parser  (Read 555216 times)

0 Members and 2 Guests are viewing this topic.

Offline DrDnar

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 546
  • Rating: +97/-1
    • View Profile
Re: Axe Parser
« Reply #1950 on: September 01, 2011, 01:37:16 pm »
You'd need a way to load parameters into registers before executing the call for shell routines. And I'm all for adding such a syntax into Axe. Axe has filled a void between assembly and basic that's hopefully helping people achieve more. Adding support for external routines would just be a natural way for Axe to integrate more fully into the OS and shells.

Also, a BCALL address isn't actually an address in the linear address; it's an index into an LUT that points to the real address of the routine. Consequently, the normal syntax for calling BCALLs wouldn't be applicable. (They're also typically encoded as a pseudo-instruction using an RST routine, so again, the normal calling syntax wouldn't be applicable.)

EDIT: Ninja'd.
« Last Edit: September 01, 2011, 01:37:59 pm by DrDnar »
"No tools will make a man a skilled workman, or master of defense, nor be of any use to him who has not learned how to handle them, and has never bestowed any attention upon them. . . . Yes, [] the tools which would teach men their own use would be beyond price."—Plato's The Republic, circa 380 BC

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Axe Parser
« Reply #1951 on: September 01, 2011, 01:54:19 pm »
There is a subtle difference between (LFoo)() and Foo().  First of all, the second is more optimized, but more importantly, the 2nd one has the last expression in the accumulator whereas the first has LFoo.  If Foo was like this:

Code: [Select]
:Lbl Foo
:+1->B
:Disp B>Dec
:Return

Then calling 5Foo() will print 6, but calling 5(LFoo)() will display the pointer of Foo plus one.  Even when there's arguments, it will still keep the pointer in the accumulator when called that way.

There are only a handful of OS calls in the early address space.  Most of these are either useless to game making or already implemented by Axe.  Anyway, you wouldn't ever want to call them in an ugly way like that.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #1952 on: September 01, 2011, 02:04:36 pm »
Quigibo, perhaps that could be changed? You could change the arbitrary address calling routine to this:

Code: [Select]
p_CallHL:
.db 6
pop ix
ex (sp),ix
jp (ix)

At the cost of 3 bytes for the entire program and only 12 cycles per use, you could pass arguments directly to arbitrary functions. I pass arguments in hl to functions all the time, so this would actually save bytes. That, combined with the fact that it would result in more uniform code effects, makes me believe that this would be a nice change.
« Last Edit: September 01, 2011, 02:10:05 pm by Runer112 »

Offline Compynerd255

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +53/-4
  • Betafreak Games
    • View Profile
    • Betafreak Games
Re: Axe Parser
« Reply #1953 on: September 01, 2011, 03:39:21 pm »
One thing I do realize about all of this is that if we're going to let people call ASM Shell routines, we need a way to check if the program is being compiled in a shell, so that we don't accidentally compile for the wrong shell when we need one. Maybe a reserved constant combined with #If could do this.
The Slime: On Hold, preparing to add dynamic tiles

Axe Eitrix: DONE

Betafreak Games: Fun filled games for XBox and PC. Check it out at http://www.betafreak.com



Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Axe Parser
« Reply #1954 on: September 01, 2011, 05:23:53 pm »
That's a good idea Runer, I think I'll make that change.

Shell calls are for the most part useless.  Axe's routines are faster, more optimized and even smaller despite the fact that the actual routines are in the program itself due to the amount of extra register parameter juggling each call to the routine would have to include.  The only time I could see this being useful is for calling code that is shell specific, like the DCS GUI functions.  And even then, its much better to make shell calls Axioms because:

  • It can automatically choose the right routine based on the shell compiling for.
  • It adds an input-output layer above the assembly for Axe compatibility.
  • You don't have to memorize weird hex values or use asm in the source.
« Last Edit: September 02, 2011, 05:19:52 am by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Axe Parser
« Reply #1955 on: September 01, 2011, 05:52:11 pm »
Whee no weird hex values!
So, would Runer's idea give us, in essence, another (albeit volatile) variable?
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Axe Parser
« Reply #1956 on: September 01, 2011, 09:57:41 pm »
Not exactly. We can already use HL for optimization and other things. (e.g. Pxl-On(0,,Pic0) vs Pxl-On(0,0,Pic0))
His proposed change would keep HL intact across a variable call.
Runer etc.: I take it that this extends also to such as (R*3+LA)()? (call via a jump table)
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Axe Parser
« Reply #1957 on: September 02, 2011, 12:25:28 am »
Um, so what would that mean? Will simply putting in a var name no longer load that var into HL?
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline ralphdspam

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 841
  • Rating: +38/-1
  • My name is actually Matt.
    • View Profile
Re: Axe Parser
« Reply #1958 on: September 02, 2011, 02:19:59 am »
No, I think he is saying that hl will remain intact as you return from the subroutine. 
ld a, 0
ld a, a

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Axe Parser
« Reply #1959 on: September 02, 2011, 05:51:52 pm »
No, I think he is saying that hl will remain intact as you call the subroutine. 
Fixed that for ya ;D
Edit: 2^11th post!
« Last Edit: September 02, 2011, 05:52:24 pm by calcdude84se »
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Ashbad

  • Guest
Re: Axe Parser
« Reply #1960 on: September 02, 2011, 05:53:32 pm »
No, I think he is saying that hl will remain intact as you return from the subroutine. 

Essentially, it'll push HL before the calling address parenthesis are parsed, and then poped so it can be used within the subroutine with it's initial value.

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Axe Parser
« Reply #1961 on: September 02, 2011, 08:34:04 pm »
so, I could do

If FOO
sub(FOO)
End
Lbl FOO
->BAR

And BAR would now equal FOO?
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Axe Parser
« Reply #1962 on: September 02, 2011, 08:53:28 pm »
We weren't talking about sub( ;)
A(LB)()
Lbl B
Disp >Dec
Return

Currently, this will display the address of Lbl B. The proposed change will make it display A instead, which is much more useful
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Axe Parser
« Reply #1963 on: September 25, 2011, 02:20:55 am »
I could not replicate the "Bad Flash" bug no matter what I did or how hard I tried, but I did change it to an unknown error which can tell me more useful information about where the error occurred if you can post the error code.

I also could not replicate the random 'r' bug, but I did change around the string reading routine a little bit so that might fix it, although I don't have hope it will.

I suspect that both of these errors are related to other apps you have installed since I am not able to reproduce it on a clean calculator.  DCS, zStart, and Omnicalc in particular create a ton of hooks and are the highest on my possibility list, but please tell me ALL of the apps you have installed when reporting one of these 2 bugs.

By the way, any major or minor bugs found in the next 24 hours I can patch up by Sunday.  But after that, I won't have a lot of time for a while.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Axe Parser
« Reply #1964 on: September 25, 2011, 03:12:21 am »
Bad flash errors usually occur for me after a ram clear, or a particularly glitchy program ran its course.
In-progress: Graviter (...)