EASy68K
http://www.easy68k.com/EASy68Kforum/

HELP! Print the sum of two numbers? Code is giving me errors
http://www.easy68k.com/EASy68Kforum/viewtopic.php?f=5&t=1475
Page 1 of 1

Author:  tjiwani [ Sat Jan 31, 2015 7:08 pm ]
Post subject:  HELP! Print the sum of two numbers? Code is giving me errors

ORG $1000
START: ; first instruction of program


MOVE.B #14,D0
LEA EM,A1
TRAP #15

; halt simulator

MOVE.B #3,D0
MOVE.B N1,D1
ADD.B N2,D1
TRAP #15

N1 DC.B 4
N2 DC.B 5

EM DC.W 'The Number Added ',0

END START ; last line of source

Author:  profkelly [ Sun Feb 01, 2015 1:21 pm ]
Post subject:  Re: HELP! Print the sum of two numbers? Code is giving me er

The simulator is continuing to execute instructions beyond the end of your code. Add a SIMHALT instruction to halt the simulator.
Code:
*-----------------------------------------------------------
* Title      :
* Written by :
* Date       :
* Description:
*-----------------------------------------------------------
    ORG $1000
START: ; first instruction of program

    MOVE.B #14,D0   ; Display string task
    LEA EM,A1       ; Location of string
    TRAP #15        ; Execute task

    MOVE.B #3,D0    ; Display number in D1 task
    MOVE.B N1,D1    ; Get number in N1
    ADD.B N2,D1     ; D1 = D1 + N2
    TRAP #15        ; Execute task

; halt simulator
    SIMHALT

N1 DC.B 4
N2 DC.B 5

EM DC.W 'The Number Added ',0

    END START ; last line of source

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/