News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Kitsune Mifune

Question about user variables

Started by Kitsune Mifune, 13:26, 22 October 19

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Kitsune Mifune

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!

SRS

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



Kitsune Mifune

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!

SRS


Powered by SMFPacks Menu Editor Mod