我是汇编世界的新手,我想用 Easy68k 的汇编语言找到 3 个数字的最大值和最小值,但程序不起作用,我不知道为什么,任何帮助将不胜感激。
这是代码
ORG $1000
l1 add.b #1,d5 * l1 to let the user enter 3 number's then find max and mincounter
move.b #4,d0
trap #15
move.b d1,d2
cmp d6,d2
bgt max
move.b d6,d4 * d2 < d6 ,,, d4 to save the min value
cmp #3,d5
bne l1
bra end
smax move.b d2,d3 *d2 > d6 ,,, d3 for the max value
rts
max bsr smax * to go to the subrotine smax to find the max
bne l1
end rts
START:
clr.l d2
clr.l d3
move.b #0,d5
move.l #0,d6
lea msg,A1
move.b #18,d1
trap #15
bsr l1
lea msg1,a1
move.b #10,d1
move.b #1,d0
trap #15
move.b d3,d1 * d3 to save the max in it
move.b #3,d0
trap #15
lea msg3,a1
move.b #20,d1
move.b #0,d0
trap #15
lea msg2,a1
move.b #10,d1
move.b #1,d0
trap #15
move.b d4,d1 * d4 to save the min in it
move.b #3,d0
trap #15
msg dc.b 'enter 3 numbers : '
msg1 dc.b 'the max : '
msg2 dc.b 'the min : '
msg3 dc.b ' '
END START ; last line of source
感谢您的帮助。