80 likes | 205 Vues
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.
E N D
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
logical shift left, LSL 0 C operand
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
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
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
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
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