DIGIT-ARC read-only archive · snapshot: July 23, 2026

Assembly Language Discussion Thread

80 posts · originally from https://geek.digit.in/community/threads/assembly-language-discussion-thread.139964/

RITESH
RITESH Original post #1
May 1, 2011 at 3:36 PM
Hi,
i want to make program 8086, i am using emu 8086 stimulator, i want to know how to save data with variable name....??

Reply...........

please reply..............
krishnandu.sarkar
May 1, 2011 at 7:48 PM
Re: Assembly language programing in 8086up......!!

Looks like, no one here is much in to ASM programming.
RITESH
RITESH #3
May 1, 2011 at 10:05 PM
Re: Assembly language programing in 8086up......!!

Hi,
in 8085 STA add. was used to save data, but how to save in 8086 which instruction??
RITESH
RITESH #4
May 3, 2011 at 8:08 PM
Re: Assembly language programing in 8086up......!!

REply.............................
krishnandu.sarkar
May 3, 2011 at 8:45 PM
Re: Assembly language programing in 8086up......!!

Sorry mate, I suggest you to try somewhere else, I guess no one here is into ASM Programming. Otherwise you'd have got at least one reply.
arpanmukherjee1
May 3, 2011 at 11:25 PM
Re: Assembly language programing in 8086up......!!

really sorry that you are stuck.

cant you contact any person who has done micro-controller programming or knows PLC
EC guys or teachers might know
C
May 3, 2011 at 11:57 PM
Re: Assembly language programing in 8086up......!!

i have studied 8085.maybe i can assist u?
Anish
Anish #8
May 4, 2011 at 12:52 AM
Re: Assembly language programing in 8086up......!!

Hi ritesh, I saw this thread only today...

here we go...
its the same for both.
"STA add"

here add refers to address right?( i assume so as u didnt care to elaborate):grin:

The same way, you can store the contents of accumulator in the 8086 by the instruction

Code:
STA (16bit address)
Example:
STA 2634H

And also you can use indirect addressing, where the address to store the reg a contents are given in another register pair say B. and the syntax is

Code:
STAX (Reg pair)
Example
STAX B

Using the above code stores your accumulator contents to the address which is in the B register pair.

Hope this helps:)
RITESH
RITESH #9
May 7, 2011 at 9:55 PM
Re: Assembly language programing in 8086up......!!

Hi again,

i have used STA in 8086 emu stimulator but it was showing an error..!!
Anish
Anish #10
May 8, 2011 at 8:08 AM
Re: Assembly language programing in 8086up......!!

If its not working, then use the indirect addressing mode.
RITESH
RITESH #11
May 8, 2011 at 8:59 PM
Re: Assembly language programing in 8086up......!!

If its not working, then use the indirect addressing mode.
Yeah, i is working Indirect add.

OK, in 8086up 16 bit add. locate 64Kb + 4bit make it 1MB. as there are 4 segmemt of 64KB each i.e. 246KB then where rest of memory is used??
Anish
Anish #12
May 9, 2011 at 7:02 AM
Re: Assembly language programing in 8086up......!!

Sorry, i cant get you buddy... please make it clearer
RITESH
RITESH #13
May 10, 2011 at 10:31 PM
Re: Assembly language programing in 8086up......!!

Hi again,

as in 8086 up 1MB is the maximum memory of it to be used, in which 4 64KB is reserved for segment registers like DS,SS,CS,ES makes 256kb then what about of rest memory left??
Anish
Anish #14
May 10, 2011 at 10:54 PM
Re: Assembly language programing in 8086up......!!

Hey, you have misunderstood buddy... Intel 8086 microprocessor can address 1MB of memory and doesn't contain 1MB of memory.

As you know (i assume), 8086 has a 20 bit address bus, So it can access 2^20 = 1 MB of memory. To elaborate it, Even when you interface a 4 GB ram, our 8086 can use only 1MB and the remaining memory remain waste.

And about that registers, every processor contains some registers within them through which we manipulate our calculations

Understood eh?
RITESH
RITESH #15
May 11, 2011 at 9:03 AM
Re: Assembly language programing in 8086up......!!

HI,

In this fig. 4 segment are used for 256kb then what about rest of memory??
Anish
Anish #16
May 11, 2011 at 9:33 PM
Re: Assembly language programing in 8086up......!!

View attachment 4584

Hope you understand from the diagram....
RITESH
RITESH #17
May 12, 2011 at 8:29 AM
Re: Assembly language programing in 8086up......!!

