CO 4 TO 8

 

ASSIGNMENT-4

 

1.           How to install GNU 8085 simulator?

Open google chrome

Write gnu 8085 simulator

Click on GNU 8085 Simulator download SourceForge.net

Click on download

MOVED_TO_GITHUB.TXT  will be opened

Link is copied from text file and pasted on browser

GNUSim8085 will be opened

Click on all downloads

Click on gnusim8085-1.4.1-installer.exe

Install

Simulator screen will be opened

Click start   choose  GNUSim8085

2.       ;WAP to store 20H in memory location 4H

MVI A, 20H ; Store 20H in the accumulator

STA 4H     ;Copy accumulator contentsat address 4H

HLT            ; Terminate program execution

3.       ;WAP to add a number assigned to a register to a value present in accumulator

MVI       A,05H

MVI       C,06H

ADD       C

HLT

ASSIGNMENT-5

ASSIGNMENT-5

1.            WAP to add a number assigned to a register to a value present in accumulator

                MVI       A,05H

                MVI       C,06H

                ADD       C

                HLT

2.            WAP to input data to accumulator from  a port for addition operation

MVI       B,10H

IN           05H

ADD       B

OUT       08H

HLT

ASSIGNMENT-6

1.       WAP TO ADD TWO 8 BIT NUMBERS

;ADDITION OF TWO 8 BIT NUMBERS

LXI H, 0001H  ; "Get address of first number in H-L pair. Now H-L points to 0001H" 

MOV A, M      ; "Get first operand in accumulator" 

INX H         ; "Increment content of H-L pair. Now, H-L points 2502H" 

ADD M         ; "Add first and second operand" 

INX H         ; "H-L points 0003H" 

MOV M, A      ; "Store result at 0003H" 

HLT           ; "Stop"           

2.       WAP TO SUBTRACT TWO 8 BIT NUMBERS

; SUBTRACTION OF TWO 8 BIT NUMBERS

LXI H, 0001H  ; "Get address of first number in H-L pair. Now H-L points to 0001H" 

MOV A, M      ; "Get first operand in accumulator" 

INX H         ; "Increment content of H-L pair. Now, H-L points 2502H" 

SUB M         ; "Add first and second operand" 

INX H         ; "H-L points 0003H" 

MOV M, A      ; "Store result at 0003H" 

HLT           ; "Stop"           

ASSIGNMENT-7

1.

;PROGRAM TO ADD N CONSECUTIVE NUMBERS

LDA 00H 

MOV C, A            ; "Initialize counter" 

MVI B, 00H          ; "sum = 0" 

LXI H, 0001H        ; "Initialize pointer" 

BACK: MOV A, M      ; "Get the number" 

MOV A, B            ; "Get the sum" 

ADD M               ; "SUM = SUM + data" 

MOV B, A            ; "Store result in B register" 

INX H

DCR C               ; "Decrement counter" 

JNZ BACK            ; "if counter 0 repeat" 

STA 05H           ; "store sum" 

HLT                ; "Stop" 

2.

;WAP to find the largest number from a given series.

                LDA 00H

                MOV C, A ;Initialize counter

                XRA A  ;Maximum possible value = 0

                LXI H, 0001H  ;Initialize pointer

BACK:    CMP M  ;Is number> maximum

                JNC SKIP  ;Yes, replace maximum

                MOV A, M

SKIP:      INX H

                DCR C

                JNZ BACK

                STA 0008H  ;Store maximum number

                HLT  ;Terminate program execution

3.

;WAP to find the smallest number from a given series.

           

            LXI     H,000H

            MOV   B,M

            INX     H

            MOV   A,M

            DCR    B

LOOP: INX     H

            CMP    M

            JC        AHEAD

            MOV   A,M

AHEAD:         DCR    B

            JNZ     LOOP

            STA     0008H

            HLT

ASSIGNMENT-8

1. WAP to Add two 16-bit numbers

;Add two 16-bit numbers

 

LHLD 0001H  ; "Get 1st 16-bit number" 

XCHG        ; "Save 1st 16-bit number in DE" 

LHLD 0003H  ; "Get 2nd 16-bit number in H-L" 

DAD D       ; "Add DE and HL" 

SHLD 0005H  ; "Store 16-bit result in memory locations 0005H and 0006H". 

HLT         ; "Stop" 

2. WAP to subtract two 16-bit numbers

 

;SUBTRACT two 16 bit numbers

 

LHLD 0000H      ; "Get first 16-bit number in HL" 

XCHG            ; "Save first 16-bit number in DE" 

LHLD 0002H      ; "Get second 16-bit number in HL" 

MOV A, E        ; "Get lower byte of the first number" 

SUB L           ; "Subtract lower byte of the second number" 

MOV L, A        ; "Store the result in L register" 

MOV A, D        ; "Get higher byte of the first number" 

SBB H           ; "Subtract higher byte of second number with borrow" 

MOV H, A        ; "Store l6-bit result in memory locations 0004H and 0005H" 

SHLD 0004H      ; "Store l6-bit result in memory locations 0004H and 0005H" 

HLT             ; "Terminate program execution" 

3. WAP TO find 1's complement of a no

                LDA 0001H   ; "Get the number IN accumulator" 

                CMA         ; "take its complement" 

                STA 0002H   ; "Store result in 0002H" 

                HLT         ; "Stop" 

4.  WAP TO find 2's complement of a no.

LDA 0001H  ; "Get data in accumulator" 

CMA         ; "Take its 1's complement" 

ADI  01H   ; "Add one in the number" 

STA  0002H  ; "Store the result in 0002 H" 

HLT         ; "Stop" 

 

Comments