• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
projectsgeek

ProjectsGeek

Download Mini projects with Source Code, Java projects with Source Codes

  • Home
  • Java Projects
  • C++ Projects
  • VB Projects
  • PHP projects
  • .Net Projects
  • NodeJs Projects
  • Android Projects
    • Project Ideas
      • Final Year Project Ideas
      • JSP Projects
  • Assignment Codes
    • Fundamentals of Programming Language
    • Software Design Laboratory
    • Data Structure and Files Lab
    • Computer Graphics Lab
    • Object Oriented Programming Lab
    • Assembly Codes
  • School Projects
  • Forum

Assembly Codes

How to convert Binary to Gray conversion

June 23, 2013 by ProjectsGeek 3 Comments

Binary to Gray conversion

 

Write a Program for Binary to Gray conversion in Assembly language . Algorithm for Binary-Gray conversion is given below and it can be easily implemented by this algorithm .

Algorithm for Binary to Gray conversion

 

Step I : Get the number whose gray code equivalent is to be found.

Step II : Add number with itself.

Step III : XOR this added result with the original number.

Step IV : Shift the XOR ed number by 1 bit position to the right to get the Gray equivalent.

Step V : Display the result.

Step VI : Stop.

Program for Binary to Gray conversion 

.model small  
 .data            
 a db 0AH  
 .code  
      mov      ax, @data           ; Initialize data section  
      mov      ds, ax  
      mov      al, a               ; Load number1 in al  
      mov      bl, al              ; get the number in bl also  
      mov      ah, 00h             ; ah=00  
      add      ax, ax              ; add contents of ax with itself   
      xor      bx, ax              ; xor the added contents with number itself  
      ror      bx, 01h             ; roll by 1 bit to right to get gray equivalent  
      mov      ax, bx              ; copy result to ax also  
      mov      ch, 02h             ; Count of digits to be displayed  
      mov      cl, 04h             ; Count to roll by 4 bits  
      mov      bh, al              ; Result in reg bh  
 l2:     rol      bh, cl           ; roll bl so that msb comes to lsb   
      mov      dl, bh              ; load dl with data to be displayed  
      and      dl, 0fH             ; get only lsb  
      cmp      dl, 09              ; check if digit is 0-9 or letter A-F  
      jbe      l4  
      add      dl, 07              ; if letter add 37H else only add 30H  
 l4:     add      dl, 30H  
      mov      ah, 02              ; Function 2 under INT 21H (Display character)  
      int      21H  
      dec      ch                  ; Decrement Count  
      jnz      l2  
      mov      ah, 4cH             ; Terminate Program  
      int      21H  
 end

 

How to Run this Program

 

For Running this program you should have installed Tasm on you computer .

C:\programs>tasm bin-gray.asm

Turbo Assembler Version 3.0 Copyright (c) 1988, 1991 Borland International

Assembling file: bin-gray.asm

Error messages: None

Warning messages: None

Passes: 1

Remaining memory: 438k

C:\programs>tlink bin-gray.obj

Turbo Link Version 3.0 Copyright (c) 1987, 1990 Borland International

Warning: No stack

C:\programs>bin-gray

0F

 

 

Other Projects to Try:

  1. Add 8 Bit BCD Numbers
  2. Assembly Programs
  3. 2s Complement of a Numbers Assembly Code
  4. Assembly Language Codes
  5. ASCII-Binary conversion in Assembly Language

Filed Under: Assembly Codes Tagged With: Assembly Codes

How to find 2’s Complement of a Number

June 23, 2013 by ProjectsGeek Leave a Comment

2’s Complement of a Number Assembly Language

 

Write a Program to find the 2’s Complement of number given by the user . Program should load number into register and then find 2’s Complement of Number .

Algorithm behind the 2’s Complement is given below and based on this strategy you can easily implement 2’s Complement program in Assembly Language .

Algorithm for 2’s Complement of Number:

 

Step I : Initialize the data memory.

Step II : Load the number in AX.

Step III : Find 2’scomplement of number.

Step IV : Display the result.

Step V : Stop.

Flow Chart

find 2’s Complement of a Number

Program for 2’s Complement : 

 

