A
Active8
hi:
sorry again. same prob at .piclist group. it's no wonder this group is
so busy. the collective knowlege is all here.
i don't remember having this prob with the MPLAB IDE i downloaded years
ago.
PIC16F84A
with MPLAB 6.3 MPASM i tried to do the following:
W starts off containing 0x04 in all these code frags
incf W, W ; or
incf W, 0 ; changes the contents of W to 0x01
incf W ; leaves it at 0x04
i thought leaving the 2nd operand out defaulted to 0 i.e., W. maybe not
when it's a file op. eh?
decf W ; doesn't do squat and
decf W, W ; leaves 0xff in W - cute
so to do 4 - 1 = 3 ...
sublw 1 ; which is 0xfd
movwf mulcnd
comf mulcnd
movf mulcnd, W
addlw 1 ; W = 3
because
sublw 1 ; 0xfd or b'11111101'
comf W, W ; gives b'11111111' ?!!!
is this a simulator bug or real life? chip is PIC16f84a
i also did one of those table lookup deals with
LOOKUP
addwf PCL, F
MSGS DT "ABCD"
DT "EFGH"
this is why i need to decrement W. it looks like when i add to the
program counter, it ends up too high by 1. it's incrementing after the
addwf op, right?
thanks in advance for squaring me away.
mike
sorry again. same prob at .piclist group. it's no wonder this group is
so busy. the collective knowlege is all here.
i don't remember having this prob with the MPLAB IDE i downloaded years
ago.
PIC16F84A
with MPLAB 6.3 MPASM i tried to do the following:
W starts off containing 0x04 in all these code frags
incf W, W ; or
incf W, 0 ; changes the contents of W to 0x01
incf W ; leaves it at 0x04
i thought leaving the 2nd operand out defaulted to 0 i.e., W. maybe not
when it's a file op. eh?
decf W ; doesn't do squat and
decf W, W ; leaves 0xff in W - cute
so to do 4 - 1 = 3 ...
sublw 1 ; which is 0xfd
movwf mulcnd
comf mulcnd
movf mulcnd, W
addlw 1 ; W = 3
because
sublw 1 ; 0xfd or b'11111101'
comf W, W ; gives b'11111111' ?!!!
is this a simulator bug or real life? chip is PIC16f84a
i also did one of those table lookup deals with
LOOKUP
addwf PCL, F
MSGS DT "ABCD"
DT "EFGH"
this is why i need to decrement W. it looks like when i add to the
program counter, it ends up too high by 1. it's incrementing after the
addwf op, right?
thanks in advance for squaring me away.
mike