Author Topic: Constants in an Axiom  (Read 12554 times)

0 Members and 2 Guests are viewing this topic.

Offline Compynerd255

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +53/-4
  • Betafreak Games
    • View Profile
    • Betafreak Games
Constants in an Axiom
« on: April 11, 2011, 04:22:46 pm »
I'm working on a simple CALCnet axiom (I'm not really an ASM programmer, but all CALCnet needs is four subroutines and a few memory pointers). Because CALCnet relies so much on pointers, how do you define a constant in Axe, like how L1-L6 function?
Can I just define the constant as a replacement routine,
Code: [Select]
$8800
or do I need to define all of the things you can do with the constant (load, add, subtract, multiply, divide...)?
Code: [Select]
ld hl, $8800
...
add hl, $8800
...
sub hl, $8800
...
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 Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Constants in an Axiom
« Reply #1 on: April 11, 2011, 04:30:01 pm »
You can define a token to be an immediate value load by making the full code ld hl,constant, but that's about as close as you're going to get to constants. When used in an expression it won't have any special constant optimizations, it will just be treated like a value in parentheses.

Offline Compynerd255

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +53/-4
  • Betafreak Games
    • View Profile
    • Betafreak Games
Re: Constants in an Axiom
« Reply #2 on: April 11, 2011, 05:38:16 pm »
You can define a token to be an immediate value load by making the full code ld hl,constant, but that's about as close as you're going to get to constants. When used in an expression it won't have any special constant optimizations, it will just be treated like a value in parentheses.
Phew... I was afraid that I'd have to write in all of the constant expressions. However, all I would really need to write in is load and add, since that's all you're going to use a pointer for.
CALCnet Axiom, here I come.
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