That mean 746KB size is of IP register only??
Anish
Anish #18
May 12, 2011 at 10:33 AM
Re: Assembly language programing in 8086up......!!

Okay, lets get down to the facts... How can you say that each segment (cs,ds,es,ss) holds 64kb of memory
RITESH
RITESH #19
May 12, 2011 at 9:51 PM
Re: Assembly language programing in 8086up......!!

It is written in many course book, that mean we can expand it???
Only these 5 take memory or some more registers also??

Please reply.........
Anish
Anish #20
May 13, 2011 at 5:10 AM
Re: Assembly language programing in 8086up......!!

Hi Ritesh, Its clear that you misunderstood the architecture and working of the 8086 microprocessor... But don't worry, I will explain it to you.. But be patient while you read this as it will help you better understand the basics.

Intel 8086 microprocessor is a 16-bit microprocessor (means it can process a 16 combinations of 0's and 1's at a time).It has 40 pins in a DIP package.

And actually nobody cares about the total memory of all the internal registers in a processor, all we have to know is the wordlength(how many bits can the register hold) of the registers.

There are many different registers in 8086(hope 29 are there) such as accumulator, base pointer, stack pointer, instruction pointer, segment registers etc... you can find the complete list and explanation here

What matters is not the total memory the registers can hold.. its about how much memory can they access externally.. to explain this still deep,
When you are programming a 8086, you are actually entering your program in a external RAM not inside the processor (as a processor within itself doesn't have space to hold programs).
When you are working on a 8086 programming kit, you can see a separate RAM chip to hold the programs that you enter. So, you cannot write your program inside the processor itself.

The registers present inside the processor is used manipulate the data from the external memory you have interfaced (In this case the RAM). When simply referring to memory, it means external memory only.

Now, the processor will access the external memory space only with the help of the registers. The external memory space has a address specified to each block of 16-bit (since 8086 can process only 16-bit of information at a time).
The 8086 processor has 20 address pins in its physical structure(pins 2 to 16 plus 35 to 39).

This means it can access 1MB of external memory. Formula to calculate the amount of memory a processor can access is 2^(no.of.address lines), here there are 20 address lines so,

2^20 = 1048576 bytes = 1024 KB = 1MB

Unfortunately, internal registers of 8086 cannot hold 20 bits of address (to address 1MB) the longest register is only 16 bit in length. so, using registers, it can access

2^16 = 65536 bytes = 64KB

I hope this is where you confused. Using a single 16 bit register consecutively, It can access only 64KB of memory...
Now your question may be obviously, How the heck will it access 1MB of memory when a single register could hold only 16-bit address ?

The answer is, 8086 combines 2 registers of 16bit size(must be specified by the programmer to do so). Now, the first 16bit register contains the 16 address bits and the second 16bit register contains another 4 address bits so combined to give the 20 address bits to access 1MB of space... Many modern processors use this approach to address hell a lot of space with its minimal register width design.

you can get a more insight into this by following this link. I strongly recommend you to take a look at this as what i hav explained will not suffice.

BTW, i recommend you to buy the book if you dont have it..

"Microprocessor architecture and programming with 8085" by Ramesh Gaonkar

This book will surely enrich your knowledge in microprocessor field dude...

Hope yu understand dude.....and i am always happy to help....:smile:

Voila this is the longest post I've ever made in TDF!!!
RITESH
RITESH #21
May 13, 2011 at 10:03 AM
Re: Assembly language programing in 8086up......!!

Hi again,

please a small program how to use in & out port in 8085 stimulator??
Anish
Anish #22
May 13, 2011 at 3:20 PM
Re: Assembly language programing in 8086up......!!

Sorry dude, I dunno how to use the 8085 simulator..
Tried once but i dont like it like the processor kit :))

But let me give you a clear program in Assembly.

before that how to use the in and out instructions?

Code:
IN 8-bit port address

OUT 8-bit port address

IN instruction gets input from the user via the specified 8 bit port and stores it in the accumulator.
OUT instruction displays or makes available the contents of the accumulator on the specified port.

Now the simple program to add two numbers and display its result using IN and OUT

Code:
MVI B,34H
IN F2H
ADD B
OUT F3H
HLT

