Hehe, I read your first post too quickly and gave you the wrong advice!

Try this code, I think it will do what you need it to:

**Code:**

org $1000

start:

;

; Print number of odd and even digits.

;

move.l #123,d2 ;Number of odd digits.

move.l #234,d3 ;Number of even digits.

;

; First number

;

lea odd_nr,a1 ;Show odd string.

move.b #14,d0 ;

trap #15 ;

move.l d2,d0 ;Convert odd number to decimal ascii.

bsr bin_to_dec ;

move.b #13,d0 ;Show number of odd digits.

trap #15 ;

;

; Second number

;

lea even_nr,a1 ;Show odd string.

move.b #14,d0 ;

trap #15 ;

move.l d3,d0 ;Convert even number to decimal ascii.

bsr bin_to_dec ;

move.b #13,d0 ;Show number of odd digits.

trap #15 ;

;

; End of program

;

move.b #9,d0

trap #15 ;Halt simulator

;

; Convert 8 bit binary to decimal.

;

;input:

; d0=8 bit binary number.

;

;output:

; a1=start of number string.

;

bin_to_dec

movem.l d2-d4,-(sp)

lea number,a1

move.l #0,(a1)

addq.l #3,a1

moveq #0,d2

move.b d0,d2

moveq #2,d4

bin_to_dec_loop

divu.w #10,d2

swap d2

move.b d2,d3

add.l #'0',d3

move.b d3,-(a1)

move.w #0,d2

swap d2

cmp.w #0,d2

beq bin_to_dec_end

dbra d4,bin_to_dec_loop

bin_to_dec_end

movem.l (sp)+,d2-d4

rts

;

; Strings.

;

number

dc.l 0

odd_nr

dc.b 'Number of odd digits:',0

even_nr

dc.b 'Number of even digits:',0

end start

A couple of words of advice:

1) The number of digits must not be more than 255. This code only works with 8 bit numbers. If you want more, you must adapt the code yourself.

2) I haven't added any comments to the routine that converts the numbers to decimal ascii. Before you ask how it works, try to figure it out yourself.

3) As always in these cases, try to understand the code, and don't blindly copy it into your code. Trying to understand it will help you learn!

Any questions? Ask them, but only after trying to understand things yourself first