Author Topic: Accessing registers  (Read 2714 times)

0 Members and 1 Guest are viewing this topic.

Offline Vijfhoek

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 120
  • Rating: +13/-1
    • View Profile
Accessing registers
« on: October 20, 2012, 09:28:26 am »
Hello World,

I've been messing around with Axe for like a week now, and I am just getting into subroutines. So, I read that parameters get stored in r1 through r16. I have no idea how to access those though. I tried to find an answer on both Google and by using the search function of this site, without any outcome. Of course I can store the values in A through Z prior to calling the subroutine, but don't those use RAM memory?

I hope someone can help me out.
« Last Edit: October 20, 2012, 09:30:08 am by Vijfhoek »

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Accessing registers
« Reply #1 on: October 20, 2012, 09:34:41 am »
Press Vars, Left, 3 to access r1 to r6 ;)

Of course I can store the values in A through Z prior to calling the subroutine, but don't those use RAM memory?
What do you mean by use RAM memory ? Every variable uses 2 bytes of RAM memory, and r1 to r6 are variables too :)

Also, welcome to the forums, feel free to introduce yourself :)
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Vijfhoek

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 120
  • Rating: +13/-1
    • View Profile
Re: Accessing registers
« Reply #2 on: October 20, 2012, 09:36:11 am »
Aren't registers part of the Z80 itself?

But, thanks for your answer :)
« Last Edit: October 20, 2012, 09:42:27 am by Vijfhoek »

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: Re: Accessing registers
« Reply #3 on: October 20, 2012, 09:57:53 am »
Some processors indeed have r1 to r16 registers in asm, but those doesn't exist in z80. r1 to r6 in Axe are pretty much unrelated and are simple variables like A to Z, used to pass parameters to subroutines.

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Accessing registers
« Reply #4 on: October 20, 2012, 12:30:30 pm »
^What he said. You cannot even access registers directly in axe (although many routines use them). The "r" tokens are used in BASIC for graphing.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Accessing registers
« Reply #5 on: October 20, 2012, 02:54:34 pm »
You cannot even access registers directly in axe
Since the Asm() command allows you to use native hex code, you can do everything you want in Axe :P
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s