Friday, March 25, 2011

Mission Code Prelims


Srijan - Jadavpur University Techfest
Mission Code (Prelims) : Question Paper download link: https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0B-mmfn2DeWvJM2UzZWQ4NGUtMzQ3Zi00YjYxLWJmN2YtZWI0MTE2Y2Y2ZmY3&hl=en

Debug Prelims Solutions are given below:
Group A Answers
1 c
2 a
3 c
4 a
5 a
6 d
7 d
8 b
9 a
10 d
11 a
12 d
13 b
14 c
15 d
16 a
17 d
18 c
19 a
20 d
Group B Answers
1 c
2 a
3 a
4 a
5 d
6 b
7 a
8 c
9 c
10 a


Friday, March 18, 2011

LIBRARY FILE



;*******************************************************
; Some esential macros for elegant programming in masm *
;*******************************************************

exit macro
            mov ax,4c00h
            int 21h
endm

space macro
            mov ah,02h
            mov dl,20h
            int 21h
endm

;----------------------------------------------------
;Accepts single 2-digit hex nos.
;output: input value stored in AL
;regs. affected: AX,BH
;----------------------------------------------------
input macro                            ;two hex-digit input
            local ok,p,ok1,p1
            mov ah,01h
            int 21h
            cmp al,39h                  ;ascii value of 9
            jbe ok
            sub al,61h                    ;ascii value of a
            add al,0ah
            jmp p
ok:       sub al,30h
p:         rcl al,01h
            rcl al,01h
            rcl al,01h
            rcl al,01h
            mov bh,al
            mov ah,01h
            int 21h
            cmp al,39h                  ;ascii value of 9
            jbe ok1
            sub al,61h                    ;ascii value of a
            add al,0ah
            jmp p1
ok1:sub al,30h
p1:       add al,bh
endm

;---------------------------------------------------
;Prints two hex digits on console
;input: provide the digits in BH
;regs. affected: AX,DX
;---------------------------------------------------
output macro                         ;two hex-digit output
            local ok1,show,ok2,show2
            mov al,bh                   ;the digits to display is in BH
            and al,0fh       
            mov dh,al
            mov al,bh
            and al,11110000b        ;even binary values allowed in masm
            rcr al,01h
            rcr al,01h
            rcr al,01h
            rcr al,01h
            mov dl,al
            cmp dl,09h
            jbe       ok1
            sub dl,0ah
            add dl,41h                               ;hex digit handler
            jmp show
ok1:add dl,30h
show:
            mov ah,02h
            int 21h
            mov dl,dh
            cmp dl,09h
            jbe       ok2
            sub dl,0ah
            add dl,41h                               ;hex digit handler
            jmp show2
ok2:add dl,30h
show2: int 21h
endm

showmsg macro str     ;str data pssed through macro
            mov ax,@data
            mov ds,ax
            lea dx,str
            mov ah,09h
            int 21h
endm

str_length macro str    ;computes length of a string
            local lp1,done
            mov ax,@data
            mov ds,ax
            mov si,00h
            mov cx,0000h  ;clear cx
lp1:
            cmp str[si],24h ;check if its '$'
            je done
;else still chars left
            inc si
            inc cx
            jmp lp1
done:
            mov ax,cx
endm

;---------------------------------------------------
;Accepts input, and places them in an array
;array: is the address of the location from where inputs would be stored
;count: the no. of inputs
;---------------------------------------------------
input_array macro array,count,str
            local lp
            mov cx,count  ;the array size
            mov si,0000h
            mov bh,00h
            showmsg str
lp:        input                            ;call the single input macro
            mov array[si],al
            inc si
            space
            loop lp
endm

;---------------------------------------------------
;Setting the cursor
;Input: set row number in DH & column number in DL
;Registers affected: AH,BH
;---------------------------------------------------
cursor macro
            mov ah,02h                 ;request set cursor
            mov bh,00h                 ;page number 0
            int 10h                          ;Interrupt-call BIOS
endm

;---------------------------------------------------
;Clearing the screen
;Registers affected: AX,BH,CX,DX
;---------------------------------------------------
clrscrn macro
            mov ax,0600h              ;ah 06(scroll), al 00 (full screen)
            mov bh,71h                             ;attribute: white (7) on blue (1)
            mov cx,0000h              ;upper left row:column
            mov dx,184fh               ;lower right row:column
            int 10h                                      ;Interrupt-call BIOS
endm

;---------------------------------------------------
;display array
;Input:  Array address, the size of the array and an output message
;---------------------------------------------------
display_array macro array,count,str
            local lp
            pusha
            mov cx,count  ;the array size
            mov si,0000h
            mov bh,00h
            showmsg str
lp:        mov bh,array[si]          ;retrieving the individual terms of the array before calling the output macro
            output                                     ;calling output macro
            inc si
            space
            loop lp
            pop a
endm

Friday, March 11, 2011

Rate your prof


Participate in the departmental professor rating survey! Take your time to answer all the questions. For each of the underlying professors, give an overall rating accordingly. This should include, the way the particular person teaches, attitude towards students, grading, attendance during lab classes, overall popularity etc.Ideally students should participate in this poll after they have completed their 3rd year at JU-CSE.

Please follow this link to complete the survey: http://www.surveymonkey.com/s/RS9GPF3