Loop Primitive Instructions: provide, in one instruction, counters, decrement or
ID: 3598559 • Letter: L
Question
Loop Primitive Instructions: provide, in one instruction, counters, decrement or increment, and then branch if the counter equals (or does not equal) zero. The counter may be any of the registers A, B, D, X, Y, or SP.
However, we need to edit the code by ( separating the decrement command hilighted )
would someone provide a snap of the code please?
Example 7-43 Loop Primitive Instruction Loop Primitive Instruction Example Metrowerks HC12-Assembler (c) COPYRIGHT METROWERKS 1987-2003 Rel. Loc Obj. code Source line ; Comparing the loop primitive and "normal" ; decrement and branch instructions. 0000 03E8 COUNT1 EQU 1000 0000 0OFF COUNT2: EQU 255 ; Counter value ; Max 8-bit counter 9 000000 CE03 E8 Idx #COUNT 1 ; Initialize counter 10 loop: 12 13 14 000003 0435 FD ; Here is the repetitive code dbne loop Using the dbne instruction 15 ; Demonstrate 8-bit dec and branch instruction ldab #COUNT2 ; Initialize counter 16 000006 C6FF 17 18 19 20 000008 53 21 000009 26FD loop2: ; Here is the repetitive code decb bne loop2Explanation / Answer
register bank: 1 write port, 2 read ports
ALU : add
T register (temp reg)
32-bit bus
PC (program counter) with +1 op.
memory interface
MAR (mem address reg)
MBR (mem buffer reg)
IR (instruction reg)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.