# I need 8085 cources ...

#### Hannibal666

Joined Jan 25, 2016
12
Hi,
is anyone have microprocessor 8085 cources?

Im tired from looking for it on the internet..

I need an introduction for it and I need cources about :
instruction classified into :-
*Data Transfer instructions group
*Arithmatic instuctions group
*Logical instruction group
*Branch instruction group
*I/O and Machine Contorl group

______

sorry, but Im in bad collage

#### Attachments

• 72.4 KB Views: 16

#### bertus

Joined Apr 5, 2008
21,534
Hello,

Wich query did you use?
The following query will give you a lot of tutorials:
8085 tutorial

With it I found the attached PDF.

Bertus

#### Attachments

• 2 MB Views: 16

#### JohnInTX

Joined Jun 26, 2012
4,554
I worked with the 8085 for years. Everything you need to know about the processor and its assembly language is in the attached references.

The Family User's Manual describes the CPU hardware and has a brief introduction to the instruction set.

The Assembly Language Programming manual describes the instruction set in detail with examples and also describes how to construct an assembly language program using a typical assembler. Programming concepts, assembler control directives, programming techniques such as using macros, interrupts etc. are also covered.

The SDK-85 User's Manual actually describes an old experimenter's kit. It's no longer available but at the end of the document the complete assembler source code for the kit's firmware monitor is shown. Many useful subroutines are there and you can see how a real program is constructed. If you take a subroutine and examine the instructions step by step, you'll get a good idea of how each instruction works.

If you have questions about something specific, let us know.

Good luck.

#### Attachments

• 7.8 MB Views: 7
• 5.5 MB Views: 8
• 5.2 MB Views: 7
Last edited:

#### Hannibal666

Joined Jan 25, 2016
12
thank you MR.bertus and thank you johnlnTX
for helping and for pdfs,

may I know what is mean (HL)? in 8085
and what is that ? :-
MVI b,3c
MVI A,c2
STA 3322
HLT -> run
_____

please I want to understand cause I have an exame

#### Papabravo

Joined Feb 24, 2006
16,799
HL is a pair of 8-bit registers inside the processor. It is generally used as an address pointer for an indirect reference to memory, or as a 16-bit accumulator for sme arithmetic instructions.

#### absf

Joined Dec 29, 2010
1,949
Assuming all the address and data are in HEX.

Code:
MVI b,3c  ;B REG=3CH
MVI A,c2  ;A REG=C2H
ADD B      ;A REG=A REG+B REG
STA 3322  ;STORE A REG IN 3322H
HLT          ;STOP PROGRAM
Allen

#### Hannibal666

Joined Jan 25, 2016
12
Code:
STA 3322  ;STORE A REG IN 3322H
thank you very very much...

but I have a last question please,

why {STORE A REG IN 3322H}?
why not B reg...?

#### absf

Joined Dec 29, 2010
1,949
Code:
STA 3322  ;STORE A REG IN 3322H
thank you very very much...

but I have a last question please,

why {STORE A REG IN 3322H}?
why not B reg...?
The 8085 doesn't have the instruction STB 3322

But
if you want to store content of "B Reg" into address 3322H, you can do it in 2 instructions as follows:

Code:
MOV   A,B      ;make A=B
STA    3322H   ;store A into 3322H
Allen

p/s here is a 8085 cheat sheet which may be useful for learning 8085 ASM language...

#### Attachments

• 91.2 KB Views: 8

#### JohnInTX

Joined Jun 26, 2012
4,554
Allen's chart is an excellent reference. While learning, try to see the similarities in the various instructions and note the differences where they occur.

MOV instructions always copy the second register specified to the first one - for MOV B,A say 'MOVE to B from A'. Other processors are the other way around.

Some registers are more important than others:
A (accumulator) is one argument and the result of all 8 bit arithmetic and logic operations. It is implied in the instructions so it is not always specified i.e. ADD B implies A = A+B.

HL (register pair HL). Two individual registers that, depending on the instruction, can be used as a 16 bit address to perform operations on data in memory i.e. ADD, MVI etc. HL can be modified using the double add (DAD) instruction. HL can be swapped with the top of the stack. Note that pairs DE and BC can also be used as 16 bit pointers but are not as powerful - data accessed by them always uses A, no double add etc.

M is not a physical register but refers to the byte in memory pointed to by HL. ADD M adds the memory byte pointed to by HL to A and puts the result in A. This is called 'indirect addressing'.

