Thanks all for effort. 3 propositions works great!!!
But I have on question:
Why you prefer operation on register "A" (Accumulator?, whatever) over operation on stack when mixing C and assembly?
From my understand (I was assembly guy long time ago) when do such mixing after assembly instruction we should left all context (all registers, SP etc.) unattached, because C compiler
a) is in charge of all context,
b) do not see assembly modification of registers and assembly insertion should left all registers as before assembly code.
In ours (working) examples:
I.
__asm(TFR CCRH,A);
__asm(STAA CCRW_H);
II.
__asm(tfr ccrh,a); /*copy CCH to A*/
__asm(anda #0x07); /*mask IPL bits*/
__asm(staa CCRW_H); /*store A in CCRW_H*/
in both examples above we disturb CPU context due operations on A register.
III.
__asm(pshcw);
__asm(movb 2, SP+,CCRW_H);
In example III. context is absolutely unattached, SP back to it's original state.
So that's why I have doubts. Please clear up if possible :smileyhappy:
REGARDS
/Greg