;program to implement matrix multiplication
Showing posts with label MICROPROCESSORS. Show all posts
Showing posts with label MICROPROCESSORS. Show all posts
Thursday, November 7, 2013
PROGRAM TO IMPLEMENT MATRIX MULTIPLICATION
Wednesday, October 30, 2013
HOW TO RUN 8086 ON WINDOWS
TOPIC : HOW TO RUN 8086 ON WINDOWS
REQUIREMENTS : TASM ,Debugger to assemble link and create object and exe files for your program as well as to debug it.
here is download link:
http://dl.dropboxusercontent.com/u/25051673/tasm5.zip
http://dl.dropboxusercontent.com/u/25051673/afdebug.zip
STEPS:
1.Extract these files in this folder
and now open the command prompt and change the directory to this folder.
2.copy the program and paste it in the notepad/Editplus.
save it in the bin folder with extension .asm
3.Now type tasm followed by the program name with .asm extension
tasm filename.asm
press enter this will show your errors. correct all these errors then proceed to the next step.
4.now type tlink followed by the program name with extension .obj
tlink filename.obj
press enter
5.now type the td followed by the program name with extension .exe
td filename.exe
6.then your program appears in different screen.
press F7 key until you reach the starting address of the program.
To open the dump window press ctrl+g
6.then a dialog box will appear. enter the starting address of the program which is typed in the program. for ex 2000h.
then press enter. and close the dialog box.
8.now continue pressing F7. when the program terminates it shows a dialog box. and the result will be seemed in the dump window
VIDEO LINK: http://www.youtube.com/watch?v=oUmCi2He84o
REQUIREMENTS : TASM ,Debugger to assemble link and create object and exe files for your program as well as to debug it.
here is download link:
http://dl.dropboxusercontent.com/u/25051673/tasm5.zip
http://dl.dropboxusercontent.com/u/25051673/afdebug.zip
STEPS:
1.Extract these files in this folder
and now open the command prompt and change the directory to this folder.
2.copy the program and paste it in the notepad/Editplus.
save it in the bin folder with extension .asm
3.Now type tasm followed by the program name with .asm extension
tasm filename.asm
press enter this will show your errors. correct all these errors then proceed to the next step.
4.now type tlink followed by the program name with extension .obj
tlink filename.obj
press enter
5.now type the td followed by the program name with extension .exe
td filename.exe
6.then your program appears in different screen.
press F7 key until you reach the starting address of the program.
To open the dump window press ctrl+g
6.then a dialog box will appear. enter the starting address of the program which is typed in the program. for ex 2000h.
then press enter. and close the dialog box.
8.now continue pressing F7. when the program terminates it shows a dialog box. and the result will be seemed in the dump window
VIDEO LINK: http://www.youtube.com/watch?v=oUmCi2He84o
16 BIT ADDITION WITH CARRY
;16 BIT ADDITION WITH CARRY
.model small
.data
num1 dw 0FFFFH
num2 dw 0DDDDH
sum dw ?
carry db ?
.code
START:
MOV AX,@data
MOV DS,AX
MOV AX,0000H
MOV AX,num1
MOV BX,num2
ADD AX,BX
MOV DL,00H
ADC DL,00H
MOV sum,AX
MOV carry,DL
MOV AX,4C00H
INT 21H
END START
;da:0000 CD 21 FF FF(num1) DD DD(num2) DC DD(sum)
;01(carry)
8-bit addition register adddressing mode with carry
;Aim - 8-bit addition register adddressing mode with carry
.8086
.model small
.data
num1 db 05h
num2 db 0eh
sum db ?
carry db ?
.code
start:
mov ax , @data
mov ds , ax
mov ax , 0000h
mov al, num1
mov bl , num2
add al , bl
mov dl , 00
adc dl , 00
mov carry , dl
mov ax , 4c00h
int 21h
end start
;Result
;DS:0001 05(NUM1)
;DS:0002 0E(NUM2)
;0005 01
;SUM 23
;CARRY 00
Aim - 8-bit addition register adddressing mode without carry
;Aim - 8-bit addition register adddressing mode without carry
.8086
.model small
.code
start:
mov ax , 1200h
mov ds , ax
mov ax , 0000h
mov al , 05h
mov bl , 04h
add al , bl
mov ax , 4c00h
int 21h
end start
; Result
;0000+0012=0012
.8086
.model small
.code
start:
mov ax , 1200h
mov ds , ax
mov ax , 0000h
mov al , 05h
mov bl , 04h
add al , bl
mov ax , 4c00h
int 21h
end start
; Result
;0000+0012=0012
16-bit Subtraction register adddressing mode with carry
; Aim - 16-bit Subtraction register adddressing mode with carry
.8086
.model small
.data
num1 dw 0aaaah ;Load aaaah to Num1
num2 db 0ffffh ;Load ffffh to Num2
ans dw ?
carry db ?
.code
Start:
mov ax , @data ;Copying the address of the data to AX.
mov ds , ax
mov ax , 0000h
mov ax , num1 ;Copies Num1 to AX.
mov bx , num2
sub cx , dx ;Subtracts DX from CX.
mov ah , 00h
mov ans,cx
lahf ;Loads all the flags to AH.
AND ah,01h
mov borrow , ah
mov ax , 4c00h
int 21h
end start
;Result
;DS:0000 0AAAA(NUM1)
;DS:0000 0FFFF(NUM2)
;ds:00008 0AAAB(ans)
;ds:00008 01 (borrow)
.8086
.model small
.data
num1 dw 0aaaah ;Load aaaah to Num1
num2 db 0ffffh ;Load ffffh to Num2
ans dw ?
carry db ?
.code
Start:
mov ax , @data ;Copying the address of the data to AX.
mov ds , ax
mov ax , 0000h
mov ax , num1 ;Copies Num1 to AX.
mov bx , num2
sub cx , dx ;Subtracts DX from CX.
mov ah , 00h
mov ans,cx
lahf ;Loads all the flags to AH.
AND ah,01h
mov borrow , ah
mov ax , 4c00h
int 21h
end start
;Result
;DS:0000 0AAAA(NUM1)
;DS:0000 0FFFF(NUM2)
;ds:00008 0AAAB(ans)
;ds:00008 01 (borrow)
8-bit Subtraction register adddressing mode with borrow
;8-bit Subtraction register adddressing mode with borrow
.8086
.model small
.data
num1 db 0ah
num2 db 0Fh
ans db ?
carry db ?
.code
Start:
mov ax , @data ; Copying the address of the data to AX.
mov ds , ax
mov ax , 0000h
mov al , num1 ; Copies Num1 to AL.
mov bl , num2
sub al , bl ;Subtracts BL fron AL.
mov ah , 00h
mov ans,al
lahf ;Loads all the flags to AH.
AND ah,01h
mov carry , ah
mov ax , 4c00h
int 21h
end start
;Result
;DS:0000 0A(NUM1)
;DS:0000 0F(NUM2)
;ds:00008 0FA(ans)
;ds:00008 01 (ans)
.8086
.model small
.data
num1 db 0ah
num2 db 0Fh
ans db ?
carry db ?
.code
Start:
mov ax , @data ; Copying the address of the data to AX.
mov ds , ax
mov ax , 0000h
mov al , num1 ; Copies Num1 to AL.
mov bl , num2
sub al , bl ;Subtracts BL fron AL.
mov ah , 00h
mov ans,al
lahf ;Loads all the flags to AH.
AND ah,01h
mov carry , ah
mov ax , 4c00h
int 21h
end start
;Result
;DS:0000 0A(NUM1)
;DS:0000 0F(NUM2)
;ds:00008 0FA(ans)
;ds:00008 01 (ans)
To move a block of 10 databytes from source to destination
; To move a block of 10 databytes from source to destination
.8086
.model small
.data
src1 db 10h, 20h ,30h, 40h, 50h, 60h, 70h, 80h, 90h, 0ah
Des1 db 0ah dup(0)
.code
START:
mov ax , @data
mov ds , ax
mov es , ax
lea si , src1
lea di , des1
mov cx , 000ah
rep movsb
mov ax,4c00h
int 21h
end start
;output
(000a)
.8086
.model small
.data
src1 db 10h, 20h ,30h, 40h, 50h, 60h, 70h, 80h, 90h, 0ah
Des1 db 0ah dup(0)
.code
START:
mov ax , @data
mov ds , ax
mov es , ax
lea si , src1
lea di , des1
mov cx , 000ah
rep movsb
mov ax,4c00h
int 21h
end start
;output
(000a)
To calculate the power of a number
;Aim:- To calculate the power
.8086
.model small
.data
msg1 db 13,10, "enter the number-:$"
msg2 db 13,10, "enter the power-:$"
msg3 db 13,10, "the answer-:$"
.code
START:
MOV AX,@data
MOV DS,AX
LEA DX,msg1 ;loads the offset of MSG1 in dx
MOV AH,09H
INT 21H
MOV AH,01H
INT 21H
MOV BL,AL
LEA DX,msg2 ;loads the offset of MSG2 in dx
MOV AH,09H ;Display s string
INT 21H ;Whose offset is in dx
MOV AH,01H
INT 21H
MOV CL,AL
SUB CL,30H ;Subtract bl from ASCII 30H
SUB BL,30H
MOV AH,00H
MOV AL,01H ;Take input from keyboard
BACK:MUL BL
DEC CL
JNZ BACK
MOV BL,AL
LEA DX,msg3 ;loads the offset of MSG3 in dx
MOV AH,09H
INT 21H
MOV DL,BL
ADD DL,30H
MOV AH,02H
INT 21H
MOV AX,4C00H
INT 21H
END START
;Output
;Enter the number:3
;Enter the power:2
;the answer is-:9
.8086
.model small
.data
msg1 db 13,10, "enter the number-:$"
msg2 db 13,10, "enter the power-:$"
msg3 db 13,10, "the answer-:$"
.code
START:
MOV AX,@data
MOV DS,AX
LEA DX,msg1 ;loads the offset of MSG1 in dx
MOV AH,09H
INT 21H
MOV AH,01H
INT 21H
MOV BL,AL
LEA DX,msg2 ;loads the offset of MSG2 in dx
MOV AH,09H ;Display s string
INT 21H ;Whose offset is in dx
MOV AH,01H
INT 21H
MOV CL,AL
SUB CL,30H ;Subtract bl from ASCII 30H
SUB BL,30H
MOV AH,00H
MOV AL,01H ;Take input from keyboard
BACK:MUL BL
DEC CL
JNZ BACK
MOV BL,AL
LEA DX,msg3 ;loads the offset of MSG3 in dx
MOV AH,09H
INT 21H
MOV DL,BL
ADD DL,30H
MOV AH,02H
INT 21H
MOV AX,4C00H
INT 21H
END START
;Output
;Enter the number:3
;Enter the power:2
;the answer is-:9
to find no of ones and zeroz
;title:to find no of ones and zeroz
.model small
.data
a db 05H
num db ? ;stores input no
.code
start:
mov ax,@data
mov ds,ax
mov dx,0000H
mov cx,0000H
mov bx,08H ;storing 8 in bx counter
mov al,num
back:ror ax,1 ;rotate al by 1
jnc abc ;jump if carry
inc dx ;increment dx
abc:inc cx
dec bx
jnz back ;jump if zero
mov ax,4c00h
int 21h
end start
;output
;input nos 0000 0101
no of 0s:Cx:6
no of 1s:Dx:2
.model small
.data
a db 05H
num db ? ;stores input no
.code
start:
mov ax,@data
mov ds,ax
mov dx,0000H
mov cx,0000H
mov bx,08H ;storing 8 in bx counter
mov al,num
back:ror ax,1 ;rotate al by 1
jnc abc ;jump if carry
inc dx ;increment dx
abc:inc cx
dec bx
jnz back ;jump if zero
mov ax,4c00h
int 21h
end start
;output
;input nos 0000 0101
no of 0s:Cx:6
no of 1s:Dx:2
16-bit multiplication direct addressing mode
;16-bit multiplication direct addressing mode
.model small
.data
num1 dw 1234h
num2 dw 0100h
product dw ?
.code
start:
mov ax,@data
mov ds,ax
mov ax,num1
mov bx,num2
mul bx
;multiplies data in bx with ax
;stores msb in dx and lsb in ax
mov product,ax
mov ax,4c00h
int 21h
end start
;Output
;AX=1234
;BX=0100
;AFTER MULTILICATION
;AX=3400
.model small
.data
num1 dw 1234h
num2 dw 0100h
product dw ?
.code
start:
mov ax,@data
mov ds,ax
mov ax,num1
mov bx,num2
mul bx
;multiplies data in bx with ax
;stores msb in dx and lsb in ax
mov product,ax
mov ax,4c00h
int 21h
end start
;Output
;AX=1234
;BX=0100
;AFTER MULTILICATION
;AX=3400
to study Interrupts
;to study Interrupts
.8086
.model small
.data
msg1 db 13,10 "Enter no. to be displayed.$"
msg2 db 13,10 "display enteries.$"
.code
Start:
Mov ax,@data
mov ds,ax
back:lea msg1,dx
mov Ah,09h
INT 21
MOv Ah,01h
INT 21h
cmp al,30h
jz lebel1
lea msg2,dx
Mov Ah,02h
int 21h
mov dl,al
lebel1:mov ax,4C00h
int 21H
jmp back
End start
;Result
;ds:0008: 10h,20h,30h,40h,50h,60h,70h,80h,90h,0ah(src) 10h,20h,30h,40h,50h,60h,70h,80h,90h,0ah des
.8086
.model small
.data
msg1 db 13,10 "Enter no. to be displayed.$"
msg2 db 13,10 "display enteries.$"
.code
Start:
Mov ax,@data
mov ds,ax
back:lea msg1,dx
mov Ah,09h
INT 21
MOv Ah,01h
INT 21h
cmp al,30h
jz lebel1
lea msg2,dx
Mov Ah,02h
int 21h
mov dl,al
lebel1:mov ax,4C00h
int 21H
jmp back
End start
;Result
;ds:0008: 10h,20h,30h,40h,50h,60h,70h,80h,90h,0ah(src) 10h,20h,30h,40h,50h,60h,70h,80h,90h,0ah des
8 bit Multiplication of signed bit
;Aim:- 8 bit Multiplication of signed bit
.8086
.model small
.data
num1 db 0FFh
num2 db 0FEh
product db ?
.code
Start:
Mov ax,@data
mov ds,ax
mov ax,0000h
mov al,num1
mov bl,num2
imul cl ;Multiplies Bl wit Al and the result in Cl Retaining the second bit
mov product,al ; Copies Al to product variable
mov ax,4C00h
int 21H
End start
;result
;DS :0000 1000h(num1) 0ffffh(num2)
;DS:0008 0fffh(sum) 01 carry
.8086
.model small
.data
num1 db 0FFh
num2 db 0FEh
product db ?
.code
Start:
Mov ax,@data
mov ds,ax
mov ax,0000h
mov al,num1
mov bl,num2
imul cl ;Multiplies Bl wit Al and the result in Cl Retaining the second bit
mov product,al ; Copies Al to product variable
mov ax,4C00h
int 21H
End start
;result
;DS :0000 1000h(num1) 0ffffh(num2)
;DS:0008 0fffh(sum) 01 carry
To input the number and display untill 0 is passed
;Aim:- To input the number and display untill 0 is passed
.8086
.model small
.data
msg1 db 13,10, "enter a character to be displayed:$"
msg2 db 13,10, "displaying entered character:$"
.code
START:
MOV AX,@data
MOV DS,AX
Again:LEA DX,msg1 ;loads the offset of MSG1 in dx
MOV AH,09H ;Display s string
INT 21H ;Whose offset is in dx
MOV AH,01H
INT 21H
CMP AL,30H
jz label1
MOV BL,AL
LEA DX,msg2 ;loads the offset of MSG2 in dx
MOV AH,09H
INT 21H
MOV DL,BL
MOV AH,02H
INT 21H
jmp Again
label1: MOV AX,4C00H
INT 21H
END START
;Output
enter a character to be displayed: d
displaying entered character: d
.8086
.model small
.data
msg1 db 13,10, "enter a character to be displayed:$"
msg2 db 13,10, "displaying entered character:$"
.code
START:
MOV AX,@data
MOV DS,AX
Again:LEA DX,msg1 ;loads the offset of MSG1 in dx
MOV AH,09H ;Display s string
INT 21H ;Whose offset is in dx
MOV AH,01H
INT 21H
CMP AL,30H
jz label1
MOV BL,AL
LEA DX,msg2 ;loads the offset of MSG2 in dx
MOV AH,09H
INT 21H
MOV DL,BL
MOV AH,02H
INT 21H
jmp Again
label1: MOV AX,4C00H
INT 21H
END START
;Output
enter a character to be displayed: d
displaying entered character: d
To count number of zeros and ones
;To count number of zeros and ones
.8086
.model small
.data
num db 05h ;Storing 05h number as our original number
.code
start:
mov ax,@data
mov ds,ax
mov dx,0000h
mov cx,0000h
mov bx,08h ;Storing 08 in bx as a counter
mov al,num
BACK: ROR Al,1 ;Rotate al by 1
JNC TG ;Jump if no carry
INC dx ;Increment counter dx
TG: INC cx
DEC bx
JNZ BACK
mov ax,4c00h
INT 21H
END start
;Output
;Num:05H
;cx:06h
;dx:02h
.8086
.model small
.data
num db 05h ;Storing 05h number as our original number
.code
start:
mov ax,@data
mov ds,ax
mov dx,0000h
mov cx,0000h
mov bx,08h ;Storing 08 in bx as a counter
mov al,num
BACK: ROR Al,1 ;Rotate al by 1
JNC TG ;Jump if no carry
INC dx ;Increment counter dx
TG: INC cx
DEC bx
JNZ BACK
mov ax,4c00h
INT 21H
END start
;Output
;Num:05H
;cx:06h
;dx:02h
To find average of 5 numbers
;title:To find average of 5 numbers
;no:6483
.model small
.data
src1 db 02H,04H,06H,02H,02H
sum db 00H
avg db ?
.code
start:
mov ax,@data
mov ds,ax
mov cx,05H
lea si,src1
mov dl,05H
back: mov al,[si]
add sum,al
inc si
dec cx
jnz back
div al
mov ax,4c00h
int 21h
end start
; output
;ax=6
;no:6483
.model small
.data
src1 db 02H,04H,06H,02H,02H
sum db 00H
avg db ?
.code
start:
mov ax,@data
mov ds,ax
mov cx,05H
lea si,src1
mov dl,05H
back: mov al,[si]
add sum,al
inc si
dec cx
jnz back
div al
mov ax,4c00h
int 21h
end start
; output
;ax=6
Saturday, October 26, 2013
PROJECT FREELANCER SPOTTED!!
PROJECT FREELANCER SPOTTED!!
Description : He works on and freelances for students struggling with projects .Students from electronics, electronics&telecom are majority of his clients.The projects mainly cover the following scope:
- Circuit Design and Debugging
- Microprocessors( Arduino and picaxe )
- Programmable and B.E.A.M robots and Circuit designs.
Some of his works are:

Robotic arm from iron man !
Reinventing the robotic arm from iron man !!- an obstacle avoiding robot that uses two SPDT (single pole double throw ) switches as antenna and uses a 3 volt battery holder to power itself . originally it was created by canadian jerome demers
- Robotic arm trying to "see" objects in its vicinity
- Controlling a radio controlled car via computer.
Contact Details:
Name: Siddhant Betrabet.
Mob.No. : 9167661087
Mob.No. : 9167661087
Location:Mumbai,Maharashtra,India
Email Address: betrabetsiddhant@gmail.com
Labels:
ARDUINO,
CIRCUIT DESIGN,
CIRCUITS,
ELECTRONICS,
ELECTRONICS&TELECOM,
MICROPROCESSORS,
MUMBAI,
PICAXE,
PROJECT FREELANCER,
PROJECT MAKER
Subscribe to:
Posts (Atom)