PSW (processor status word) contains the various flags that are set by arithmetic, logical operations. It is paired with A. Frequently, PSW and A are PUSHed to the stack (PUSH PSW) to save A and the flags while doing something else then POPed to restore them.

When designing your programs, reserve A and HL for their 'special' capabilities and use the other registers (and RAM) for basic storage.

Good luck.

#### Hannibal666

Joined Jan 25, 2016
12
The 8085 doesn't have the instruction STB 3322

But
if you want to store content of "B Reg" into address 3322H, you can do it in 2 instructions as follows:

Code:
MOV   A,B      ;make A=B
STA    3322H   ;store A into 3322H
Allen

p/s here is a 8085 cheat sheet which may be useful for learning 8085 ASM language...
very special thanks to you.. I have now 70% of fully understand of MVI and MOV and STA instructions..

y=x+5 if x>10
y=x+2 if x <=10
Σ N 50h
MOV B,A
SUI 0Ah
J S : xx
MOV A,B
JMP : yy
xx : MOV A,B
yy : HLT

may you tell me what is that thing in details please? .in last exam all students couldnt answer that question about finding x value

and we use 8085 v3.4 in our bad collage..

#### Hannibal666

Joined Jan 25, 2016
12
MOV instructions always copy the second register specified to the first one - for MOV B,A say 'MOVE to B from A'. Other processors are the other way around.

Some registers are more important than others:
A (accumulator) is one argument and the result of all 8 bit arithmetic and logic operations. It is implied in the instructions so it is not always specified i.e. ADD B implies A = A+B.

HL (register pair HL). Two individual registers that, depending on the instruction, can be used as a 16 bit address

ADD M adds the memory byte pointed to by HL to A and puts the result in A. This is called 'indirect addressing'.

Good luck.
thank you,
but what is 8 bit arithmetic and logic operations ?

you mean instruction ADD is used just for A reg right?
after that reg B will be erased and reg A with its data will remain right?

and STA 2000H

I know it is mean store reg A in memory location 2000
but what is "H" letter?
is mean the first letter of HL symbol and we right 2000H not 2000HL for shortcut?

#### JohnInTX

Joined Jun 26, 2012
4,554
STA 2000H in this context, H means hex i.e. the value is expressed in hexadecimal 2000H = 8192 decimal. The assembler has its default radix (hex, decimal, octal etc) but its important to always express your numbers with the radix to avoid confusion.
you mean instruction ADD is used just for A reg? After that reg B will be erased and reg A with its data will remain right?
No, the other way around. A (the accumulator) gets the new calculated sum - the result - of what originally was in A added to what is in B. B (and any other register that may be added, subtracted or other operation) is unchanged.
but what is 8 bit arithmetic and logic operations ?
Adding, subtracting, ORing, ANDing and the like. The 8085 has a basic data size of 8 bits so the operations it provides use 8 bit registers (mostly). If you want bigger data like 16bits, you have to do the operations on each byte separately. Note that code flow is frequently determined by data values that are tested using arithmetic. In the example below, the variable 'x' is examined to see if it is greater than 10. There is no instruction that does that in the 8085 but there ARE instructions that will jump on the result of some arithmetic operation by examining the flags in the processor status word (PSW). In the example, x is compared to 10 by subtracting 10 from the unknown value x. If x was >10, the S bit will be set. The code does the subtraction then tests the result of the subtraction by jumping if the S bit is set. The net result is jump if x>10.
Code:
;These are comments that describe what the following routine(s) do.  You can tell by the fact ;that it looks different than the 8085 assembly language and instruction set.  The instructions ;following the comments do the arithmetic described.
; y=x+5 if x>10
; y=x+2 if x <=10
; Σ N 50h;

; Test: y=x+5 if x>10
; A register has 'x'.  Copy it to register B to save it
MOV B,A
;  Compare 'x' (in A) to 10 decimal (0Ahex) by subtracting  x (in A) - 10 (the immediate
; value in the instruction itself). If x >10, S will be 1 and the code will jump to the line labeled ;xx.
;If x<=10, no jump will occur and the code will flow to the next instruction.
;Note that the numerical result of the subtraction is placed back in A.  That's why
;we saved a copy of x in B for further use - the result replaces the original value.
SUI 0Ah
J S: xx  ; x>10  ; Usually, assemblers do NOT allow or require a ':' when referencing a label

