I can't immediately see why you're getting a reset as it doesn't seem to be dividing by zero anywhere, but there are bugs on just about every line of your code.
For debugging the reset, add some exception service routines to all the exception vectors, and have them breakpoint or print or something. Are you sure "A5" is set up properly?
Can you single-step through the code and see which line it fails on?
As for the code:
Assume D0 contains xxxxxxxx and D2 contains yyyyyyyy
move.w #$03E8,D2 ; move in 1000 decD2 now contains yyyy03e8
divu.l D2,D0 ;divid by 1000D0 contains xxxxxxxx/yyyy03e8, call this zzzzzzzz
move.b D0,(adeci1,A5) ;store 1000 place
move.b D1,D0 ;get original byteD0 now contains zzzzzzxx
move.b #$64,D2 ;move in 100D2 now contains yyyy0364
divu.l D2,D0 ;divide it by 100D0 now contains zzzzzzxx/yyyy0364, call this mmmmmmmm
move.b D0,(adeci2,A5) ;save hundreds place
move.w D1,D0 ;get orginal byteD0 now contains mmmmzzzz
move.b #$0A,D2 ;move in 10 decD2 now contains yyyy030a
divu.l D2,D0 ;divide by 10D0 now contains mmmmzzzz/yyyy030a, call this nnnnnnnn
move.b D0,(adeci3,A5) ;store tens place(s)
I'm not sure what the above routine is trying to do, but I'm sure you're not intending to divide by almost random numbers like you're doing.
"move.b #$64,D2 ;move in 100" moves 0x64 into the lower BYTE of D2, leaving the upper three bytes the same as they were before.
In your case, the divide instruction might have zeroed the upper bits as a side effect of the division and the data you're using, but relying on that is very risky. The "divide by 100" is guaranteed to be dividing by 868 (0x0364) even if you have zeroed D2 previously.
This is "just something you have to know". I've just read the "ColdFire Family Programmer's Reference Manual" pretty much from cover to cover, and after a trip back to an old 68000 Programming Manual I found section 1.19 in the ColdFire one:
1.9 Organization of Data in Registers
This section describes data organization within the data, address, and control registers.
1.9.1 Organization of Integer Data Formats in Registers
Each integer data register is 32 bits wide. Byte and word operands occupy the lower
8- and 16-bit portions of integer data registers, respectively. Longword operands
occupy entire data registers. A data register that is either a source or destination
operand only uses or changes the appropriate lower 8 or 16 bits (in byte orword
operations, respectively). The remaining high-order portion does not
change and is unused and unchanged.
If you missed reading that section you have to read between a lot of lines to find this out. The MOVE instruction
MOVE:
Moves the data at the source to the destination locationand sets the
condition codes according to the data. Thesize of the operation may
be specified as byte, word, or longword.
That doesn't mention sign extending. Compare with these instructions:
MOVEA
Word size source operands are sign extended to 32-bit quantities
before the operation is done.
MOVEQ
The data in an 8-bit field within the operation word is sign-extended
to a longword operand in the data register as it is transferred.
MOV3Q
The 3-bit immediate operand is sign extended to a longword operand
and all 32 bits are transferred to the destination location.
MVS
Move with Sign ExtendSign-extend the source operand and move
to the destination register.
MVZ Move with Zero-Fill
Zero-fill the source operand and move to the destination register
.
MOV3Q, MVZ and MVZ all require ISA_B. I know the MCF51MM256 is ISA_C, so your one might be too. it is more portable to explicitly clear the registers before loading bytes or words into them, like this compiler-generated code does:
40104698: 4280 clrl %d
04010469a: 1001 moveb %d1,%d
04010469c: 2f00 movel %d0,%sp@-
4010469e: 4e90 jsr %a0@
=======================
40104972: 4280 clrl %d0
40104974: 4878 000c pea c <OPER1>
40104978: 1439 4024 56bd moveb 402456bd <cmdQueueHead>,%d2
4010497e: 1002 moveb %d2,%d0
40104980: 2200 movel %d0,%d1
40104982: 5282 addql #1,%d2
40104984: e588 lsll #2,%d0
40104986: e989 lsll #4,%d1
40104988: 9280 subl %d0,%d1
4010498a: 0681 4024 5722 addil #1076123426,%d1
40104990: 2f01 movel %d1,%sp@-
40104992: 4879 4024 56be pea 402456be <testCmd.4546>
40104998: 4eb9 4015 04e0 jsr 401504e0 <memcpy>
;==========================
if (testListPtr->numParams == testCmd.numParams)
401049dc: 4281 clrl %d1
401049de: 4280 clrl %d0
401049e0: 3228 0002 movew %a0@(2),%d1
401049e4: 3039 4024 56c0 movew 402456c0 <testCmd.4546+0x2>,%d0
401049ea: b081 cmpl %d1,%d0
401049ec: 660a bnes 401049f8 <HsvHwTest+0xb8>
This also shows why it is a very good idea to use a compiler to generate your code. It knows about this stuff.
If you're trying to convert binary to decimal, then you should check the REMS.L and REMU.L instructions. Just keep dividing the same number by 10 and print the REMAINDER until the dividend is zero
Tom