can't load a value into regsister A

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

can't load a value into regsister A

cyboman
as far as i understand register A is 16 bits wide, meaning i should be able to load a value of 65535 (2^16 - 1, i.e @65535) into it. however for some reason if i try to load any value larger than 32767 (2^15 - 1, i.e @32767) assembler automatically transforms it into 16. because of this whenever i try to blacken the screen i get the stripes on the screen. the image of my screen is attached to this post. has anyone encountered this problem and how did you solve it? any help is appreciated.stripes on the screen
Reply | Threaded
Open this post in threaded view
|

Re: can't load a value into regsister A

cadet1620
Administrator
The value for @ instructions can only be unsigned numbers in the range 0 to 32767. The reason is that @ instructions are encoded as 0nnn nnnn nnnn nnnn so there are only 15 bits available for the value. The easiest way to get 65535 into a register is the C-instruction reg=-1.

(FWIW, I think that the assembler is interpreting the out of range value as a symbol name and assigning it the first available RAM address.)

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: can't load a value into regsister A

cyboman
thanks. it worked.