Author Topic: Axe Parser  (Read 554429 times)

0 Members and 4 Guests are viewing this topic.

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 #1350 on: October 15, 2010, 03:27:29 am »
I assume this variable would be a bit like Ans, right?

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #1351 on: October 15, 2010, 04:29:20 am »
I assume this variable would be a bit like Ans, right?

It wouldn't be like Ans that much, but I guess I see how it could be a bit similar. Pretty much all loading and numerical operations put the result in the hl register, so hl is more like the Ans of Axe. The point of this is having something like a backup Ans that only takes one-byte instructions to load from and store to, as opposed to three-byte instructions with data in RAM. Any use of this would have to be simple and small, as just about any routine or math call would overwrite its value
« Last Edit: October 15, 2010, 01:30:39 pm by Runer112 »

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 #1352 on: October 15, 2010, 05:12:50 am »
AH ok I see. That could be pretty handy :D

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Axe Parser
« Reply #1353 on: October 15, 2010, 05:05:12 pm »
That's a great idea! Why ex, though? Wouldn't that mean we wouldn't be able to do
Code: (Axe) [Select]
:A->pi->B
?




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 #1354 on: October 15, 2010, 07:15:06 pm »
The ex command is only 1 byte whereas loading a 16 bit register is 2 bytes.  And that statement could still be done like this:

Code: [Select]
:A->B->pi
« Last Edit: October 15, 2010, 07:15:19 pm by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

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 #1355 on: October 15, 2010, 07:36:31 pm »
Aha, I've been wanting this feature for a while, but I thought it might be too much trouble. It would help for interfacing with Asm(), I'm sure :)
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Axe Parser
« Reply #1356 on: October 15, 2010, 07:37:43 pm »
The ex command is only 1 byte whereas loading a 16 bit register is 2 bytes.  And that statement could still be done like this:

Code: [Select]
:A->B->pi

Oh, okay. Make sure that's in the docu, though :)




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 #1357 on: October 15, 2010, 08:06:20 pm »
Aha, I've been wanting this feature for a while, but I thought it might be too much trouble. It would help for interfacing with Asm(), I'm sure :)
Agreed. Perhaps use another token to represent bc, "!" perhaps? It wouldn't be as optimized, because you have to use "ld b,h \ ld c,l" rather than "ex de,hl", but it would definitely help in interfacing with assembly and using bcalls. (Also, any possibility of using a?)
When you make these things official, commands will start having to have a "destroyed" field in the documentation ;D
"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 Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Axe Parser
« Reply #1358 on: October 15, 2010, 08:45:41 pm »
Definitely not !. That's not(, remember.

Maybe ??




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 #1359 on: October 15, 2010, 08:48:53 pm »
Perhaps. But realize that "!" is only used right before "If ". It could get another use ;)
I think "!" and "?" could work for bc and a, in either order.
"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 Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Axe Parser
« Reply #1360 on: October 15, 2010, 08:55:50 pm »
Perhaps. But realize that "!" is only used right before "If ". It could get another use ;)

For a moment there I thought If !(A=2) was allowed as well ... whoops.

But people might still be confused. What about using de for DE, bc for BC, and a for A? Lowercase letters aren't used except in strings, anyway. Except for bBINARY...
« Last Edit: October 15, 2010, 08:56:23 pm by Deep Thought »




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 #1361 on: October 15, 2010, 08:59:30 pm »
That's 4, 4, and 2 bytes for what could be 1... x.x
"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 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 #1362 on: October 15, 2010, 11:09:07 pm »
Okay, here are my thoughts on using the DE register.

pi and ->pi should be a two-byte load or store. A different method or token should be used for the one-byte swap. This will let it be treated like any other variable, without strange side effects that need to be learned. I know I would miss being able to directly load/store (such as if I want to use DE as a pointer, like {pi+1->pi})

Also, it may be a good idea to change as many operations as possible to trash BC instead of DE to make the pi variable less volatile. If there are any operations that need the ex de,hl to optimize, just ask if you need help optimizing the BC version. For example, the > and <= operations can be done without a swap by setting the carry flag before the sbc instruction.

Finally, a feature request for a /^ operator that returns the quotient and the remainder at the same time.

Edit:
Also, I assume that operators working on pi will be optimized. For example, +pi should compile to one byte of code (add hl,de)
« Last Edit: October 16, 2010, 12:31:11 am by calc84maniac »
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Axe Parser
« Reply #1363 on: October 16, 2010, 06:18:10 pm »
just found something cool. if you *really* don't have any temp variables to exchange two values, the following code should do the trick:

Code: [Select]
. "xor" is the 16 bit plotstyle-box xor, not the actual word xor.
A xor B->A
A xor B->B
A xor B->A




Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #1364 on: October 16, 2010, 06:23:06 pm »
just found something cool. if you *really* don't have any temp variables to exchange two values, the following code should do the trick:

Code: [Select]
. "xor" is the 16 bit plotstyle-box xor, not the actual word xor.
A xor B->A
A xor B->B
A xor B->A




Woah, that's a neat trick! I never thought of that. But you could optimize it a bit :P

Code: [Select]
A xor B->A xor B->B xor A->A
« Last Edit: October 16, 2010, 06:24:25 pm by Runer112 »