I am having trouble working with this add routine

I am writing an add-on program for my assembly language class in Easy68k, but I have the same problem. Whenever I run the program, it allows me to enter up to 10 numbers (the allocated size of my array), and then displays a message saying that it is being calculated, but then I get an endless printout of y using umlauts. Any problems that you can see right away on the road with my program that would make it do this?

I was looking for syntax for routines because I am sure that this is what I am doing wrong, but I can not find anything.

ORG $2000
ARRAY   DS.W    10
ZDONE       DC.W    'Enter values. Zero when done.'
FULL        DC.W    'That is all the input allowed. Calculating sum now...'
OERROR      DC.W    'The values you entered caused an overflow condition.'
REPEAT      DC.W    'Do you want to repeat? [0=No, 1=Yes].'

START       ORG     $2800

MAIN    LEA         ZDONE,A1
        MOVE.B      #14,D0          ;
        TRAP        #15
        LEA         ARRAY,A0

        MOVE.B      #0,D3
INPUT   MOVE.B      #4,D0
        TRAP        #15
        MOVE.W      D1,(A0)+
        BEQ         SUB
        ADD.B       #1,D3
        CMPA        #$2012,A0
        BNE         INPUT
        LEA         FULL,A1
        MOVE.B      #14,D0           ; Outputs the FULL string
        TRAP        #15

SUB     SUB.W       A0,A0
        BSR         SUM              ; Begins to calculate sum

        CMP         #1,D0
        BNE         NoV
        LEA         OERROR,A1
        MOVE.B      #14,D0
        TRAP        #15
        BRA         AGAIN

NoV     LEA         $D1,A1
        MOVE.B      #14,D0
        TRAP        #15

AGAIN   LEA         REPEAT,A1
        MOVE.B      #14,D0
        TRAP        #15
        MOVE.B      #4,D0
        TRAP        #15
        MOVE.B      #1,D0
        CMP.B       D0,D1
        BEQ         START
        STOP        #$3800

        ORG         $3800        
SUM     LEA         ARRAY,A0
        ADD.W       #$A0,D1
        BVC         NoV
        SUB.B       #1,D3
        BNE         SUM
        MOVE.B      #1,D0
        BRA         RETURN
        CLR.B       D0
RETURN  RTS
        END         START
+3
source share
1 answer

Stream ÿ comes from here:

NoV     LEA         $D1,A1
        MOVE.B      #14,D0
        TRAP        #15

0xD1 A1. , $: . : MOVE.B, , A1 0x000000D1. TRAP, ? 0x000000D1? undefined; 0xFF, ..

:

SUB     SUB.W       A0,A0

A0 A0, A0 0.

, :

SUM     LEA         ARRAY,A0
        ADD.W       #$A0,D1

ADD 0xA0 D1. , :

        ADD.W       A0,D1

:

ARRAY A0 SUM. , :

SUB     LEA         ARRAY,A0
        BSR         SUM

SUM . ( , D1):

SUM     ADD.W       (A0)+,D1

NoV , , ? : , , , , , . BVC ! . , , 0, BSR:

SUM     ADD.W       (A0)+,D1
        SUB.B       #1,D3
        BNE         SUM
        BSR         NoV
        MOVE.B      #1,D0
        BRA         RETURN
        CLR.B       D0
RETURN  RTS

, . , , . , , RETURN, CLR , SUM 0.

NoV, , RTS. , TRAP D1 , , , :

NoV     MOVE.B      #3,D0
        TRAP        #15
        RTS

, . , .

+2

All Articles