1 / 8

Working with Carry Flag and Logical Shift Left in Assembly Language

This tutorial covers the concepts of the carry flag and the logical shift left (LSL) operation in assembly language. It demonstrates how to use the carry flag to control program flow, specifically through branching instructions like BCC (Branch if Carry Clear). The tutorial includes practical exercises that involve writing subroutines to display numbers in binary format and reading binary values from the keyboard. By the end, learners will understand how to manipulate binary data and utilize branching effectively in their assembly programs.

ethel
Télécharger la présentation

Working with Carry Flag and Logical Shift Left in Assembly Language

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. Tutorial 5

  2. carry flag C 1 0 1 1 1 1 1 1 + 1 0 0 1 1 0 1 0 1 1 1 1 1 1 0 1 0 1 1 0 0 1 1 carry C

  3. logical shift left, LSL 0 C operand

  4. C D2.B (binary) D2.B (hex) 1010 0110 A6 LSL.B #1,D2 0100 1100 4C 1 LSL.B #1,D2 1001 1000 98 0

  5. branch if carry clear, BCC BCC alpha • looks at value of carry flag C • branches to alpha if C is 0 • often used with LSL LSL.B #1,D2 BCC alpha

  6. Practical 5 Write subroutines that use LSL to • display on screen contents of D2.B in binary form • read 8-bit binary value from keyboard into D2.B

  7. org $400 program MOVE.B #$23,D2 BSR binaryout MOVE.B #9,D0 TRAP #15 binaryout subroutine binaryout (use RTS to exit subroutine) end program

  8. org $400 program BSR binaryin BSR binaryout MOVE.B #9,D0 TRAP #15 binaryout subroutine binaryout (use RTS to exit subroutine) binaryin subroutine binaryin (use RTS to exit subroutine) end program

More Related