Friday, August 24, 2012

78. BLOCK INTERCHANGE IN 8086


DATA SEGMENT
X DB 01H,02H,03H,04H,05H
Y DB 11H,12H,13H,14H,15H
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:MOV AX,DATA
MOV DS,AX
MOV CX,05H
LEA SI,X 
LEA DI,Y 
UP: MOV BL,[SI] 
MOV AL,[DI]
MOV [SI],AL 
MOV [DI],BL 
INC SI 
INC DI
DEC CX 
JNZ UP
MOV AH,4CH
INT 21H
CODE ENDS
END START

77. BLOCK TRANSFER IN 8086



DATA SEGMENT
X DB 01H,02H,03H,04H,05H
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:MOV AX,DATA 
MOV DS,AX
MOV CX,05H 
LEA SI,X+04 
LEA DI,X+04+03
UP: MOV BL,[SI] 
MOV [DI],BL 
DEC SI 
DEC DI
DEC CX 
JNZ UP
MOV AH,4CH
INT 21H
CODE ENDS
END START

Thursday, August 23, 2012

76. TCP CLIENT & SRVER IN JAVA

//TCP SERVER
import java.lang.*; import java.io.*; import java.net.*; class Server { public static void main(String args[]) { String data = "Toobie ornaught toobie"; try { ServerSocket srvr = new ServerSocket(1234); Socket skt = srvr.accept(); System.out.print("Server has connected!\n"); PrintWriter out = new PrintWriter(skt.getOutputStream(), true);