Explanation line by line:
1. Moves the hex value 34H into B register
2. Gets input via port F2H and stores it in accumulator
3. Adds the content of B register(34H) to the contents of accumulator (which you entered)
4. Displays the result or makes the result available at port F3H
5. Halts the program
RITESH
RITESH #23
May 13, 2011 at 4:40 PM
Re: Assembly language programing in 8086up......!!

The IN & out command are not dirctly connected to up in real i think for this PIO is used or not??

Sorry dude, I dunno how to use the 8085 simulator..
Tried once but i dont like it like the processor kit

If you want to run then you may download Oshon 8085 stimulator then select tool -> ass. write your simple ass. lang. program then Load it with compliling in above option given in ass., try this will help you..
Anish
Anish #24
May 13, 2011 at 7:14 PM
Re: Assembly language programing in 8086up......!!

If you want to run then you may download Oshon 8085 stimulator then select tool -> ass. write your simple ass. lang. program then Load it with compliling in above option given in ass., try this will help you..

I will surely give it a try.. But what is the use of learning assembly when there are much sophisticated languages such as python and c out there?

I advice you to learn python as it is easy and also widely popular language.
RITESH
RITESH #25
May 13, 2011 at 7:36 PM
Re: Assembly language programing in 8086up......!!

You know how to use 8085 up??
Anish
Anish #26
May 13, 2011 at 8:00 PM
Re: Assembly language programing in 8086up......!!

yes, i have used it in trainer kit in my lab practicals... and never used in any of my individual projects yet.

what is the use of old 8085 when there are advanced controllers such as PIC 16F877 ?????
RITESH
RITESH #27
May 13, 2011 at 9:24 PM
Re: Assembly language programing in 8086up......!!

Yeah, but i want to go with basic...., see my projects (signature)
RITESH
RITESH #28
May 15, 2011 at 11:26 AM
Re: Assembly language programing in 8086up......!!

In 8086 up the pin s3 & s4 are given for choosing which segment of memory to be used DS,ES,SS,CS how it choose memory by 2 bit as whole memory is of 20bits i.e. 1MB??
RITESH
RITESH #29
May 18, 2011 at 10:46 AM
Re: Assembly language programing in 8086up......!!

reply..............

reply.......................!!

please, reply.................................
noja
noja #30
May 18, 2011 at 3:30 PM
Re: Assembly language programing in 8086up......!!

I only know 8085 which is like reverse of 86
RITESH
RITESH #31
Jun 3, 2011 at 9:35 AM
Re: Assembly language programing in 8086up......!!

I only know 8085 which is like reverse of 86


What you know about it
Vyom
Vyom #32
Jun 5, 2011 at 5:26 PM
Re: Assembly language programing in 8086up......!!

In a few days I have my Assembly Exam of MCA (IGNOU). And I was about to make a thread, so that I can get assistance regarding learning this seemingly impossible language to learn, i.e., Assembly!

But this thread, seems to be a good place to do just that!
I have just 4 days to learn Assembly, which I hope, is enough. I think it's not impossible to learn Assembly, since, I already came from programming background (C, C++), and since my concepts are clear, of number systems.

Currently I am watching this YouTube tutorial to being grasping the concepts of Assembly.. and think it's a great starting point.
Here's the link:
YouTube - Assembly Language Tutorial
RITESH
RITESH #33
Jun 6, 2011 at 9:07 AM
Re: Assembly language programing in 8086up......!!

Yeah, i starts with basic and this will continues with ashish will here after exam.....
Anish
Anish #34
Jun 9, 2011 at 7:31 AM
Re: Assembly language programing in 8086up......!!

@Vineet: The problem with asm is that unlike other languages like c, python, its machine hardware oriented... i.e. Different keywords for different hardwares....which makes it difficuilt to the eyes of the world
RITESH
RITESH #35
Jun 9, 2011 at 1:33 PM
Re: Assembly language programing in 8086up......!!

Hi anish,

how to program use i/o port in 8085 up??
Vyom
Vyom #36
Jun 10, 2011 at 12:03 AM
Re: Assembly language programing in 8086up......!!

Well given Assembly exam. Without any knowledge of Assembly Language. Failed to learn even this time too.
Next would be my fourth attempt, but until then, I promise myself to learn Assembly by heart! If friends here help.
Anish
Anish #37
Jun 10, 2011 at 2:16 AM
Re: Assembly language programing in 8086up......!!

Hi anish,

how to program use i/o port in 8085 up??

In hardware(I mean u are having the processor) or software:?:
Prime_Coder
Jun 10, 2011 at 2:47 AM
Re: Assembly language programing in 8086up......!!

