Wow! Thanks for the extensive test.
I suppose i=1+1 should be i=i+1, but does not matter in this test.
The MOVE?BA _ADRESLO are macros I guess, but where can I find documentation how to use that stuff?
Ioannis
Wow! Thanks for the extensive test.
I suppose i=1+1 should be i=i+1, but does not matter in this test.
The MOVE?BA _ADRESLO are macros I guess, but where can I find documentation how to use that stuff?
Ioannis
might need glassesI suppose i=1+1 should be i=i+1, but does not matter in this test.
there is none i know of but its pretty simplewhere can I find documentation how to use that stuff?
A = wreg
B= byte
C= constant
L= label
W=word
S= string
the same as USERCOMMAND
so
MOVE?BA _ADRESLO
is move byte @ ADRESLO to wreg
it saves all that banksel typing
ie
asm
banksel _ADRESLO
movf _ADRESLO,w
banksel whatever is next
Warning I'm not a teacher
Thanks Richard.
Well this makes things more clear. Once I remember doing things in ASM, the banklsel was a pain...
Ioannis
Received from Charles this very interesting (and I suppose undocumented) tip:
array.highbyte[i << 1]=adresh
array.lowbyte[i << 1]=adresl
OR
array.highbyte[i * 2]=adresh
array.lowbyte[i * 2]=adresl
instead of
array.highbyte[i]=adresh
array.lowbyte[i]=adresl
Really interesting!
Ioannis
Another PBP trick when mixing with ASM is to declare your variables with the addendum SYSTEM:
...becomes:Code:Variable VAR BYTE @MOVF _Variable, W
Code:Variable VAR BYTE SYSTEM @MOVF Variable, W
UPDATE METHODS
Code:array var word[2]inx var byte ;UNCOMMENT FOR METHOD 8 ADRESHi VAR BYTE ;BANK0 SYSTEM ADRESLO VAR BYTE ; BANK0 SYSTEM ;METHOD 0 word_temp var word ;METHODS 2 AND 3 array_asbyte var byte ext @array_asbyte=_array ;ALL METHODS EXCEPT 0 , 1 ,6 ,7 ,8 'i var byte 'i=0 ;METHOD 4 ,8 @ MOVE?CW _array , FSR0L ; PIC16 ENH CORE ;METHOD 5 '@ MOVE?CW _array , FSR ; PIC16 SHITTY OLD CHIP ; CHIP for inx=0 to 1 ; 877 1825 ' word_temp.byte0=adreslo ;METHOD 0 30 WORDS 31 ' word_temp.byte1=adreshi ' array[inx]=word_temp ' array[inx]=(adreshi<<8)| adreslo ;METHOD 1 50 WORDS 48 ' if !i&1 then ;METHOD 2 57 WORDS 57 ' array_asbyte[i]=ADRESLO ' else ' array_asbyte[i]=ADRESHi ' endif ' i=i+1 ' array_asbyte[i]=ADRESLO ;METHOD 3 30 WORDS 34 ' i=i+1 ' array_asbyte[i]=ADRESHi ' i=i+1 asm ;METHOD 4 PIC16 ENH CORE na WORDS 22 MOVE?BA _ADRESLO MOVWI FSR0++ MOVE?BA _ADRESHi MOVWI FSR0++ ENDASM 'asm ;METHOD 5 PIC16 OLD CHIP 27 WORDS na ' MOVE?BA _ADRESLO ' MOVWF INDF ' INCF FSR,F ' MOVE?BA _ADRESHi ' MOVWF INDF ' INCF FSR,F 'ENDASM ' array.highbyte[inx*2]=adreshi ;METHOD 6 76 WORDS 76 ' array.lowbyte[inx*2]=adreslo ' array.highbyte[inx<<1]=adreshi ;METHOD 7 50 WORDS 49 ' array.lowbyte[inx<<1]=adreslo 'asm ;METHOD 8 PIC16 ENH CORE na WORDS 22 ' movf ADRESLO,w ' MOVWI FSR0++ ' movf ADRESHi,w ' MOVWI FSR0++ 'ENDASM next stop
Last edited by richard; - 31st January 2020 at 02:32.
Warning I'm not a teacher
It is very impressive how much room there is for improvements!
Thanks,
Ioannis
Bookmarks