Assembly Language Discussion Thread

Anish

Spectre
The SID and SOD pins are used as serial input and serial output data purpose..
SID: Serial input data - used to get one bit input and store it in the accumulator's MSB.
SOD: Serial output data - used to take one bit output from the accumulator's MSB (for external led glowing purposes.etc.)
 
Last edited:
OP
RITESH

RITESH

Broken In
reply please...............

Ok thanks..............

The SID and SOD pins are used as serial input and serial output data purpose..
SID: Serial input data - used to get one bit input and store it in the accumulator's MSB.
SOD: Serial output data - used to take one bit output from the accumulator's MSB (for external led glowing purposes.etc.)

I know the use of sod & sid but how to use in program...........??
 

Anish

Spectre
The 8085 microprocessor can accept and also deliver single bit serial data under some control conditions. i.e., when we pass some control word [Control word is a series of 8bits that controls the processor paramameters] to accumulator and execute some instructions operating on that control word and concerned with the serial data transfer, the task is accomplished based on the control word. To illustrate this more clearly, let us see an example.


First let us consider the serial input data (SID) - fifth pin in the processor IC. The serial input can be acquired by the processor using a instruction RIM(Read Interrupt Mask).RIM is a multi-purpose instruction. This RIM instruction operates on a control word that is stored in the accumulator (the a register). [i.e, when RIM is executed, it assumes that the content of the accumulator is a control word. So u must pass the control word in to the accumulator before executing the RIM instruction].
The format of the control word for RIM to operate on is given in the below table:

SID I7 I6 I5 IE 7.5 6.5 5.5

These are bits A7 to A0

SID (A7th bit): Serial Input Data bit (The bit you are giving as a serial input either 0 or 1)
I7,I6,I5 (A6-A4 bits): If set, corresponding interrupts are pending.
IE(A3rd bit): Interrupt Enable (Interrupts are enabled if its 1)
7.5,6.5,5.5(A2-A0 bits): If these bits are set, the corresponding interrupt is masked(disabled).
But for serial input data, the only bit that is useful is A7th bit. So, if SID is one, then the contents of the accumulator becomes [10000000] and if SID is zero, then the contents become[00000000].



Now consider Serial Output Data (SOD): - Fourth pin in the processor IC. But serial output data is made available using the SIM(Set Interrupt Mask) instruction. Same like RIM, SIM is also a multi-purpose instruction. Let us see the control word for the SIM instruction.

SOD SDE DONTCARE R7.5 MSE M7.5 M6.5 M5.5

