Saturday, July 22, 2006

Antidote for insanity

Simple programming stuffs save me from insanity. This a86 assembly program tells if str1 is a palindrome.



start:
cld
mov cx, 7
lea si, str1
lea di, temp

reverse:
mov al, [si+6]
mov [di], al
inc di
dec si
loop reverse

mov ah, 09h
lea dx, temp
int 21h

cld
mov cx, 4

compare:
lea di, temp
lea si, str1
repe cmpsb
jne exit

mov ah, 09h
lea dx, yes
int 21h

exit:
mov ah, 4Ch
mov al, 00
int 21h
int 20h

str1 db 'racecar$'
yes db '',10,'string is a palindrome!$'
temp db 8 dup ('$')

[Middle-East Crisis]


Israel, known as the chosen people of God called a thousand reservists in a possible prelude to a ground offensive against Lebanon. Accordingly, they have to clean up bunkers and tunnels that are invulnerable to air attacks. Isn’t it ironic for the Mossads to be called as the chosen people of God?

No comments: