Assembly question
S1976
Posts: 6
Hi all,
first a "hello" to you all, i´m Stefan from Germany, 33yrs old.
I have difficulties to understand some things what´s going on on the Propeller using Assembly language. I am a former (good) AVR Assembly programmer and i want to avoid (cause of speed issues) using only SPIN. For example, i understand what is DIRA (=DDR# on the AVR) and outa (=out port# on the AVR), but are on the Propeller these two I/O-Ports 32 bits long and how to access them correctly/directly? I guess, when i do a mov dira,#XX or mov outa,#xx it sets a Value into the registers, but that ends up in nothing, it sets something, sometimes all ports, sometimes nothing, sometimes half of them, but with each increment. Now somewhere i read that i should perform a logical shift with the output register and a mask register, which works so far. Is there any possible way to set the IO-Pins directly without the need of a mask register? Because i remember that the complier complains that "a value exceeds $1FF" if i try to perfrom a direct mov into a output register, buf if the Register is 32 Bits long, why it complatins about that? See, i know two ways on the AVR: setting a value on the port by a former mov into a register, or set(reset) a pin directly on the port by using sbi(cbi) port,pin, all 8 bit wide, and that was all. It is proably (for sure) my misktake, because i sure misunderstand here the Propeller with "byte" and "bit", but why it does not accept loading directly a 32 Bit value into a output register before "merging" it with a mask register??
Other question - is there any debugger aside Ppropellersim, which does not use the hardware for real time debugging and without being limited to pure machine code (something like AVR Studio)?
Many thanks!
Greetings
Stefan
Post Edited (S1976) : 3/29/2010 3:59:30 AM GMT
first a "hello" to you all, i´m Stefan from Germany, 33yrs old.
I have difficulties to understand some things what´s going on on the Propeller using Assembly language. I am a former (good) AVR Assembly programmer and i want to avoid (cause of speed issues) using only SPIN. For example, i understand what is DIRA (=DDR# on the AVR) and outa (=out port# on the AVR), but are on the Propeller these two I/O-Ports 32 bits long and how to access them correctly/directly? I guess, when i do a mov dira,#XX or mov outa,#xx it sets a Value into the registers, but that ends up in nothing, it sets something, sometimes all ports, sometimes nothing, sometimes half of them, but with each increment. Now somewhere i read that i should perform a logical shift with the output register and a mask register, which works so far. Is there any possible way to set the IO-Pins directly without the need of a mask register? Because i remember that the complier complains that "a value exceeds $1FF" if i try to perfrom a direct mov into a output register, buf if the Register is 32 Bits long, why it complatins about that? See, i know two ways on the AVR: setting a value on the port by a former mov into a register, or set(reset) a pin directly on the port by using sbi(cbi) port,pin, all 8 bit wide, and that was all. It is proably (for sure) my misktake, because i sure misunderstand here the Propeller with "byte" and "bit", but why it does not accept loading directly a 32 Bit value into a output register before "merging" it with a mask register??
Other question - is there any debugger aside Ppropellersim, which does not use the hardware for real time debugging and without being limited to pure machine code (something like AVR Studio)?
Many thanks!
Greetings
Stefan
Post Edited (S1976) : 3/29/2010 3:59:30 AM GMT
Comments
Note that IOMASK doesn't have to be a compile-time constant. You can use a shift instruction to produce it given a pin number like:
Many thanks!
Stef
mov outa, p18mask
...
p18mask long |<18
By the way ... there is another way to use pins above p8 with an immediate. You can also use movd outa, # $1 - $1ff
and MOVI can be used to set the 9 most significant port pins.
The operation which can be compared to set end clear pin instructions available on AVR are
or for setting
and
andn for clearing just one pin
But there you need pin-masks for all pins above p8 again.
The immediate can't be 32 bits long as the instruction opcode, the flags and·the destination address also need som bits of the 32 bit a PASM instruction has. By the way ... 9 bits is the reason·for the COG-RAM size being 512 longs. With 9 bits you can address each long in COG RAM.
Post Edited (MagIO2) : 3/29/2010 9:48:45 AM GMT