SOD (A7th bit): Serial Output Data. Bit A7 of the accumulator is available at the SOD pin when SIM is executed. So, when A7 is 1, SOD is 1 and vice versa.
SDE (A6th bit): Serial Data Enable. If this bit is set to one, only then the processor considers the A7th bit. This bit is like ON/OFF switch for SOD.
Let us leave others for now.
So, if we consider a example,
mvi a,C0h (this instruction loads the accmululator with C0h)i.e[11000000] – clearly, the first bit is the SOD and second bit says, accept SOD. Or ON SOD.
SIM (this instruction makes 1 available as SOD.

That’s all for Explaining SOD and SID. :smile:

To see this in action, in your 8085 simulator,

For SID action, execute the example program:

Code:
RIM
HLT

The accumulator contents will be 80h and 00h depending on whether SID is 1 or 0.

For SOD action, execute the following program:

Code:
MVI a,C0h
SIM
HLT

After this program is executed, SOD is set to one.

Note: You have to manually set the SID but you have no control over the SOD button in the simulator

Hope this helps and I am clear all the way to the end. :mrgreen:
 
OP
RITESH

RITESH

Broken In
Hi anish,

i want understand Stack in deep, pls tell a program using it...!!



thanks

Pls reply.....
 

Anish

Spectre
Basic over view of stack: (May be help someone looking for this).
[Click show]
Stack is merely a list in which you can add or delete items at only one end. For example consider a stack of plates in a cafe, you would take the plates from one end (i.e top) and new plates will be placed at the same top. This is nice example of a stack. The removing of items from from a stack is called as "pop" operation and adding items to a stack is called as "push" operation. You cannot add or delete items other than the single end preferred (either top or bottom).
On contradiction, a queue can be considered as a double-sided stack! (you can add at one end and retrieve at other end).

Let us jump to the applications of stack;
Generally when executing an instruction, a processor listens to interrupts. When a high priority interrupt occurs, the processor now have to service the interrupt which disturbs the ongoing program or which pauses the ongoing program; suppose, the processor leaves the program and services the interrupt, then how will it continue the program from where it left? For this reason, a stack is used and the processor assumes a random memory location in the RAM and stores the current contents of the program counter, registers and other things its operating on. Now, then it stores the address of the stored info about the interrupted program in a register called STACK POINTER. After the interrupt is serviced, the processor looks into the stack pointer and then retrieves the info about the previous running program and continue the execution of the program. [I hope the above explanation is pretty much clear].
Below diagram gives the idea of the stack organization , the push and pop operations.

View attachment 4885

You can note from the diagram that, a pop operation actually doesn’t delete the value. But decrements the stack pointer to indicate that the stack doesn’t contain the top value (i.e., the size of stack is reduced by one unit) In our example, after the pop operation, the stack only contains 98,357 & 34. Note also the stack pointer registers that contain the address of the top value in the stack, and changes during the push and pop operation. When encountering the push operation, the stack pointer is incremented and old values are rewritten by new values.
Note: POP instruction doesn’t contain any arguments (it is going to delete the top most value)

Ok, now let us come to example program.. I’ve checked this program using 8085 simulator by Jubin Mitra.

LXI SP,C0A0
LXI B,1234H
LXI D,2030H
LXI H,1221H
PUSH B
PUSH D
POP D
PUSH H
HLT
 
OP
RITESH

RITESH

Broken In
LXI SP,0c0A0

showing error in this...!!

You cannot add or delete items other than the single end preferred (either top or bottom).

I have listen that you can add or delete only from top in Stack...
is this true??
by POP &PUSH

In that pic's i can't understand it....
as add. are from 2021H...2017...how??
 

Anish

Spectre
Hai,
its c0a0 and not 0c0a0.

Concerning, stack, forget about the top or bottom.. Its like this: you can edit a stack at only one end. The other end is locked. Generally in books its referred to as the top of the stack.

Ah.. that addresses, i forgot to mention that, an integer is four byte in size. So address of each integer differs by four byte. Savvy?
 

Anish

Spectre
Assembly is a very tough programming language and its excution is also very tough. Please give me some useful programming tips of Assembly

Who told you that... If you learn some high level language such as Visual basic, and java, you only learn the logic of programming and how to make programs into real working apps. But Assembly has dual benefits. If you want to become a electronic hobbyist, learning assembly will only complete you. Assembly is a language which is tightly bonded with the hardware you are working with. So it is hard to learn assembly with out the knowledge of the hardware you program for. So, you learn both the programming and also the hardware architecture side by side.
 
OP
RITESH

RITESH

Broken In
Hai,
its c0a0 and not 0c0a0.

Concerning, stack, forget about the top or bottom.. Its like this: you can edit a stack at only one end. The other end is locked. Generally in books its referred to as the top of the stack.

Ah.. that addresses, i forgot to mention that, an integer is four byte in size. So address of each integer differs by four byte. Savvy?

Hello again,

You have written 876, 98, 357 in stack as in 8085 up it is 16 bit stack, but i don't get this???
and while pushing....23 where 876 goes in fig??
 

Anish

Spectre
Hello again,

You have written 876, 98, 357 in stack as in 8085 up it is 16 bit stack, but i don't get this???

Thats just an example dude.. ofcourse, you can implement only 8 bit numbers in 8085 using single register.
and while pushing....23 where 876 goes in fig??

You gotta read it again dude... read the last line in stack explanation. Did I miss telling that the values will be replaced?

reply please..............
wait till someone replies buddy, dont be in a hurry posting lame posts like this.. you may be warned or banned by the mods.
 
OP
RITESH

RITESH

Broken In
I have listen from friend that 8085 has some registers like x,y i am not sure what was the name but it was last alphaphets only...!!

what the use of them, i have not studied them in book.
 

Anish

Spectre
You gotta need to go through the architecture of 8085 and you can solve it for yourself. The processor itself has only seven 8 bit register. A,B,C,D,E,H and L. You must know well about the architecture of the processor before starting to learn assembley.
 
OP
RITESH

RITESH

Broken In
I have not seen that registers in book, but some guys and one teacher in lab was also saying like that............
 

RBX

In the zone
Need help understanding DAA for 8085

This is what I found in Jubin Mitra's 8085 Simulator -
The contents of the accumulator are changed from a binary
value to two 4-bit binary coded decimal (BCD) digits. This is
the only instruction that uses the auxiliary flag to perform the
binary to BCD conversion, and the conversion procedure is
described below. S, Z, AC, P, CY flags are altered to reflect
the results of the operation.

If the value of the low-order 4-bits in the accumulator is
greater than 9 or if AC flag is set, the instruction adds 6 to the
low-order four bits.

If the value of the high-order 4-bits in the accumulator is
greater than 9 or if the Carry flag is set, the instruction adds 6
to the high-order four bits.

And this was the code I was working with -
Code:
LXI H,8028
MOV A,M
MVI C,00
INX H
ADD M
DAA
JNC 800D
INR C
INX H
MOV M,A
INX H
MOV M,C
HLT

8028 holds 0x91
8029 holds 0xF1


After Addition (ADD M), the
accumulator was 82 = 10000010
Flag was 10*0*1*1 (AC = 0, CY = 1)

after DAA -
accumulator was 46 = 01000110
Flag was 10*0*1*1 (AC = 0, CY = 1) [same as above].

Now if we look a 82's binary.
Lower order 4 digits = 0010 = 2 AND AC!= 1, so no changes should be made
Higher order 4 digits = 1000 = 8 BUT CY==1, so 6 should be added

adding 6 to 1000 yields 1110 but the result in accumulator 01000110 doesn't make me feel that anything like 6 was added to it.
 

RBX

In the zone
Thanks! But I guess I'm a bit too late. I've eaten quite much of my teacher's brain on this taking Jubin Mitra's simulator correct. :p
 
Top Bottom