storing result at D0
Page 1 of 1

Author:  fredster [ Mon Feb 28, 2011 2:15 am ]
Post subject:  storing result at D0


I have a problem with the specs given to me. The instruction says that we have to store the result of our program (which I am done with already) to register D0. But because of MOVE.B #9,D0 TRAP #15, the LSB of D0 has 9. Is there any way to replace that MOVE.B #9.D0, or maybe there's something wrong with the specs? I still don't have a reply from my prof on the specs, and maybe there is a way for that 9 not to appear. Any help would be great.

Thanks a lot! :)

Author:  clive [ Mon Feb 28, 2011 3:22 am ]
Post subject: 

One might reasonably assume that it is the value in D0 immediately prior to halting the simulator with the D0=9;TRAP or HALT or STOP

I would suggest that a) you store the value in D0 into a memory location like ANSWER or RESULT, and b) print out it's content, before you halt. Comment your epilogue code suitably so that it's clear to your instructor you have thought about this.

You could also compartmentalize your assignment code within a subroutine that returns the value in D0. You call the subroutine, and then halt.

Author:  profkelly [ Mon Feb 28, 2011 6:01 pm ]
Post subject: 

You may also use the STOP instruction to halt the simulator.

* Stop execution
   STOP   #$2000

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group