Show case in decimal - assembly language EASy68K

I am trying to display D0 in decimal format, but when I run the program, nothing is displayed. I get no errors, and when I look in the register D0, I see the expected number in hexadecimal, but the decimal equivalent is not displayed. I am trying to use TRAP for this, which we showed in the class. What am I doing wrong? The line of code in question is the 17th line from which the code begins. It says: "TRAP # 15 Display D0 in decimal format." Thanks for any help.

*-----------------------------------------------------------
* Program Number: 0
* Written by    : Bryan Kriss
* Date Created  : 10/06/2013
* Description   : This program performs If-then-else statement.
*
*-----------------------------------------------------------
START   ORG $1000   Program starts at loc $1000
IF  CMP     #12,P   Is P > 12? 
    BLE     ENDIF   If P < 12, go to ENDIF
    ASL     P       Shift left
    ASL     P       Shift left
    ASL     P       Shift left
    ADD     #4,P    P + 4
    MOVE    P,D0    Move P into D0
    EXT.L   D0
    TRAP    #15     Display D0 in decimal
    STOP    #$2700   Stop execution

ENDIF   MOVE    Q,D1     Move the value of Q into D1
        SUB     D1,D0    P - D1 (P-Q)
        MOVE    D0,D1    Move P into D1

        STOP    #$2700    Stop execution
* Data section
    ORG $2000   Data starts at loc 2000
P   DC.W    15  int P = 15;
Q   DC.W    7   int Q = 7;
    END START
+4
source share
1 answer

D0 D1.

:

MOVE    P,D0    Move P into D0
EXT.L   D0
TRAP    #15     Display D0 in decimal

MOVE    P,D1    Move P into D1
EXT.L   D1
MOVE.B  #3,D0   Put required TRAP #15 selector (3) in D0
TRAP    #15     Display D0 in decimal

: TRAP #15 - , easy68k. , , D0. , , , (), D1 A1.

- easy68k - :

TRAP #15 is used for I/O.  Put the task number in D0.

 Task
  0  Display string at (A1), D1.W bytes long (max 255) with carriage return and line feed (CR, LF). (see task 13)
  1  Display string at (A1), D1.W bytes long (max 255) without CR, LF. (see task 14)
  2  Read string from keyboard and store at (A1), NULL terminated, length retuned in D1.W (max 80)
  3  Display signed number in D1.L in decimal in smallest field. (see task 15 & 20)
  ...
+3

All Articles