80 likes | 196 Views
Tutorial 5. 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.
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