Computer Architecture - Instruction Sets and Addressing Modes Questions

Associate
Joined
13 Jan 2007
Posts
2,424
Location
Belfast,Northern Ireland
I can nail this entire section except for the last question everytime, I could probably memorise similar questions and adapt my answer but im a gimp and like to know what im doing and how things work :)

Anyway heres two past paper questions including the answers, could someone be kind enough as to explain this in a step by step process so I actually understand how the answers are coming about? Its an MC68k processor if that helps anyone thinking WTF

Code:
What are the hexadecimal values in address registers A1 and A2 and memory locations $2000 to $2007 after executing the following subroutine once? 

		ORG  	$2000

	alpha	DS.W	2
	beta	DS.W	1
	gamma	DC.W	$1A43

	subroutine	LEA	alpha,	A1
		MOVE.L 	#$29, 	(A1)+
		LEA	beta, 	A2
		MOVE.W	(A1), 	(A2)+
		RTS
		[5 marks]

A1	2002
A2	2006
2000 	00
2001 	00
2002 	00
2003 	29
2004 	00
2005 	29
2006 	1A
2007 	43

Code:
(d)	What are the hexadecimal values in address registers A0 and A1 and memory locations $400 to $407 after executing the following subroutine? 

		ORG  	$400
		DS.B	2
		DC.B	9,4,2,7,3,10

	subroutine	LEA	$400, A0
		LEA	$404, A1
		MOVE.B	(A1)+, (A0)+
		MOVE.B	(A1)+, (A0)
		MOVE.B	(A1), (A0)+
		RTS
	[6 marks]

A0	$402
A1	$406
$400	$02
$401	$03
$402	$09
$403	$04
$404	$02
$405	$07
$406	$03
$407	$0A (A0, A1 1 mark each, others 0.5 marks each)
 
I dont think i need it for these types of questions? The answers given after the [6 marks] bit or whatever marks it is. Its basically just a simple trace but I dont understand exactly how its working as they seem to jump a bit around the place
 
Been staring at this stuff too long and really not catching onto it, need to get my focus back.

Yes ORG sets the starting address to whatever number is beside it.
DS stands for Define Storage so DS.W 2 means a space is saved $2000-2002 I believe?
DC is Define Constant as you rightly pointed out. In this case it'll be placed in $2005-$2006? Only in the beginning of course.

MOVE.L
MOVE.W
MOVE.B is basically placing one thing in another with Longword, word or byte format

Registers beginning with A are address registers also if you werent aware but im sure you were
 
Bah had it sorted there now but that second question has thrown me off

Fully get it now, never worry! Thanks for the help though
 
Last edited:
Back
Top Bottom