CPCWiki forum

General Category => Programming => Topic started by: Kitsune Mifune on 13:26, 22 October 19

Title: Question about user variables
Post by: Kitsune Mifune on 13: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!
Title: Re: Question about user variables
Post by: SRS on 19: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


Title: Re: Question about user variables
Post by: Kitsune Mifune on 20: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:
Title: Re: Question about user variables
Post by: SRS on 18:25, 24 October 19
GameMaker ? There is a Game Maker for CPC, to :)
https://jonathan-cauldwell.itch.io/multi-platform-arcade-game-designer
Powered by SMFPacks Menu Editor Mod