So im still trying to understand basic computer architecture, and have been writing a little bit of assembly for the MSP430 (basic LED/Switches stuff).
I've been browsing the instruction set, and things are starting to make more sense.
However for example a JNE/JNZ (Jump if Not Equal/Jump is Not Zero). I understand these are checking the status bits (that were maybe set from a CMP function).
However the operation looks like this(Grabbed from the instruction set):
if Z = 0: PC + 2*offset -> PC if Z = 1: execute following instruction
So if Z is 0, go to the next instruction...makes sense. But I don't understand the PC + 2*offset -> PC, I think im maybe confused on the PC itself. The user guide doesn't go into a HUGE detail about it. The PC presumably points to the NEXT instruction to be executed?
When it says it points to im guessing it's holding whatever is next? (Like maybe it's holding a
MOV #020h,R9 or something? which would convert to some binary opcode + source and destination binary bits (thats a total of 16 bits? (I could be wrong here)
However I do not understand the PC + 2*offset part, offset of what? I think that's the part that gets me. But I think the whole "process" of whats happening is still confusing, I understand WHAT is being written and where but maybe not "how". (im getting there though!)
Edit: I think perhaps Im forgetting also that something like MOV @020h,R9 is actually 3 separate 16 bit words (I Think.....which would be 3 different PC counts) (since the registers are 16 bits large).
Edit2: Here is an Example from the MSP430 book: (Keep in mind I do understand "What" it's doing, but not why? and I don't understand the offset part
DelayLoop: ; inc.w R4 ; Increment loop counter cmp.w #DELAYLOOPS ,R4 ; Compare with maximum value jne DelayLoop ; Repeat loop if not equal