Hints On Swaperoo Lab

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

HINTS ON SWAPEROO LAB Understand that the Cheat Sheet of instructions are broken into 2 categories.

The first category places CONSTANTS into the accumulator, etc. The second category refers to address locations. our first issue !ill be getting t!o specific numbers into memory. "hy is this a big deal# Cu$ you should go thru the accumulator. %et&s say you !ant to s!itch the numbers ' and (. ou first need to load ' and ( into memory. Choose some cells, let&s say 2) and 2*. So, to get ' and ( loaded into 2) and 2*, you !ould say this+ lod,c ' sto 2) loc,c ( sto 2* The !orksheet you ha-e to fill out has little bo.es of the memory cells you use, and the accumulator. /or each step in your algorithm, you must !rite out the contents of the cells in play and !hat is currently held in them. This !ill help you trace thru !hat you need to make happen. Note that once you ha-e the ' and the ( in memory, you !ill need to mo-e them into the accumulator and place them some!here else to s!ap. ou !on&t need the ,c -ersion of lod, you !ould then say+ lod 2) 0o you understand the difference# The lod,c ' says put the number ' directly into the accumulator. The lod says+ go to address location 2) and get !hat&s there, make a copy of it, and bring the copy to the accumulator. 0on1t forget that !rites 2or sa-es3 to the memory locations are destructi-e. 2called destructi-e !rites3 "hat this means is that !hen you perform a !rite or a sa-e, the ne! contents "45T6 O764 the pre-ious contents. The pre-ious contents are lost fore-er. 5f you think about !hat it means to ha-e a destructi-e !rite, you !ill reali$e that the simple task of s!itching numbers in memory cells is a little trickier than it seems. "hy# 8ecause if you !rite the contents of Cell 8 to Cell A, the original contents of A are lost, and you can&t find them to !rite them into Cell 8. 0oes that make sense# So... you !ill need T9466 memory locations to support your s!ap. One for number :, one for number 2, and one to function as a temporary holding cell. So... use that reminder of destructi-e !rites, and interpret it !ithin the conte.t of the fetch e.ecute cycle... And; call or email me !ith any <uestions;

You might also like