.model small                                          
 .data  
 a dw 1234H  
 .code  
      mov      ax, @data          ; Initialize data section       
      mov      ds, ax  
      mov      ax, a              ; Load number1 in ax                             
      neg      ax                 ; find 2's compement. Result in ax  
      mov      ch, 04h            ; Count of digits to be displayed  
      mov      cl, 04h            ; Count to roll by 4 bits  
      mov      bx, ax             ; Result in reg bx  
 l2:     rol      bx, cl          ; roll bl so that msb comes to lsb   
      mov      dl, bl             ; load dl with data to be displayed  
      and      dl, 0fH            ; get only lsb  
      cmp      dl, 09             ; check if digit is 0-9 or letter A-F  
      jbe      l4  
      add      dl, 07             ; if letter add 37H else only add 30H  
 l4:     add      dl, 30H  
      mov      ah, 02             ; Function 2 under INT 21H (Display character)  
      int      21H  
      dec      ch                 ; Decrement Count  
      jnz      l2  
      mov      ah, 4cH            ; Terminate Program  
      int      21H  
      end

 

How to Run this Program :

 

For Running this program you should have installed Tasm on you computer .

C:\programs>tasm 2’scomp.asm

Turbo Assembler  Version 3.0  Copyright (c) 1988, 1991 Borland International

Assembling file:   2’scomp.asm

Passes:            1

Remaining memory:  438k

C:\programs>tlink 2’scomp.obj

Turbo Link  Version 3.0 Copyright (c) 1987, 1990 Borland International

Warning: No stack

C:\programs>2’scomp

EDCC

Other Projects to Try:

  1. Add 8 Bit BCD Numbers
  2. Add Two 16 Bit BCD Numbers Code
  3. Mask Lower Nibble in Assembly Language Code
  4. Assembly Language Codes
  5. How to find 1’s complement of a number

Filed Under: Assembly Codes Tagged With: Assembly Codes

How to find 1’s complement of a number

June 22, 2013 by ProjectsGeek Leave a Comment

Find 1’s complement of a number

 

Algorithm for finding 1’s Complement

 

Step I : Initialize the data memory.

Step II : Load the number in AX.

Step III : Initialize counter = 16.

Step IV : Rotate number by 1 bit position to left with carry.

Step V : Complement carry.

Step VI : Decrement counter.

Step VII : Check if count = 0. If yes, go to step VIII else goto Step IV.

Step VIII : Rotate number by 1 bit position to left with carry to restore original carry back.

Step IX : Display 1’s complement.

Step X : Stop.

Program Code 1’s complement of a number:

.model small

.data

a dw 1234H

.code

mov ax, @data           ; Initialize data section

mov ds, ax

mov ax, a               ; Load number1 in ax

mov cx, 16              ; Load CX with count

up : rcl ax, 1          ; Rotate ax by 1bit to left with carry

cmc                     ; find 1's complement of bit

loop up                 ; check if all bits complemented, if not goto up

rcl ax, 1               ; return carry back to original position

mov ch, 04h             ; Count of digits to be displayed

mov cl, 04h             ; Count to roll by 4 bits

mov bx, ax              ; Result in reg bx

l2: rol bx, cl          ; roll bl so that msb comes to lsb

mov dl, bl              ; load dl with data to be displayed

and dl, 0fH             ; get only lsb

cmp dl, 09              ; check if digit is 0-9 or letter A-F

jbe l4

add dl, 07              ; if letter add 37H else only add 30H

l4: add dl, 30H

mov ah, 02              ; Function 2 under INT 21H

; (Display character)

int 21H

dec ch                  ; Decrement Count

jnz l2

mov ah, 4cH             ; Terminate Program

int 21H

end

 

Other Projects to Try:

  1. Add 8 Bit BCD Numbers
  2. Multiply Two 8 Bit Numbers using Add and Shift Method
  3. Count the Number of 1s in a Register
  4. How to find 2’s Complement of a Number
  5. 2s Complement of a Numbers Assembly Code

Filed Under: Assembly Codes Tagged With: Assembly Codes

Mask Upper Nibble in Assembly Language Program code

June 22, 2013 by ProjectsGeek Leave a Comment

Mask Upper Nibble

 

Write assembly programs to Mask Upper Nibble for that number should be loaded into the register and operation should be implemented on that loaded number .

  • Calculated result should be displayed in the output .

Algorithm for Mask Upper Nibble:

Step I : Load the number in AL.

Step II : Mask the upper nibble.

Step III : Display result.

Step IV : Stop.

Program for Mask Upper Nibble:

Mask Upper Nibble

 

 

 

 