Is there any difference between 8085 programming and 8086 programming?
Anish
Anish #39
Jun 10, 2011 at 3:48 AM
Re: Assembly language programing in 8086up......!!

Is there any difference between 8085 programming and 8086 programming?

Sure.. like i said before, asm differs for different for hardwares... it may be same while compiling on a pentium or similar machine using a compiler. But when you directly program 8085, its coded in hex format and for 8086, assembley format.
RITESH
RITESH #40
Jun 10, 2011 at 9:16 AM
Re: Assembly language programing in 8086up......!!

In hardware(I mean u are having the processor) or software

I am talking about it stimulator software of 8085...
Anish
Anish #41
Jun 10, 2011 at 2:46 PM
Re: Assembly language programing in 8086up......!!

Sorry dude, not yet tried any simulator yet....
RITESH
RITESH #42
Jun 11, 2011 at 9:57 PM
Re: Assembly language programing in 8086up......!!

OK, i want make a program for dividing two no's ................
What will be the logic for it??
doomgiver
doomgiver #43
Jun 12, 2011 at 12:24 PM
Re: Assembly language programing in 8086up......!!

the DIV or IDIV operator will do fine

EMU8086 <-best site to learn from, imho

org <whatever>

mov <stuff var here>
mov <>
div <>

8086 instructions
RITESH
RITESH #44
Jun 12, 2011 at 6:12 PM
Re: Assembly language programing in 8086up......!!

I know 8086 dividing program, i want to know about 8085 up.....
Anish
Anish #45
Jun 13, 2011 at 4:24 PM
Re: Assembly language programing in 8086up......!!

repeated subtraction is the logic..

1. Get the divisor and divident
2. subtract the divisor as many times as you can without a carry
3. The number of times you can subtract without getting a carry is the quotient

For example, to divide 4 by two,
I am just writing the algorithm..
Code:
         move 4,r1   //4 is loaded in register 1
         move 2,r2   //2 is loaded in register 2
         clear r3      //register 3 is cleared to hold the quotient
start: sub r1,r2     //r2 contents (2) is subtrated from r1 contents(4) and answer is placed in r1
         inc r3         //r3 is incremented .i.e. we have succesfully subtracted 2 from 4 once
         jnc start     // if carry flag isnt set, go to the label start and continue the loop
end                    //if carry flag is set, end the program
RITESH
RITESH #46
Jun 13, 2011 at 10:21 PM
Re: Assembly language programing in 8086up......!!

Hi,

move 4,r1 ??
it should be mov r1,4....

& the program is not clear i have doubt pls explain it...........
Anish
Anish #47
Jun 13, 2011 at 10:25 PM
Re: Assembly language programing in 8086up......!!

^^ have i not stated that its just an algorithm dude?? ofcourse I didnt use the exact keywords
MetalheadGautham
Jun 14, 2011 at 5:00 AM
Re: Assembly language programing in 8086up......!!

Finished this course last semester and learnt 8086 and PIC16 assembly languages... Sheesh, wish I'd seen this thread sooner....
RITESH
RITESH #49
Jun 14, 2011 at 9:09 AM
Re: Assembly language programing in 8086up......!!

Pls give some more explanation ........
Anish
Anish #50
Jun 16, 2011 at 2:14 AM
Re: Assembly language programing in 8086up......!!

Hi ritesh, here is the program for dividing two numbers. In my example, i took 23h and divided it by 05h and the quotient is 07h. I've made quotient to appear in the register A.

Code:
 mvi a,23h
 mvi c,05h
 inr b
 sub c
 jnc 0004h
 dcr b
 mov a,b
 hlt

Here, you can replace 23h and 05h by any 8 bit number.:smile:
Prime_Coder
Jun 16, 2011 at 4:27 AM
Re: Assembly language programing in 8086up......!!

Anybody here, will you please elaborate what the following code does?

org 100
inp a
inp b
lod a
add b
str c
out a
b blo 1
c blo 1
hlt

I could guess that this code is for addition of 2 numbers, but what about that "str c" and all the next part? I couldn't understand that completely.
Anish
Anish #52
Jun 16, 2011 at 4:37 AM
Re: Assembly language programing in 8086up......!!

where did you get that code? please do refine it.
RITESH
RITESH #53
Jun 16, 2011 at 9:35 AM
Re: Assembly language programing in 8086up......!!

