Friday, January 20, 2012

Travel Ceylon : Intelligent Travel Planner for Sri Lanka : Build On Top of Android OS, Apache Axis2 and GPS

This is a Travel planning application which is based on Sri Lanka. User can plan their own travel according to the following constrains, after processing all those constrains the Travel Ceylon app will suggest you are travel path to follow and list of interesting place which you can see on the path.

I. Interest list of the traveler.
II. Starting position.
III. Time period of travel.
IV. Special places to be included.
V. Special places to be avoided.

On the way of travel, if the traveler reaches a particular important place which was highlighted in the travel plan, app will pop up and give you the details about the arriving place and all the guidelines to arrive the place.
User can add new details to the central data store of the Travel Ceylon system on the approval of administrator

This is the high level architecture of the Travel Ceylon system,


The Travel Ceylon system will look like this after the deployment,

Screen of Travel Ceylon App Looks Like this,



















Tank Game – An Artificial Intelligent Game Development Project



This was a artificial intelligent gaming client. There is a game server which conducts games. We have been ask develop a client using a Game engine. The game objective is; clients acting as “tanks” accumulating points while making sure of their own survival. The tanks are capable of shooting shells and these bullets will move 3 times faster than a tank. The environment is made out of four kinds of blocks Brick wall,Stone wall,Water and Blank cell. The target will be collect all the coins and medi packs while killing all the op-tents.

The game server and client architecture is like this,


There was configured server and We have to build the client for our AI to connect and play the game. To play the game the protocol is like this. Server issues some text commands in the standard bit stream. We have to play on those commands.
To implement this client we choose C# language and XNA4.0 Game engine. We were able to create a 3D tanks client with a well developed AI. Here are some screen shots from our gaming client,








Also we have developed a complex AI which can play with other clients. I will explain it in another post. Keep in Touch...






Hacking JOSH – Operating System Development in Assembly

In this project I was able to develop a simple OS which have kernel and a Shell by configuring a given simple OS. You can find that preliminary OS  by reading this article,


http://asiri.rathnayake.org/articles/hacking-josh-operating-system-tutorial/

I implemented a new command for my operating system which prints hardware information about the computer.To achieve that functionality after some research work over the internet and experts of this area I found several waysto get hardware information using x86 Assembly language.
They were BIOS interrupt calls, CPUID instruction, BIOS data area, SMBIOS – Collection of tables which can provides you hardware information. In these methods I choose interrupt calls, CPUID instruction to display hardware information of the system.
In my function which I add to existing kernel  it can show Processor Brand, Processor Type, Ram Size, system date and time, check the availability of serial ports, floppy drives, printers, co-processors and mouse.
Following articles will explain the steps which I took to develop this operating system, It will explain step by step to develop a OS like that.

http://www.insightforfuture.blogspot.com/2010/11/useful-techniques-in-assembly.html
http://www.insightforfuture.blogspot.com/2010/11/x86-assembly-if-else-control-structures.html
http://www.insightforfuture.blogspot.com/2010/11/bios-interrupt-calls-to-get-hardware.html
http://www.insightforfuture.blogspot.com/2010/11/find-hardware-infodo-you-know-how.html
http://www.insightforfuture.blogspot.com/2010/11/smbios-gives-hardware-specifications.html

Next I will Explain the source code of this new functionality,

This is the shell command which is responsible for run the hardware info;

    hwi:                    ;;;;;;;;This is the place hardware info Procedure Starts
    mov SI,strCmd0               
    mov DI,hw               
    call os_string_strincmp            ;check is the entered command is HW_Info
    jc    hardware_info            ;if it is call the hardware info function
    jmp _cmd_ver                ;else go to next shell command
    else:
    jmp _cmd_done ;;;;;;;;;End of the Hardware info call




This is the code where the original functionality lies, These assembly code are responsible to retrieve hardware info by using interrupt calls.




;;;;;;;;;;;;;;Start of Hardware Info;;;;;;;;;;;;;;

hardware_info:

    mov si,ent   
    call    _disp_str   

    mov si,hwinfo
    call    _disp_str   

    mov si,ent   
    call    _disp_str   

