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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/07/01 17:04
Read: times


 
#16391 - RE: Priority With Same Register Bank
Hi,

a different register bank should only be used, if faster execution was really achieved. At first there are 3 instructions (= 6 cycle) added, if you change the register bank.
E.g.:

push psw
mov psw, #10h
cjne r0, #0, label1
sjmp label2
label1:
; do something, if value not zero
label2:
pop psw
reti

or:

xch a, 8
jz label
; do something, if value not zero
label:
xch a, 8
reti

But its fully independent, which register bank used for which interrupt or for which subroutine.
Also its possible to share registers for non static variables on interrupts of the same priority.
And also, if not all 8 registers used you can used different registers on the same bank for different interrupt priorities or for static variables.

Its a good practice to write subroutines to be register bank independent.
E.g.:

using 0
mov r1, ar0

or:

mov a, r0
mov r1, a

does the same and cost always 2 bytes and 2 cycles, but the second example was register bank independent.


Peter


List of 4 messages in thread
TopicAuthorDate
Priority With Same Register Bank            01/01/70 00:00      
RE: Priority With Same Register Bank            01/01/70 00:00      
RE: Priority With Same Register Bank            01/01/70 00:00      
RE: Priority With Same Register Bank            01/01/70 00:00      

Back to Subject List