jnc 0004h

in this jump where it will go, at sub c??
doomgiver
doomgiver #54
Jun 16, 2011 at 2:42 PM
Re: Assembly language programing in 8086up......!!

it will check the carry flag, if it is not set, it will go to 0004h
Anish
Anish #55
Jun 16, 2011 at 9:14 PM
Re: Assembly language programing in 8086up......!!

in this jump where it will go, at sub c??

yeah.. it will repeat sub c until the carry flag is set. And the carry flag is set when the number is no more divisible.
RITESH
RITESH #56
Jun 17, 2011 at 9:32 PM
Re: Assemble language discussion thread

The program is working, but i don't understand its alog.....
Anish
Anish #57
Jun 17, 2011 at 10:11 PM
Re: Assemble language discussion thread

First understand how division is preformed in computers... To us all computer is a wonderful machine which does all sorts of work.. But actually, this machine knows nothing more than addition!. Subtraction is addition of negative numbers, multiplication is repeated addition, division is repeated addition of complementary dividend.

now, for example, what is 12/4?
answer is 3. we get it by a long hand division(remember grade 2 math)
but the computer does it some what like this:
takes 12 and calculates how many times 4 can be subtracted from it! its just simple as it is. 12-4=8(1 time) 8-4=4(2 times) 4-4=0(3 times). It can no longer subtract 4 from 0 with out carry. so it assumes the quotient to be 3.!

So, let me explain it line by line...

mvi a,23h - loads the a register with 23h
mvi c,05h - loads the c register with 05h
sub c - subtracts 05h from 23h and places the answer in a register
inr b - increments b register for each subtraction count of 05h from 23h
jnc 0004h - if the carry flag is not set, then it jumps to 4th memory location.
dcr b - this is for adjusting the calculation
mov a,b - This is needed just to move the answer to a register.
hlt - stops the program.
RITESH
RITESH #58
Jun 17, 2011 at 10:23 PM
Re: Assemble language discussion thread

Thanks............man..!!
RITESH
RITESH #59
Jun 20, 2011 at 9:34 PM
Hi again,

How to use SOD & SID in oshon 8085...

& write a program for 1 sec delay.........

Thanks.....!!
RITESH
RITESH #60
Jun 21, 2011 at 9:44 PM
Reply..................
Anish
Anish #61
Jun 21, 2011 at 10:25 PM
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.)
RITESH
RITESH #62
Jun 26, 2011 at 4:29 PM
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
Anish #63
Jun 27, 2011 at 9:42 PM
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:
RITESH
RITESH #64
Jun 28, 2011 at 9:18 PM
This is good one...!!
Thanks
RITESH
RITESH #65
Jul 1, 2011 at 9:30 AM
Hi anish,

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



thanks

Pls reply.....
Anish
Anish #66
Jul 1, 2011 at 3:28 PM
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
RITESH
RITESH #67
Jul 1, 2011 at 10:17 PM
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
Anish #68
Jul 2, 2011 at 3:44 PM
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
Anish #69
Jul 2, 2011 at 4:08 PM
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.
RITESH
RITESH #70
Jul 2, 2011 at 9:37 PM
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??
RITESH
RITESH #71
Jul 7, 2011 at 9:48 PM
reply please...........
Anish
Anish #72
Jul 9, 2011 at 7:17 AM
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.
RITESH
RITESH #73
Jul 15, 2011 at 10:13 AM
and while pushing....23 where 876 goes in fig??

then 876 has written by mistake, then it must by any 8 bit no.
Anish
Anish #74
Jul 15, 2011 at 10:07 PM
then 876 has written by mistake, then it must by any 8 bit no.

Yeah it must be a 8 bit number. But I mentioned that its only an example.:cool:
RITESH
RITESH #75
Jul 15, 2011 at 11:28 PM
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
Anish #76
Jul 16, 2011 at 3:29 PM
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.
RITESH
RITESH #77
Jul 16, 2011 at 10:01 PM
I have not seen that registers in book, but some guys and one teacher in lab was also saying like that............
RBX
RBX #78
Aug 27, 2011 at 1:29 AM
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.
Anish
Anish #79
Aug 31, 2011 at 9:45 PM
You are right dude... the correct answer is E2 (1110 0010) try the oshon 8085 simulator
May be the app works it out wrongly.

I've got the correct answer:

View attachment 5231
RBX
RBX #80
Sep 1, 2011 at 1:00 PM
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