Author Topic: Using OP variable  (Read 2248 times)

0 Members and 1 Guest are viewing this topic.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 906
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Using OP variable
« on: May 05, 2011, 10:10:37 am »
In my study of z80, I saw that there are floating point variables (Op1,Op2,Op3...). Where are these located in Axe? Is that the float command? And can someone post an example of how to use it?

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: Using OP variable
« Reply #1 on: May 05, 2011, 03:04:37 pm »
Those aren't used in Axe as variables because they are too volatile and get overridden constantly (especially OP1 and OP2) by OS routines.  Axe also uses some of that memory internally to manage grayscale during interrupts.
« Last Edit: May 05, 2011, 03:05:15 pm by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Using OP variable
« Reply #2 on: May 05, 2011, 03:34:43 pm »
It also might be worthy to note that they are in fact *not* variables, but just locations in memory the OS uses to do specific operations.  They can be used for much more than just floating point arithmetic.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 906
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Using OP variable
« Reply #3 on: May 05, 2011, 03:59:58 pm »
Ok. Understood. I am making a chem program in Axe, so I just wanted to use a float as the final resting spot for an answer to a problem (since chem requires decimals). I won't be holding data long term or anything like that.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Using OP variable
« Reply #4 on: May 05, 2011, 04:09:09 pm »
Any particular reason you are going with Axe?  Basic actually far outweighs Axe in the area of advanced floating point math, as in Axe you would have to use pretty much all custom hex codes to work with floating point numbers, as well as any operations on them.  What kind of program is it?

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 906
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Using OP variable
« Reply #5 on: May 05, 2011, 04:11:19 pm »
What do you mean by 'kind of program'. It's a chem suite. it does molar masses, balancing equations, lewis structures, and electron configurations.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Using OP variable
« Reply #6 on: May 05, 2011, 04:19:54 pm »
Ah gotcha, in that case I myself would recommend Basic over Axe, on account of its easy to use floating point arithmetic, and its simple input features.  In axe, you would end up having to rewrite almost every routine, or write hex to access the built in OS ones, while in basic everything is already set up.


Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 906
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Using OP variable
« Reply #7 on: May 05, 2011, 04:42:14 pm »
I'll see what I can do. Is there a way to create and read/write appvars in basic, with no external routines/apps needed (I would use inline assembly if possible, but I want to avoid that route if it requires an external var). That's why I wanted to use Axe (or even assembly). I want the program to be completely functional on its own.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Using OP variable
« Reply #8 on: May 05, 2011, 05:29:05 pm »
There is no way to write to appvars, but you can create and name your own lists, where you can store large amounts of data.  Why do you need Appvars for a chemistry program?

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 906
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Using OP variable
« Reply #9 on: May 05, 2011, 05:46:53 pm »
To hold both text (different inputs to accept for elements, that equate to the same actual element) and numbers (lists hold only numbers).

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Using OP variable
« Reply #10 on: May 05, 2011, 05:51:17 pm »
Couldn't you use a String then? Just push the previous contents of the string into one of the almost never used polar equation variables and restore it when you're done.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 906
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Using OP variable
« Reply #11 on: May 05, 2011, 06:26:54 pm »
Hmmm. I guess. I'm thinking of just doing this whole project in straight z80.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Using OP variable
« Reply #12 on: May 05, 2011, 07:29:20 pm »
Wait do you want to make this in Axe or z80 asm? 

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 906
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Using OP variable
« Reply #13 on: May 05, 2011, 09:21:19 pm »
I wanted to do it in Axe, but z80 might be easier. I have to see.

Offline ralphdspam

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 841
  • Rating: +38/-1
  • My name is actually Matt.
    • View Profile
Re: Using OP variable
« Reply #14 on: May 05, 2011, 10:04:38 pm »
OP1 = {8478E}
OP2 = {8483E}
OP3 = {848EE}
OP4 = {8499E}
OP5 = {84A4E}
OP6 = {84AFE}

So you load/store the FP number to these locations in ram.  Since they're just addresses, you can just make your own arbitrary FP variables in the Lx locations in Axe.  ;)

Yeah, I think Z80 is easier for your math program.
« Last Edit: May 05, 2011, 10:08:10 pm by ralphdspam »
ld a, 0
ld a, a