You are on page 1of 1

*Practical 3

ORG
START:

$1000
; first instruction of program

move $2000,d0
sub $2002,d0
BEQ jj
move #1,$2004
BRA j1
jj

move #0,$2004

j1

trap #15
END

START

; last line of source

----------------------------------------------------------*Practical 5
ORG
$1000
START:
; first instruction of program
move $2000,d0
sub $2002,d0
bmi jj
*branch if minus
move $2002,d1
move d1,$2004
BRA j1
jj

move $2000,d1
move d1,$2004

j1

trap #15
END

START

; last line of source

----------------------------------------------------------*Practical 6
ORG
START:

lo

jj

$1000

; first instruction of program

move $2000,d0
move 0,d1
move #10,d3 * 16 bit counter
LSL #1,d0
bcs jj
*if carry=1 jump to jj
sub #1,d3
BEQ lo
add #1,d1
sub #1,d3
BEQ lo

*calculate no. of ones

trap #15
END

START

; last line of source

You might also like