|I have got some problem
|Page 1 of 1|
|Author:||wangyimang [ Wed Jun 08, 2011 12:12 pm ]|
|Post subject:||I have got some problem|
(a) Consider the following code segment, and answer the questions below:
start org $1000
p move.w 4(sp),d0
move.l d1,8(sp) ; ***
ans ds.l 1
(i) What is the value of ans at the end of the execution?
(ii) Give a general formula for the calculation that this code performs.
(iii) What does the last move.l instruction (which is commented with ; ***) do?
(iv) What instruction or instructions clean up the stack?
look forward the answer
|Author:||lee [ Wed Jun 08, 2011 3:34 pm ]|
(i) Run the code and you will find out.
(ii) It's three instructions, just write down what they do.
(iii) Step through the code and you will find out.
(iv) look for lines with sp in them.
|Author:||wangyimang [ Thu Jun 09, 2011 6:52 am ]|
(1) i saw the value is 1036 but the reason for this is?
plz exlain little
(2) formular which i see its only subtract, is there more?
(3) still dont konw move.l does
(4) is that rts?
|Author:||clive [ Thu Jun 09, 2011 7:30 am ]|
Static analysis suggests the answer should be 13. Also the use of TRAP#14 suggests the program has been written for the MECB not Easy68K. http://www.classiccmp.org/cini/pdf/Motorola/mecb05.pdf
What about the pair of multiplies and the add? You don't see those? (ans = p1*p1 + p2*p2)
MOVE.L, moves a LONG word, ie 32-bits, between memory and/or registers.
RTS Returns from subroutine (pg 273), in this case the one called 'p'
Have you not looked at ANY books or manuals on the 68K? Go download a 68K programmers manual of the net. http://www.freescale.com/files/archives ... 000PRM.pdf
The programs is a pretty poor example of stack parameter passing, there is little point in passing back the value in this manner.
|Author:||profkelly [ Thu Jun 09, 2011 11:52 am ]|
M68K Programmers Reference manual is also available on the easy68k site:
There is a functional MECB Tutor program on the EASy68K examples page if you want to run the program using EASy68K:
|Page 1 of 1||All times are UTC|
|Powered by phpBB® Forum Software © phpBB Group