在汇编语言方面,我是初学者。我使用“easy 68k编辑器/汇编器”来编写68k汇编代码,要求用户输入2个值,然后将它们汇总在一起并显示出来。问题是,我的代码不断停止,我不知道如何解决/调试此问题。在汇编代码中发现错误时遇到问题
任何人都可以帮我弄清楚如何找出错误吗?我会很感激。先谢谢你。
*-----------------------------------------------------------
* Program : Sum of Two Numbers
* Written by : Me
* Date : July 15, 2012
* Description: This program will read in 2 numbers the user
*inputs and find the sum.
*-----------------------------------------------------------
org $8000
START movea.l #MSG1, A3
trap #3
clr.w D2
JSR Loop
trap #2
move.w d2, d4
movea.l #msg2, a3
trap #3
clr.w d2
jsr loop
trap #2
movea.l #msg3, A3
trap #3
add.w d4, d2
JSR DISP
trap #2
trap #9
LOOP trap #0
trap #1
cmp.b #$0D, D1
BEQ BREAK
and.b #$0F, d1
mulu #10, d2
add.w d1, d2
jmp loop
Break rts
DISP clr.b d3
DISDIV divu #10, D2
move.b #16, d5
ror.l d5, d2
or.b #$30, d2
move.b d2, -(A7)
addq #1, d3
clr.w d2
ror.l d5, d2
bne DISDIV
DISDIG move.b (a7)+, D1
trap #1
subq.b #1, D3
bne DISDIG
rts
org $8100
MSG1 DC.B 'Please enter the first of two numbers (two digits) ', 0
MSG2 DC.B 'Please enter the second of two numbers (two digits) ', 0
MSG3 DC.B 'The sum of the two 2 digit numbers you entered is ', 0
end start
如果有另一个论坛,我可以更好地张贴这个,请让我知道。谢谢 – 2012-07-15 17:39:10
无法在68000模拟器中浏览它并查看它失败的位置? – 2012-07-15 17:41:08
我知道它失败的地方。我只是不知道为什么。它是一个陷阱例外,我打电话给我的第一个陷阱#3。 – 2012-07-15 18:14:54