How can i set a 16 bit variable.I have a problem i cant use numbers>255.
How can i solve this?
16 bit variables
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
From the little you wrote, it sounds like your question has more to do with assemblers, so the answer will depend on the particular assembler. With the 2500AD assembler, the BLKB (meaning "block of bytes", or something like that) directive leaves that many addresses. Of course you can specify any number of bytes for an array or whatever.
LABEL1: BLKB 2 ; This gives you a two-byte variable named "LABEL1"
LABEL2: BLKB 8 ; This gives you an 8-byte variable named "LABEL2"
With the Cross-32 assembler from Universal Cross-Assemblers, you'd use DFS (meaning "define data storage space")
LABEL1: DFS 2
LABEL2: DFS 8
For the examples above, suppose you were at address $890. LABEL1 would give you a 2-byte variable using $890 and $891. LABEL2 would give you an 8-byte variable starting at $892 and going to $899, so the next thing to be put down would go into $89A.
You'll need to check the manual for your particular assembler.
LABEL1: BLKB 2 ; This gives you a two-byte variable named "LABEL1"
LABEL2: BLKB 8 ; This gives you an 8-byte variable named "LABEL2"
With the Cross-32 assembler from Universal Cross-Assemblers, you'd use DFS (meaning "define data storage space")
LABEL1: DFS 2
LABEL2: DFS 8
For the examples above, suppose you were at address $890. LABEL1 would give you a 2-byte variable using $890 and $891. LABEL2 would give you an 8-byte variable starting at $892 and going to $899, so the next thing to be put down would go into $89A.
You'll need to check the manual for your particular assembler.
Do it 8 bits at a time. Like Garth said, you'll need to check your assembler's manual to know how to do it exactly.
With most assemblers I've used (TASM was different), you can do something like this:
With most assemblers I've used (TASM was different), you can do something like this:
Code: Select all
something = $D080
lda #<something
sta lo_byte
lda #>something
sta hi_byte