.model small                           
 .data  
 a dw 0012H  
 .code  
      mov      ax, @data          ; Initialize data section  
      mov      ds, ax                                                                 
      mov      ax, a               ; Load number1 in ax  
      and      al, 0fh               ; mask upper nibble.Result in al  
      mov      ch, 02h          ; Count of digits to be displayed  
      mov      cl, 04h          ; Count to roll by 4 bits  
      mov      bh, al               ; Result in reg bh  
 l2:     rol      bh, cl               ; roll bl so that msb comes to lsb   
      mov      dl, bh               ; load dl with data to be displayed  
      and      dl, 0fH          ; get only lsb  
      cmp      dl, 09               ; check if digit is 0-9 or letter A-F  
      jbe      l4  
      add      dl, 07               ; if letter add 37H else only add 30H  
 l4:     add      dl, 30H  
      mov      ah, 02               ; Function 2 under INT 21H (Display character)  
      int      21H  
      dec      ch               ; Decrement Count  
      jnz      l2  
      mov      ah, 4ch  
      int      21h  
      end

 

Assembly programs

C:\programs>tasm upnib.asm

Turbo Assembler  Version 3.0  Copyright (c) 1988, 1991 Borland International

Assembling file:   upnib.asm

Passes:            1

Remaining memory:  438k

C:\programs>tlink upnib

Turbo Link  Version 3.0 Copyright (c) 1987, 1990 Borland International

Warning: No stack

C:\programs>upnib

Other Projects to Try:

  1. 2s Complement of a Numbers Assembly Code
  2. Add 8 Bit BCD Numbers
  3. Mask Lower Nibble in Assembly Language Code
  4. GCD of Two Numbers program in Assembly Language
  5. Program to Add Two 16 Bit Numbers Assembly Code

Filed Under: Assembly Codes Tagged With: Assembly Codes

Screen Saver using TSR program in 8086 ALP

September 9, 2011 by ProjectsGeek 4 Comments

Screen Saver using TSR program in 8086 ALP

Write a TSR program in 8086 ALP to implement Screen Saver. Screen Saver should get activated if the keyboard is idle for 7 seconds. Access the video RAM directly in your routine.

Screen Saver using TSR program in 8086 ALP code

CODE SEGMENT
        ASSUME CS:CODE,DS:CODE,ES:CODE
        ORG 100H
START : JMP BEGIN
        TIMER_IP DW ?
        TIMER_CS DW ?
        KB_IP DW ?  
        KB_CS DW ?
        FLAG DB 0
        CNT DB 180
        BUFFER DW 2000 DUP(0)
TIMER:
        PUSH AX
        PUSH BX
        PUSH CX
        PUSH DX
        PUSH SI
        PUSH DI
        PUSH DS
        PUSH ES

        MOV AX,CS
        MOV DS,AX
        MOV ES,AX

        CMP FLAG,00H
        JNE TIMER_END
        DEC CNT
        JNE TIMER_END

        CLD
        MOV AX,0B800H
        MOV DS,AX
        MOV SI,0000H
        MOV DI,OFFSET BUFFER
        MOV CX,2000
        REP MOVSW

        MOV AX,0B800H
        MOV ES,AX
        MOV DI,0000H
        MOV AL,48
        MOV AH,89
        MOV CX,2000
        REP STOSW

        MOV CS:FLAG,01H
TIMER_END:
        POP ES
        POP DS
        POP DI
        POP SI
        POP DX
        POP CX
        POP BX
        POP AX
JMP DWORD PTR CS:TIMER_IP

KB:
        PUSH AX
        PUSH BX
        PUSH CX
        PUSH DX
        PUSH SI
        PUSH DI
        PUSH DS
        PUSH ES

        MOV AX,CS
        MOV DS,AX
        MOV ES,AX

        MOV CNT,180
        CMP FLAG,01
        JNE KB_END

        CLD
        MOV AX,0B800H
        MOV ES,AX
        MOV SI,OFFSET BUFFER
        MOV DI,0000H
        MOV CX,2000
        REP MOVSW

        MOV FLAG,00H
KB_END :
        POP ES
        POP DS
        POP DI
        POP SI
        POP DX
        POP CX
        POP BX
        POP AX
JMP DWORD PTR CS:KB_IP

BEGIN:
        MOV AX,CS
        MOV DS,AX
        MOV ES,AX

        MOV AH,35H
        MOV AL,08H
        INT 21H

        MOV TIMER_IP,BX
        MOV TIMER_CS,ES

        MOV AH,35H
        MOV AL,09H
        INT 21H

        MOV KB_IP,BX
        MOV KB_CS,ES

        MOV AH,25H
        MOV AL,08H
        MOV DX,OFFSET TIMER
        INT 21H

        MOV AH,25H
        MOV AL,09H
        MOV DX,OFFSET KB
        INT 21H

        MOV AH,31H
        MOV DX,OFFSET BEGIN
        MOV CL,04H
        SHR DX,CL
        INC DX
        INT 21H

