Shift in pasm i got lost
Anubispod
Posts: 42
Hi , i need some help ???
i have a word declared in pasm what reads in the value from a buffer what alternates
the 1 value is 35828 dec 1000_1011_1111_0100 bin
the 2 value is 3060 dec 0000_1011_1111_0100 bin
now where im stuck i need to decode that
from right to left
0-10 are the value 11-14 are the ch number and 15 tells me if it is a repeat frame
rdword decode,t4
mov ch,decode
shl ch,#1
shr ch,#12
wrword ch,t4
now it should schow me 1 in the app but it shows 1 and 17 ???? alternating
Mhh i thought it should kill the bit 15 and then move it over to to the right to get only the chanel number
i have a word declared in pasm what reads in the value from a buffer what alternates
the 1 value is 35828 dec 1000_1011_1111_0100 bin
the 2 value is 3060 dec 0000_1011_1111_0100 bin
now where im stuck i need to decode that
from right to left
0-10 are the value 11-14 are the ch number and 15 tells me if it is a repeat frame
rdword decode,t4
mov ch,decode
shl ch,#1
shr ch,#12
wrword ch,t4
now it should schow me 1 in the app but it shows 1 and 17 ???? alternating
Mhh i thought it should kill the bit 15 and then move it over to to the right to get only the chanel number
Comments
does the same as shr ch, #11
What did you try to do doing this shl? Get rid of bit 15? If so, the Propeller is 32 bit and you should try
then you will have bits 11..14 in sh, the rest will be lost.
i have now a other little problem or question
how would i get now my pointer increased by the channel number i hold in a long not res
i have t4 what points to the start of my array,
then i have my channel number 0-11 in a long
when i try some thing like
add t4,ch*2
does not work ???
-Phil
A res is a long, using it just saves some hub ram.