; x <= 10 so add x+2
MOV A,B ; get the saved copy of x to the accumulator A again.

; It jumps here when x>10
xx : ; xx is a label so that the code above knows where to jump to
MOV A,B ; get the copy of x again
ADI 05h ; add 5 to it (note 05h == 5 in decimal too)
;* Code flows to the HLT

yy : ; labels should be on their own line and start in column 1
HLT ; stop

Last edited:

#### absf

Joined Dec 29, 2010
1,949
very special thanks to you.. I have now 70% of fully understand of MVI and MOV and STA instructions..

y=x+5 if x>10
y=x+2 if x <=10
Σ N 50h
MOV B,A
SUI 0Ah
J S : xx
MOV A,B
JMP : yy
xx : MOV A,B
yy : HLT

may you tell me what is that thing in details please? .in last exam all students couldnt answer that question about finding x value

and we use 8085 v3.4 in our bad collage..
Oops I can't do this one as well. Don't understand what is the 3rd and 6th instructions are doing...

May be John can help.

Allen

#### JohnInTX

Joined Jun 26, 2012
4,554
I don't understand the 3rd one either and wrote it off as a stray comment..
The 6th is a macro, I think. There is no actual JS instruction so I would guess that 'J' is the macro name and 'S' is a parameter that identifies the condition to test. As I noted, the colon is in a weird place, too. Based on the other code, I'd guess it evaluates to JP (jump on positive result) or JC? If the TS would post the assembler list file we could look at the generated machine code and see for sure.
I don't like it when macros and the like are used on a beginner.

Last edited:

#### Hannibal666

Joined Jan 25, 2016
12
thaaaaaaank you very much....

I have a another question please....

how can I get the status of flag from instructions?
in our exam they give us a program and they want from us to get the status of flags ?
from that example
MVI B,49
DCR B
MOV C,B
HLT -> run

from that example how we get the status of flags without looking on the program just on the paper,

#### JohnInTX

Joined Jun 26, 2012
4,554
Look at the detailed instruction descriptions in the 8085 Assembly Language Programming Manual 1977 linked above.
MVI is described on page 3-37
DCR on page 3-21
MOV on page 3-36

What each instruction does is described. Part of the description is what flags are affected.
MVI and MOV do not affect ANY flags. They just load a register and move data.
DCR is an arithmetic operation that does affect the flags. DCR decrements a register i.e. subtracts 1 from it. According to the description the Z,S,P, and AC flags are set or cleared according to the result after decrementing. If the register had a value of 1 to start with then after DCR, Z=1 (result is 0), S=0 (zero result is positive), P=1 (zero result has even parity) and AC=0 (no carry from bit 3 to 4).

In the case of DCR, you wouldn't likely care about P or AC but Z and S are useful. There is an example using DCR on page 3-21.
The image below is from the MCS-85 Family Reference (but surely in the Assembly Language manual too - just don't know where..) and it describes the flags in detail. The flags are contained in the Processor Status Word (PSW).

MVI B,49 ; loads 49 (decimal) into register B. We don't know what the flags are because we don't know what they started as and MVI does not change any flags.
DCR B ; Aha! DCR does change flags. The result in B is 49-1 = 48 and the flags will reflect that. The Z flag is 0 (result is Not Zero). S is set to 1 (result is a positive number i.e. MSBit of the result in B is 0). P=1 (48 decimal is 110000 - an even number of 1's). AC is cleared since there was no carry from bit 3 to 4 (P and AC are not really useful here).
MOV C,B ; MOV does not affect the flags so they are what they were before. You would express them as NZ, S. If the next instruction was JNZ, it would jump. If it was JZ, it would not jump. Note that testing Z tests for a zero result. Testing S (the sign) tests for underflow. Which one you would use depends on what you are doing, Z is the most common for loop counters, etc.
HLT -> run

Going a bit further, since MOV and MVI don't change the flags how would you test a value for Z or NZ without changing it? The answer is to do some arithmetic on the value that doesn't change it:
MOV A,M ; move a byte from memory to A - flag values are unknown.
ADI 0 ; add 0 to A, the value is unchanged but the flags are updated. ORI 0 does the same thing and is actually better - can you think of why?
JZ value_was_zero ; jumps if the byte in memory is 0

That's how it is done!
Have fun.

Last edited: