3

I'm trying to create a simple variable containing the hex value 0xffff. I've been able to do it as a macro with SET, but I haven't been able to get it working with something like ld _time,$ffff. How do I load a value into _time?

  • 2
    When you ask questions about assembly language programming you should specify which assembler you're using, because they differ in syntax. I'm going to guess that you're using RGBAsm. Note that `_time SET $ff` isn't really declaring a variable in the traditional sense - you're telling the assembler to replace all occurrences of `_time` with `$ff`. For a variable declaration you would use something like `DB`/`DW`/`DS`. – Michael Aug 26 '16 at 09:27

1 Answers1

1

My problem was I wasn't initializing _time. The following worked:

_time SET $ff
ld hl, $ffff
ld (_time),hl