Author Topic: Question about user variables  (Read 273 times)

0 Members and 1 Guest are viewing this topic.

Offline Kitsune Mifune

  • CPC464
  • **
  • Posts: 18
  • Country: scotland
  • On a retro game making bucket list
  • Liked: 7
  • Likes Given: 3
Question about user variables
« on: 15:26, 22 October 19 »
I think I'm using user variables wrong in Winape Assembler, but would just like to get a confirmation.

I've just been setting up my own variables by using the EQU directive and setting it to '0' as an empty container to be loaded and cleared when needed during the code, so I'd do something like:

SPRITE_HEIGHT EQU 0

Now I'm using it in the code with brackets which I know sends the value to the memory location pointed at by the label, so should I be assigning actual bits of memory to them when initialising instead of just saying it equals '0'?

Like:

SPRITE_HEIGHT  dw &0001
SPRITE_WIDTH   dw &0002
etc.
etc.

As always, thanks for any advice!
Unlocking the dark arts of assembly!

Offline SRS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 562
  • Country: de
  • Schneider CPC464 - what else ?
  • Liked: 547
  • Likes Given: 289
Re: Question about user variables
« Reply #1 on: 21:35, 22 October 19 »
I think of EQU like a CONST in C and "db" like VARIABLE int8 :)
You get a good grip of that here: https://www.chibiakumas.com/z80/index.php#Lesson2



Offline Kitsune Mifune

  • CPC464
  • **
  • Posts: 18
  • Country: scotland
  • On a retro game making bucket list
  • Liked: 7
  • Likes Given: 3
Re: Question about user variables
« Reply #2 on: 22:33, 22 October 19 »
Thanks for the reply.

Yep, that's kind of what I was thinking. I was getting some odd results by just setting everything to EQU n as the values weren't changing.

My brain is probably still thinking in Game Maker GML terms.  :picard:
Unlocking the dark arts of assembly!

Offline SRS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 562
  • Country: de
  • Schneider CPC464 - what else ?
  • Liked: 547
  • Likes Given: 289
Re: Question about user variables
« Reply #3 on: 20:25, 24 October 19 »