Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/19/01 17:26
Read: times


 
#14217 - converting variable types
Hello!

Can anybody tell me how to solve this problem (probably just some sytax stuff):

I need to calculate address (unsigned int 0 – 511) from a given (unsigned char 0-19) channel. I have a line: address = (channel * 25) + 22, where address is configured as unsigned int, and channel as unsigned char.

Problem occurs, when address>256.

Assembled segment:

MOV A,channel
MOV B,#019H
MUL AB
ADD A,#0CH
MOV aa,#00H
MOV aa+01H,A
.
.

I see problem is in line 3, since this is 8-bit multiplication. What syntax should I use to get 16bit multiplication and correct results?

As first aid I used /address=1000+(channel*25)+22; address=address-1000;/ but I am sure it can be done in nicer way.


Thanks for replies, Damjan



List of 13 messages in thread
TopicAuthorDate
converting variable types            01/01/70 00:00      
RE: converting variable types            01/01/70 00:00      
RE: converting variable types            01/01/70 00:00      
RE: converting variable types            01/01/70 00:00      
RE: converting variable types            01/01/70 00:00      
RE: converting variable types            01/01/70 00:00      
RE: converting variable types            01/01/70 00:00      
RE: converting variable types            01/01/70 00:00      
RE: converting variable types            01/01/70 00:00      
RE: converting variable types            01/01/70 00:00      
RE: converting variable types            01/01/70 00:00      
RE: Andy            01/01/70 00:00      
RE: converting variable types            01/01/70 00:00      

Back to Subject List