View previous topic :: View next topic
|
Author |
Message |
vijay korde
New User
Joined: 19 Feb 2010 Posts: 27 Location: India
|
|
|
|
Hello,
Single base register can address more than 4K as well. Then why in assembler it can point up to 4K only.
Can anybody help me to get the answer?
Thank you in advance.
-Vijay |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
actually, the register only points at 1 bytes.
the offset part of the instruction
allows you to address memory in either direction of the 'byte addressed by the register'.
how many bytes are there in an instruction for the offset?. what is the max positive or negative value that can be represented? |
|
Back to top |
|
|
sandeep chopra
New User
Joined: 28 Aug 2008 Posts: 11 Location: Noida
|
|
|
|
Maximum displacement 12 bits can take is 4095 (FFF). So we need second register if you need to go further for which displacement will start from zero. You will get out of base message if u define a label which is having displacement more than 4095 from starting of program means from where u have given base. |
|
Back to top |
|
|
Harsh Pawar
New User
Joined: 04 Jun 2008 Posts: 25 Location: Noida
|
|
|
|
Any variable used in assembler program should have addressability.
If you see the instruction format and it is a type of instruction which uses storage then that storage should have addressability.
Example :
MVC is a SS type instruction. For every S (storage) we should have 2 bytes.
BDDD where B = base register (1-F) so it requires 4 bits for B.
DDD = Displacement 4 + 4 + 4 = 12 bits.
So lets say you are using register 12 for your base address , then B= C (C is in hex so in decimal it is 12).
Now what maximum value can DDD = 12 bits address ? 2power 12 = 4096.
This is how we got this 4 K limit for a program.
Please note that you may use multiple base addressability to make a program which is bigger then 4K.
Regards,
Harry |
|
Back to top |
|
|
nigelosberry
New User
Joined: 06 Jan 2009 Posts: 88 Location: Ggn, IN
|
|
|
|
It will be better if you try to visualize yourself why only 4096 bytes can be addressed USING a single base register.
To start with, you can have a look at the explicit format of an SS1 type instruction and see what are all the different components assembled in that instruction's object code and what each of them is meant for.
This is one of the very basic questions(and has been asked before a few times). In future please use the "search" option of the forum before putting any new question on board. |
|
Back to top |
|
|
|