CODE ENDS
END START

 

Other Projects to Try:

  1. BCD to 7 Segment Code Conversion
  2. Transfer Block of N Bytes from Source to Destination
  3. GCD of Two Numbers program in Assembly Language
  4. Add 8 Bit BCD Numbers
  5. Program for Simulating AAA Instruction

Filed Under: Assembly Codes Tagged With: Assembly Codes

Transfer Block of N Bytes from Source to Destination

May 4, 2011 by ProjectsGeek 1 Comment

Transfer block of N bytes from source to destination 

Algorithm for Transfer block of N bytes
Step I          :   Initialize the data in the source memory and destination memory.
Step II         :   Initialize SI and DI with source and destination address.
Step III       :   Initialize CX register with the count.
Step IV       :   Initialize the direction flag to zero.
Step V         :   Transfer the data block byte by byte to destination.
Step VI       :   Decrement CX.
Step VII      :   Check for count in CX, if not zero goto step V else goto step VIII.
Step VIII    :   Display the bytes in destination location.
Step IX       :   Stop.
 

Transfer Block of N Bytes Code   

 

.model small  
 .data  
        src_blk db 01, 02, 03, 04, 05, 06, 07, 08, 09, 0AH  
        dest_blk db 10 dup(?)  
        count dw 0AH  
 .code   
        mov  ax, @data          ; initialize data  
        mov  ds, ax  
        mov  es, ax  
        mov  si, offset src_blk     ; si to point to source block  
        mov  di, offset dest_blk    ; di to point to destination block  
        mov  cx, count           ; initialize counter  
        cld                    ; df=0  
 again :  rep   movsb                   ; transfer contents  
        mov  di, offset dest_blk    ; di to point to  
                               ; destination block  
        mov  bh, 0Ah            ; initialize counter  
 up:     mov  bl, [di]             ; store result in bl  
        mov  cx, 0204h    ; Count of digits to be  
                         displayed in    
                         ; ch and digits to be  
                         mrolled in cl   
 l1:     rol   bl, cl        ; roll bl so that msb comes  
                         to lsb  
        mov  dl, bl        ; load dl with data to be  
                         displayed  
        and  dl, 0fh       ; get only lsb  
        cmp  dl, 09h      ; check if digit is 0-9    
                         ; or letter A-F  
        jbe   l12  
        add  dl, 07h            ; if letter add 37H      
                         ; else only add 30H  
 l12:    add  dl, 30h  
        mov  ah, 02       ; Function 02 under  
                         ; INT 21H                        
        int   21h  
        dec  ch          ; Decrement Count  
        jnz   l1  
        dec  bh          ; decrement counter  
        inc   di  
        mov  ah, 02h            ; display space        
                         ; between bytes  
        mov  dl, ' '  
        int   21h  
        cmp  bh, 00h            ; repeat till all bytes  
                         ; are displayed  
        jne   up  
        mov  ah, 4ch      ; normal termination  
                         ; to dos  
        int   21h  
 end

 

 

Other Projects to Try:

  1. Add 8 Bit BCD Numbers
  2. BCD to 7 Segment Code Conversion
  3. 2s Complement of a Numbers Assembly Code
  4. How to find 1’s complement of a number
  5. Multiply Two 8 Bit Numbers using Add and Shift Method

Filed Under: Assembly Codes Tagged With: Assembly Codes

  • Page 1
  • Page 2
  • Page 3
  • Interim pages omitted …
  • Page 6
  • Go to Next Page »

Primary Sidebar

Tags

.Net Projects Download Android Project Ideas Android Projects Angular 2 Assembly Codes C # Projects C & C++ Projects C++ Projects Class Diagrams Computer Graphics Database Project Data Mining Projects DataScience Projects Datastructure Assignments Download Visual Basic Projects Electronics project Hadoop Projects Installation Guides Internet of Things Project IOS Projects Java Java Interview Questions Java Projects JavaScript JavaScript Projects java tutorial JSON JSP Projects Mechanical Projects Mongodb Networking Projects Node JS Projects OS Problems php Projects Placement Papers Project Ideas Python Projects seminar and presentation Struts

Search this Website


Footer

Download Java Project
Download Visual Basic Projects
Download .Net Projects
Download VB Projects
Download C++ Projects
Download NodeJs Projects
Download School Projects
Download School Projects
Ask Questions - Forum
Latest Projects Ideas
Assembly Codes
Datastructure Assignments
Computer Graphics Lab
Operating system Lab
australia-and-India-flag
  • Home
  • About me
  • Contact Form
  • Submit Your Work
  • Site Map
  • Privacy Policy