Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a Assembly program using CodeWarrior as a tool Question 1 Using the inform

ID: 3775284 • Letter: W

Question

Write a Assembly program using CodeWarrior as a tool
Question 1
Using the information contained in Table 4-10 (page 50) of the link http://www.nxp.com/assets/documents/data/en/reference-manuals/CPU08RM.pdf. Using the code provided below please create:
A table (labeled Table 1.1) showing the
• mnemonic/instruction
• the addressing mode in use for that instruction
• the number of clock cycles to execute the instruction
A second table (labeled Table 1.2) showing the
• event
• total number of clock cycles
• elapsed wall-clock time in seconds to execute (remembering that the 6808 we are using is clocked at 16 kHZ)
o please calculate the elapsed wall-clock time to 5 decimal places (round if necessary)
Where the events in Table 1.2 are given as:
• EVENT-1 : Execute the IOSetup region of code once
• EVENT-2 : Execute the MainLoop region of code once
• EVENT-3 : Execute 10 iterations of the MainLoop region of code (as executed from the start of the program)
Code to Analyze
main:
_Startup:
IOSetup:
CLRA ; special instruction to load a ZERO value into A
STA $03 ; configure PORT A data direction (all bits INPUT)
LDA #$FF ; enable pull-up (all bits have pull up enabled)
STA $01 ; configure PORT A pull ups
STA $43 ; configure PORT F data direction (all bits OUTPUT)

MainLoop:
LDA $00 ; read switches - upper nibble holds switch values!
NSA ; get upper 4 bits to lower 4 bits
STA $40 ; write to the LEDs
JMP MainLoop ; repeat forever!

Explanation / Answer

org 00H
;MAIN

toggle: MOV p1, #01H ;move 00000001 to PORT1
       CALL delay ;execute delay
       MOV A, p1 ;move PORT1 value to accumulator
       CPL A ;complement port1 value
       MOV p1, A ;move 11111110 to port1
       CALL delay
      
       sjmp toggle

;delay sub routine
delay:   MOV R5, #10 ;load register R5 with 10
third: MOV R6, #200 ; load register R6 with 200
second: MOV R7, #200 ; load register R7 with 200

       DJNZ R7, $   ;decrement R7 value till it is zero
       DJNZ R6, second   ;decrement R6 value till it is zero
       DJNZ R5, third   ;decrement R5 value till it is zero
      
       ret ; return back to main program
END      

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote