Laynetworks  
Web laynetworks.com Google
Home | Site Map | Tell a friends
Management Tutorials
Download
Tutorials
History
Computer Science
Networking
OS - Linux and Unix
Source Code
Script & Languages
Protocols
Glossary
IGNOU
Quiz
About Us
Contact Us
Feedback
 
Sign up for our Email Newsletter
 
Get Paid for Your Tech Turorials / Tips

 

 

Home > Computer Science > Computer Fundamentals
 
CS 01 CS 02 CS 03 CS 04 CS 05 CS 06 CS 07 CS 08 CS 09 CS 10 CS 11 CS 12 CS 13 CS 14 CS 15 CS 16 CS 17
Page : 1 2 3 4 5 6 7 8
 
PROGRAM TO INCREMENT OR DECREMENT THE VALUE OF ANY OF THE TWO PARAMETER
 
org 0000h
ajmp prog

org 0010h
db 1fh
db 09h
db 69h
db 7eh

ORG 0014h
db 08h
db 1fh
db 09h
db 7ah

org 0040h
db 77h
db 44h
db 3dh
db 7ch
db 4eh
db 7ah
db 7bh
db 54h
db 7fh
db 7eh

org 0050h
prog:
mov sp,#60h
mov psw,#00h
mov p1,#ffh

x2: mov r0,#08h
setb c
mov a,#00h
x1: rlc a
mov p2,a
mov p0,#7fh
lcall del1
jnb p1.2,x6
djnz r0,x1
ajmp x2

x6: MOV 20H,#10H
MOV 21H,#00H
mov tmod,#01h
mov tcon,#10h
mov ie,#82h
mov tl0,#01h
mov th0,#f8h
; mov r4,#00h
; mov r5,#00h
; mov r6,#00h
; mov r7,#00h
; mov r0,#01h
mov r1,#00h

; mov r2,#00h
; acall read
; mov r4,40h
; mov r5,41h
; mov r6,42h
; mov r7,43h

f1: acall key
ajmp f1

TOP

key:
jnb p1.3,inc
jnb p1.1,k2
jnb p1.4,shift
jnb p1.0,next
ret

k2: ajmp dec

next: acall del3

mov r2,#10h
mov 23h,r4
acall save
acall del4

mov r2,#11h
mov 23h,r5
acall save
acall del4

mov r2,#12h
mov 23h,r6
acall save
acall del4

mov r2,#13h
mov 23h,r7
acall save
acall del4

; ret

mov a,20h
cjne a,#10h,z1
mov 20h,#14h

mov r2,#10h
acall read
mov r4,24h

mov r2,#11h
acall read
mov r5,24h

mov r2,#12h
acall read
mov r6,24h

mov r2,#13h
acall read
mov r7,24h

; mov r4,40h
;; mov r5,41h
; mov r6,42h
; mov r7,43h

ret
z1: mov 20h,#10h
mov r2,#10h
acall read
mov r4,24h

mov r2,#11h
acall read
mov r5,24h

mov r2,#12h
acall read
mov r6,24h

mov r2,#13h
acall read
mov r7,24h
ret

shift: acall del1
cjne r1,#03h,s2
mov r1,#00h
ret
s2: inc r1
ret

inc: acall del1
cjne r1,#00h,a1
cjne r4,#09h,b1
mov r4,#00h
ret
b1: inc r4
ret

TOP

a1: cjne r1,#01h,a2
cjne r5,#09h,b2
mov r5,#00h
ret
b2: inc r5
ret

a2: cjne r1,#02h,a3
cjne r6,#09h,b3
mov r6,#00h
ret
b3: inc r6
ret

a3: cjne r7,#09h,b4
mov r7,#00h
ret
b4: inc r7
ret

dec: acall del1
cjne r1,#00h,c1
cjne r4,#00h,d1
mov r4,#09h
ret
d1: dec r4
ret

c1: cjne r1,#01h,c2
cjne r5,#00h,d2
mov r5,#09h
ret
d2: dec r5
ret

c2: cjne r1,#02h,c3
cjne r6,#00h,d3
mov r6,#09h
ret
d3: dec r6
ret

c3: cjne r7,#00h,d4
mov r7,#09h
ret
d4: dec r7
ret

save: mov hexno,hxlb
acall subsav
inc ad_ep
mov hexno,hxhb
acall subsav
ret

subsav: acall start
push a
mov a,#a0h ; slave add.
call write
jb p3.7,p1 ; acknowledge
call write
mov a,hexno
call write
pop a
p1: acall stop
ret

start: clr p3.6 ; clock
call del2
setb p3.7 ; data
setb p3.6
call del2
clr p3.7
call del2
ret

stop: clr p3.6
call del2
setb p3.6
clr p3.7
call del2
setb p3.7
ret

TOP

write:
mov count5,#08h ; counter to count 8-bits.
p2: clr p3.6
call del2
rlc a
mov p3.7,c
call del2
call del2
djnz count5,p2
clr p3.6 ; to get acknowledge
call del2
setb p3.6
call del2

ret

del2: push b
mov b,#03h
djnz b,$
pop b
ret

read:
; push a
; push 00h
; push 03h
; mov r0,#40h
; mov 19h,#04h
p6: call start
push a
mov a,#a0h
call write
jb p3.7,p5
mov a,r2
call write
call start
mov a,#a1h
call write
jb p3.7,p5
call sread
; mov @r0,a
mov 24h,a
pop a
p5: acall stop
; inc r2
; inc r0
; djnz 19h,p6

; pop 03h
; pop 00h
; pop a
ret

sread:
mov 16h,#08h
p7: clr p3.6
call del2
setb p3.6
call del2
mov c,p3.7
rlc a
djnz 16h,p7

ret

org 0300h
isr:
push 03h
push a
MOV DPL,20H
MOV DPH,21H
mov r3,#00h
mov a,r3
movc a,@a+dptr
mov p2,#01h
mov p0,#00h
acall de1
mov p0,a
acall de1
inc r3

mov a,r3
movc a,@a+dptr
mov p2,#02h
mov p0,#00h
acall de1
mov p0,a
acall de1
inc r3

mov a,r3
movc a,@a+dptr
mov p2,#04h
mov p0,#00h
acall de1
mov p0,a
acall de1
inc r3

TOP

mov a,r3
movc a,@a+dptr
mov p2,#08h
mov p0,#00h
acall de1
mov p0,a
acall de1
inc r3

mov dptr,#0040h
mov a,r4
movc a,@a+dptr
mov p2,#80h
mov p0,#00h
acall de1
mov p0,a
acall de1

mov a,r5
movc a,@a+dptr
mov p2,#40h
mov p0,#00h
acall de1
mov p0,a
acall de1

mov a,r6
movc a,@a+dptr
mov p2,#20h
mov p0,#00h
acall de1
mov p0,a
acall de1

mov a,r7
movc a,@a+dptr
mov p2,#10h
mov p0,#00h
acall de1
mov p0,a
acall de1

MOV P2,#00H
mov tl0,#00h
mov th0,#f8h

pop a
pop 03h
RETI

de1: push b
mov b,#03h
djnz b,$
pop b
ret

del1: mov 50h,#01h
x10: mov 51h,#ffh
x3: mov 52h,#ffh
djnz 52h,$
djnz 51h,x3
djnz 50h,x10
ret

del3: mov 45h,#afh
as1: mov 46h,#ffh
djnz 46h,$
djnz 45h,as1
ret

del4: mov 35h,#ffh
djnz 35h,$
ret

end

TOP

Page : 1 2 3 4 5 6 7 8
 
 
 
Donation | Useful links | Link to Laynetworks.com | Legal | SharePoint Development
Copyright © 2000-2010 Lay Networks All rights reserved.