6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Mon May 13, 2024 11:01 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: 16 bit variables
PostPosted: Wed Dec 17, 2003 7:37 pm 
Offline

Joined: Wed Dec 10, 2003 12:23 pm
Posts: 4
How can i set a 16 bit variable.I have a problem i cant use numbers>255.
How can i solve this?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Dec 17, 2003 8:27 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8433
Location: Southern California
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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Dec 19, 2003 12:16 pm 
Offline

Joined: Thu Jan 16, 2003 12:55 pm
Posts: 64
Location: Indianapolis
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:

Code:
something = $D080

lda #<something
sta lo_byte
lda #>something
sta hi_byte


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: janrinze and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: