I'm searching after this info everywhere, but nowhere is it described in such detail that I would like know. If you know about something I would be very thankful for the link. The Atmel Assembler document it's just describing the ASM and Registers at all, but not usage behaviour of CodeVision.
Now I have one C code with ASM ISR and I would like to know what are really restrictions and for what is CodeVision using the registers when it's making the asm from the C.
As I see on page 15 in:
"do not use r0 - r3 and r21-r31 -> any other registers are OK"
Now I understand that I could use all of them but I need them to push and pop them later. Just the r4-r20 can be used without worrying that are used somewhere in the C code before the asm? For example main loop and everything is in CodeVision C and irq is in ASM, can I use R4-R20 without storing the previous values in the stack? And the rest can be used when I will back up them back before leaving (perhaps storing the R29,R28 of the Y reg in different reg, because if will mess with the Yreg I will change address of the push stack)
But what he stores I the r0-r3? Bit variables? I think the default setting is for 16bit so why it's r0-r3, not r0-r1.
So when I will set the bitvariables to max (104=13bytes) and if I won't use any bitvariable I will restrict the C code using the register, which ones? R0-R12?
The registers R26-R31 are for X Y Z. Ok and what he is doing with r21-r25, or that's the working space for the c code?
And whay it's using ST -Y,Rr instead of PUSH. I thought it will use PUSH to store the thing in different stack, but it doesn't use PUSH at all. For example instead of doing inc Rr it's doing SubI Rr,-1 (it's the same result just the SUBI will fill SREG and that can be much faster when used for jumps). But I would like to know the detailed reasons why it's dealing with registers like it's doing now.
The registers R0-R15 can't be used with some instructions like LDI etc... but all of them can be used with bit access SBRC etc...?
And the last:
Can be PC changed somehow different without using jumps and skips instructions etc...
The point why I'm asking so many perhaps stupid questions is that because in CodeVision is no help explaining how it's using the registers and why it's using exactly them. When I will be done to project should be completely in ASM, but before that will keep in ASM just ISR and I need veeeeeeeeery badly as many registers as I could get without worrying that I will mess with the C code (I could use all 32 registers if I could :) ) And with ones I could alter after backuping, or I could alter without backuping but it could have some consenquences (if you know which ones). It's all because speed in some I have buffers, in some I have preloaded variables, because I can't do LDI R10,0xff with R10, but I could do LDI R16,0xff MOV R10,R16 but it takes more cycles, the fastest way is MOV R10,R-global_static_register_with_stored_0xff.