Thursday, January 13, 2011

8086 PROGRAM:: Sum of two multidigit digit number

print macro msg
lea dx,msg
mov ah,09h
int 21h
endm
read macro n,j1,j2
mov cx,0ah
j1:mov ah,01h
int 21h
cmp al,0dh
je j2
sub al,30h
mov bl,al
mov ax,n
mul cx
xor bh,bh
add ax,bx
mov n,ax
jmp j1
j2 :nop
endm
.model small
.stack 100h
.data
msg1 db 10,13,'Enter the 1st number: $'
msg2 db 10,13,'Enter the 2nd number: $'
msg3 db 10,13,'The Sum= $'
num1 dw 0
num2 dw 0
.code
main proc
mov ax,@data
mov ds,ax
print msg1
;reading 1st multidigit number

read num1,jump1,jump2
print msg2
;reading 2nd multidigit number
read num2,jump3,jump4
;finding sum
mov ax,num1
add ax,num2
;printing number
mov bx,000ah
xor cx,cx
;push into stack
p1:xor dx,dx
div bx
push dx
inc cx
cmp ax,0000h
jne p1
print msg3
;pop from stack
display:pop dx
add dl,30h
mov ah,02h
int 21h
loop display
mov ah,4ch
int 21h
main endp
end

8086 PROGRAM::2.Sum of two single digit number

print macro msg
lea dx,msg
mov ah,09h
int 21h
endm
read macro
mov ah,01h
int 21h
endm

.model small
.stack 100h
.data
msg1 db 10,13,'Enter the 1st number $'
msg2 db 10,13,'Enter the 2nd number $'
msg3 db 10,13,'Sum= $'
.code

mov ax,@data
mov ds,ax
;read first number
print msg1
read
mov bl,al
;read second number
print msg2
read
;find sum
add bl,al
;display sum
print msg3
mov dl,bl
sub dl,30h
mov ah,02
int 21h
mov ah,4ch
int 21h
end

PROGRAMMING IN 8086 ***1.HELLO WORLD***


.model small
.stack 100h
.data
mg db "Hello World $"
.code
mov ax,@data
mov ds,ax
lea dx,mg
mov ah,09h
int 21h
mov ah,4ch
int 21h
end

PROGRAMMING IN 8086

***HELLO WORLD***


.model small
.stack 100h
.data
mg db "Hello World $"
.code
mov ax,@data
mov ds,ax
lea dx,mg
mov ah,09h
int 21h
mov ah,4ch
int 21h
end

Tuesday, November 16, 2010

The Gayatri Mantra....

The Gayatri Mantra is a highly revered mantra in Hinduism. Written in Sanskrit, it consists of the prefix :oṃ bhūr bhuvaḥ svaḥ ॐ भूर्भुवस्वः, a formula taken from the Yajurveda, and the verse 3.62.10 of the Rigveda (which is an example of the Gayatri metre, whence the mantra's name). Since the other three Vedas contain material from the Rigveda, the Gayatri mantra is found in all four Vedas. The deva invoked in this mantra is Savitr, so the mantra is also called Sāvitrī. A personification of this mantra has come to be worshiped as a goddess in her own right, Gayatri. The Gayatri Mantra is praised in several other Hindu scriptures, including Manusmṛti, Atharvaveda, and the Bhagavad Gita.

The Gayatri Mantra is an important part of the upanayanam (sacred thread) ceremony for Brahmins, and was traditionally chanted only by Brahmin males, generally as part of their daily rituals. In modern times, chanting of the Gayatri Mantra is more widespread, such as at cultural celebrations, and its use has spread to include non-Brahmins and women.

"Aum Bhur Bhuvah Swah, Tat Savitur Varenyam
Bhargo Devasya Dhimahi, Dhiyo Yo Nah Prachodayat."

" ॐ भूर्भुव: स्व: तत्सवितुर्वरेण्यं । भर्गो देवस्य धीमहि, धीयो यो न: प्रचोदयात् ।। "

Sunday, November 7, 2010

Installing JDK and JRE in UBUNTU Linux



You need to follow some simple steps for installing Sun Java Development Kit(JDK) & Java Runtime Environment(JRE) in Ubuntu Linux. They are:

Step 1: At the initial stage ,check whether the MULTIVERSE repository is enabled or not.
For this Click on 
System->Administration->Software Sources->Select Multiverse->Close.

Step 2: Open TERMINAL and type the following to install JDK and JRE :sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk
Note: (1):
If you want to use red hat interface , press Ctrl+Alt+F1 and enter the user name and password. For returning to the previous interface , press Ctrl+Alt+F7.(2):You may need to update the runtime or development kit for the java language. For updation typesudo update-java-alternatives -s java-6-sun at the terminal.


Step 3: Set up the environment variable.
For this , do the following:
Type the following at the terminal:
vi $HOME/.bash_profile
Type the following in the opened text file:
export JAVA_home=/usr/lib/jvm/java-6-sun
export PATH=$PATH:$JAVA_HOME/bin
Save and close the file. For this , press 
ESC and type :wq and press enter.
Warning: Linux is case-sensitive.So,take care of the case of the command entered.

Note: If you want to know the version of JRE installed , use the following command :
java -versionFOR COMPILING THE JAVA PROGRAM , GO TO THE SPECIFIED DIRECTORY AND TYPE
JAVAC FILENAME.JAVAFOR EXECUTING THE PROGRAM , TYPE
JAVA FILENAME

C Graphics Programming in UBUNTU


The solution for doing graphics programming in ubuntu is:
libgraph - library providing the TurboC graphics API ( graphics.h) in Linux using SDL.
For using this , you need to follow some simple steps as mentioned below:
First of all, you need to install the dependencies so that all the required compiler tools gets installed.For that you need to run the given command on the terminal:
sudo apt-get install build-essential
Next you need to install some packages. They are: libsdl-image1.2,libsdl-image1.2-dev,guile-1.8 and guile-1.8-dev. For that run the given command at the terminal:
sudo apt-get install libsdl-image1.2 libsdl-image1.2-dev guile-1.8 guile-1.8-dev
Now, download and install libgraph-1.0.2.tar.gz from the link :
http://mirror.veriportal.com/savannah/libgraph/
Download this file in any folder and extract it in the home folder or on the desktop wherever you want.
Open the terminal and navigate to the folder where you have extracted libgraph-1.0.2 with the help of cd command. Install this using the commands given below:
./configure (Return)
sudo make (Return)
sudo make install (Return)
After this you can start your C graphics programming in linux. Now try writing a simple C graphics program by including the header file "graphics.h". You can do the programs as you in TURBO C.
For writing the programs you can use the "gedit" tool in ubuntu. For compiling the programs, navigate to the source program folder and use the following command:
gcc filename.c -lgraph
For executing the program, use the command ./a.out
The error “./a.out: error while loading shared libraries: libgraph.so.1: cannot open shared object file: No such file or directory” can be solved by
sudo cp /usr/local/lib/libgraph.* /usr/lib
If you still have any further doubts, then plz post here...hope i'll answer