;;;;;;;;;;;;Processor Info Display;;;;;;;;;;;;;;;;   

    mov si,pinfo
    call    _disp_str

    mov eax,0
    cpuid
    mov [vendor_id],ebx            ;getting the cpu brand from ebx,ecx,edx
    mov [vendor_id+4],edx
    mov [vendor_id+8],ecx
    mov si,processor
    call    _disp_str
    mov si,vendor_id
    call    _disp_str

    mov si,ent   
    call    _disp_str

    mov si,processort
    call    _disp_str

    mov eax,80000002h
    cpuid
    mov [processor_type],eax        ;getting the cpu type string  brand from ebx,ecx,edx,eax
    mov [processor_type+4],ebx
    mov [processor_type+8],ecx
    mov [processor_type+12],edx
    mov si,processor_type
    call    _disp_str

    mov eax,80000003h
    cpuid
    mov [processor_type1],eax
    mov [processor_type1+4],ebx
    mov [processor_type1+8],ecx
    mov [processor_type1+12],edx
    mov si,processor_type1
    call    _disp_str       
   
    mov eax,80000004h
    cpuid
    mov [processor_type2],eax
    mov [processor_type2+4],ebx
    mov [processor_type2+8],ecx
    mov [processor_type2+12],edx
    mov si,processor_type2
    call    _disp_str

    mov si,ent   
    call    _disp_str

    ;;;;;;;;;;;;;;;RAM Info Display;;;;;;;;;;;;;;;;;;

    mov si,rinfo
    call    _disp_str
    mov si,ram   
    call    _disp_str

    MOV AX, 0xE801
    INT 0x15                ;calling the intruupt to get ram size in 64kb blocks
    call hex2dec

    mov si,ent   
    call    _disp_str

    ;;;;;;;;;;;;;;;Other Info Display;;;;;;;;;;;;;;;;;
    int 11h                ;calling the intruupt to get pheriperal device info
    mov cx,ax

    mov si,oinfo
    call    _disp_str

    ;;;;;;;;;;;;;;Check for Floppy Drive;;;;;;;;;;;;;;

    and ax,1h
    cmp ax,0h
    jz ifblock0
    jmp elseblock0
    ifblock0:
    mov si, floppyNotPresent
    call    _disp_str
        jmp end0
    elseblock0:
    mov si, floppyPresent
    call    _disp_str
    end0:
    mov ax,cx   
   
    ;;;;;;;;;;;;;;Check for Math Co-Processor;;;;;;;;

    and ax,2h
    cmp ax,0h
    jz ifblock1
    jmp elseblock1
    ifblock1:
    mov si, mathaNotPresent
    call    _disp_str
        jmp end1
    elseblock1:
    mov si, mathaPresent
    call    _disp_str
    end1:
    mov ax,cx   

    ;;;;;;;;;;;;;Check for Joystick;;;;;;;;;;;;;;;;;;

    and ax,800h
    cmp ax,0h
    jz ifblock2
    jmp elseblock2
    ifblock2:
    mov si, joyNotPresent
    call    _disp_str
        jmp end2
    elseblock2:
    mov si, joyPresent
    call    _disp_str
    end2:
    mov ax,cx   

    ;;;;;;;;;;;;;Check for Serial Printer;;;;;;;;;;;;;

    and ax,1000h
    cmp ax,0h
    jz ifblock3
    jmp elseblock3
    ifblock3:
    mov si, printerNotPresent
    call    _disp_str
        jmp end3
    elseblock3:
    mov si, printerPresent
    call    _disp_str
    end3:
    mov ax,cx   

    ;;;;;;;;;;;;Check for Serial Ports;;;;;;;;;;;;;;;;

    and ax,700h

    cmp ax,0h
    jz ifblock4_s0
    ifblock4_s0:
    mov si, s0
    call    _disp_str
        jmp end4 
    
    cmp ax,100h
    jz ifblock4_s1
    ifblock4_s1:
    mov si, s1
    call    _disp_str
        jmp end4

    cmp ax,200h
    jz ifblock4_s2
    ifblock4_s2:
    mov si, s2
    call    _disp_str
        jmp end4
    cmp ax,300h
    jz ifblock4_s3
    ifblock4_s3:
    mov si, s3
    call    _disp_str
        jmp end4
    cmp ax,400h
    jz ifblock4_s4
    ifblock4_s4:
    mov si, s4
    call    _disp_str
        jmp end4
    cmp ax,500h
    jz ifblock4_s5
    ifblock4_s5:
    mov si, s5
    call    _disp_str
        jmp end4
    cmp ax,600h
    jz ifblock4_s6
    ifblock4_s6:
    mov si, s6
    call    _disp_str
        jmp end4

    cmp ax,700h
    jz ifblock4_s7
    ifblock4_s7:
    mov si, s7
    call    _disp_str
        jmp end4
    end4:
    mov ax,cx   

    ;;;;;;;;;;;;;;Check for Mouse;;;;;;;;;;;;;;;;

     int 33h                  ; call interrupt 33h function 0
     cmp ax,0ffffh            ; compare AX and FFFFh (installed)
     jz endmouse              ; it is? Jump to the end!
     mov si, nmouse
     call    _disp_str
     jmp end5
    endmouse:
     mov si, mouse
     call    _disp_str    
    end5:

    ;;;;;;;;;;;;;;Display Date and Time;;;;;;;;;;;;

    call os_get_date_string
    mov si,date_time
    call    _disp_str        
    mov si, BX
    call    _disp_str
    call os_get_time_string
    mov si, space
    call    _disp_str
    mov si, BX
    call    _disp_str

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
jmp else

If you want further info about this please contact me.