1 / 7

Midterm Solutions

Midterm Solutions. 1.2. MidTerm Discussion. 4.1 Write a code-snippet that will load two number from “register memory” into the CPU, and add them together, then store the result back to “register memory”. ldaa num1 ldab num2 aba staa result. Optional: Num1 equ $03 num2 equ $05

whitby
Télécharger la présentation

Midterm Solutions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Midterm Solutions

  2. 1.2

  3. MidTerm Discussion 4.1 Write a code-snippet that will load two number from “register memory” into the CPU, and add them together, then store the result back to “register memory” ldaa num1 ldab num2 aba staa result Optional: Num1 equ $03 num2 equ $05 result equ $00

  4. 4.2 Write a code-snippet, that will implement a loop that iterates 5 times. ldaa #$05 loop: deca bne loop

  5. 68HC11 5.1 Write a code-snippet, that will implement a delay loop in a subroutine. The delay loop must execute FF times. delay: ldaa #$FF loop: deca bne loop rts

  6. 68HC11 5.2 Write a code-snippet, that will implement a delay loop in a subroutine. The delay loop must execute AFFFF times. delay: ldaa #$0A oloop: ldx #$FFFF iloop: decx bne iloop deca bne oloop rts

  7. 68HC11 6.1 Write a code-snippet, that will turn on PA6, call a delay subrouting, then turn on PA4 and 5. You can assume the delay subroutine is written for you, and that port_a is a label that is set correctly. ldaa #$04 ;value to disable timed interrupt staa $3F ;disable timed interrupt lds #$FF ;set stack start ldaa #$40 ;value to turn on just PA6 staa port_a ;set PA so just 6 is on bsr delay ;call delay subroutine ldaa #$30 ;value to turn on just PA4&PA5 staa port_a ;turn on PA4&5 #$40 = 0100 0000 bits 7654 3210 #$30 = 0011 0000

More Related