I need 8085 cources ...

Discussion in 'Homework Help' started by Hannibal666, Apr 27, 2016.

  1. Hannibal666

    Thread Starter New Member

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

    I`m 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

    with examples please..
    ______
    and I need an explantion about this paper please :-

    sorry, but I`m in bad collage :(
     
  2. bertus

    Administrator

    Apr 5, 2008
    15,648
    2,348
    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
     
    Hannibal666 likes this.
  3. JohnInTX

    Moderator

    Jun 26, 2012
    2,347
    1,029
    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.
     
    Last edited: Apr 27, 2016
    Hannibal666 likes this.
  4. Hannibal666

    Thread Starter New Member

    Jan 25, 2016
    12
    0
    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
    ADD B
    STA 3322
    HLT -> run
    _____

    please I want to understand cause I have an exame
     
  5. Papabravo

    Expert

    Feb 24, 2006
    10,152
    1,793
    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.
     
    Hannibal666 likes this.
  6. absf

    Senior Member

    Dec 29, 2010
    1,493
    372
    Assuming all the address and data are in HEX.

    Code (Text):
    1. MVI b,3c  ;B REG=3CH
    2. MVI A,c2  ;A REG=C2H
    3. ADD B      ;A REG=A REG+B REG
    4. STA 3322  ;STORE A REG IN 3322H
    5. HLT          ;STOP PROGRAM
    6.  
    Allen
     
    Hannibal666 and JohnInTX like this.
  7. Hannibal666

    Thread Starter New Member

    Jan 25, 2016
    12
    0
    Code (Text):
    1.  
    2.  
    3. STA 3322  ;STORE A REG IN 3322H
    4.  
    5.  
    thank you very very much...

    but I have a last question please,

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

    Senior Member

    Dec 29, 2010
    1,493
    372
    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 (ASM):
    1. MOV   A,B      ;make A=B
    2. STA    3322H   ;store A into 3322H
    Allen

    p/s here is a 8085 cheat sheet which may be useful for learning 8085 ASM language...
     
    Hannibal666 and JohnInTX like this.
  9. JohnInTX

    Moderator

    Jun 26, 2012
    2,347
    1,029
    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.

    Here are a few things about the instruction set that may help you learn it.
    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.
     
    absf and Hannibal666 like this.
  10. Hannibal666

    Thread Starter New Member

    Jan 25, 2016
    12
    0
    very special thanks to you.. I have now 70% of fully understand of MVI and MOV and STA instructions..

    may I ask you another question please..
    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
    ADI 02h
    JMP : yy
    xx : MOV A,B
    ADI 05h
    yy : HLT


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

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

    Thread Starter New Member

    Jan 25, 2016
    12
    0
    thank you,
    but what is 8 bit arithmetic and logic operations ?

    and about "ADD B implies A = A+B."

    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?

     
  12. JohnInTX

    Moderator

    Jun 26, 2012
    2,347
    1,029
    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.
    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.
    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 (ASM):
    1.  
    2. ;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.
    3. ; y=x+5 if x>10
    4. ; y=x+2 if x <=10
    5. ; Σ N 50h;
    6.  
    7. ; Test: y=x+5 if x>10
    8. ; A register has 'x'.  Copy it to register B to save it
    9.   MOV B,A
    10. ;  Compare 'x' (in A) to 10 decimal (0Ahex) by subtracting  x (in A) - 10 (the immediate
    11. ; value in the instruction itself). If x >10, S will be 1 and the code will jump to the line labeled ;xx.
    12. ;If x<=10, no jump will occur and the code will flow to the next instruction.
    13. ;Note that the numerical result of the subtraction is placed back in A.  That's why
    14. ;we saved a copy of x in B for further use - the result replaces the original value.
    15.   SUI 0Ah
    16.   J S: xx  ; x>10  ; Usually, assemblers do NOT allow or require a ':' when referencing a label
    17.  
    18. ; x <= 10 so add x+2
    19.   MOV A,B ; get the saved copy of x to the accumulator A again.
    20.   ADI 02h ; add 2
    21.   JMP : yy ; unconditional jump to the line labeled yy
    22.  
    23. ; It jumps here when x>10
    24. xx : ; xx is a label so that the code above knows where to jump to
    25.   MOV A,B ; get the copy of x again
    26.   ADI 05h ; add 5 to it (note 05h == 5 in decimal too)
    27. ;* Code flows to the HLT
    28.  
    29. yy : ; labels should be on their own line and start in column 1
    30. HLT ; stop
    31.  
     
    Last edited: Apr 29, 2016
    absf likes this.
  13. absf

    Senior Member

    Dec 29, 2010
    1,493
    372
    Oops I can't do this one as well. Don't understand what is the 3rd and 6th instructions are doing...:p

    May be John can help.:)

    Allen
     
  14. JohnInTX

    Moderator

    Jun 26, 2012
    2,347
    1,029
    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: Apr 30, 2016
  15. Hannibal666

    Thread Starter New Member

    Jan 25, 2016
    12
    0
    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,



     
  16. JohnInTX

    Moderator

    Jun 26, 2012
    2,347
    1,029
    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).
    upload_2016-4-29_22-31-48.png

    For your code snippet:
    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: Apr 30, 2016
    absf likes this.
Loading...