"Don't tell me how hard you work. Tell me how you get done."
- James J. Ling

Palindrome

July 27, 2006

At last! This head-breaking palindrome program is done…

 ; –ask string from user–
mov ah,0ah
lea dx,parameter
int 21h

mov ah,02
mov dl,0ah
int 21h
mov dl,0dh
int 21h

;–intialize–
mov cx, 0                ; or xor cx, cx –for making cx=0
lea si, namefield      ; load address of namespace
mov cl, [actlen]        ; cl refers to the length of the string
dec cl                      ; strings start at 0 and ends at [actlen]-1
lea di, namefield      ; load address of namespace
add di, cx                ; di now points to the last character of string

mov ah, 09              ; print string function

compare:
 mov cl, [si]             ; get character from si
 mov ch, [di]            ; get character from di
 cmp cl, ch               ; compare two characters
 jne stop                  ; if not equal, not palindrome

 inc si
 dec di   
 
 cmp di, si               ; check if si>di
 jns compare

 lea dx, pal
 int 21h
 jmp exit

stop:
 lea dx, notpal
 int 21h

exit:
 int 20h

 

parameter label byte
maxlen db 0FF
actlen db ?
namefield db 0FF dup(’$')

pal db ‘This string is a palindrome$’
notpal db ‘This string is not a palindrome$’

 

 

Posted by phengpheng at 9:57 pm | permalink

Previous Comments

works! =) congrats =)

Posted by yue at July 29, 2006, 6:38 am

can you make a palindrome program in C!!!…

Posted by jennylyn at February 15, 2009, 9:45 pm

wuhu.. tnx! pcopy ng prog muh.. atlast my palindrome n rin aq.. aus.. pasado n q sa finals!! haha..

Posted by thea at March 14, 2009, 12:42 pm

All comments are moderated. Your comments will not appear here unless approved by the blog owner. Thank you.

Add a comment








     

July 2006
M T W T F S S
« May   Aug »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

About Me

A Computer Science graduate who is a fanatic in assembly, java, and j2me programming. Developed BlueVoice system (Direct Voice Communication in Mobile Phones), this system allows mobile users to experience FREE VOICE CALLS

Subscribe

Technorati
Bloglines

Tagboard

tinnitus treatment:

thanks You sure do know what your’e talking about. Man, this blog is just great! I cant wait to read more of what youv’e got to say. Im really happy that I came across this when I did because I was really starting

phengpheng:

Haven’t managed my blog for a long time already because I’m so busy now… Sorry to cause you guyz trouble…

Jun Mark:

hoW tO creaTE a PrOGram thAT woULD oUTpuT ascii table???

Jun Mark:

pLZ anSwer mY qUEstions

cutieGurl:

how to convert binary to hexadecimal, decimal and octal?????????please. answer me??????????

mary ann:

kuya, ung binary to decimal converter nyo. mali man? ung sa mga compare mo. ung may 0,9,A,F etc… bad character lumalabaspls rep asap po. tnx

carol:

how to convert decimal to binary to octal and hexadecimal

Galwin:

been here!

galwin:

nice site. hope you could visit mine, too.

pathy:

FRIENDS FOREVER!! Miss you na!!!

ridvan:

aus, i seldom see lady programmers. hehe. keep it up. and oh yeah, i guess i saw you during the MICT Quiz Show held in cdo. :)
keep up the codes!

phengpheng:

I miss updating this blog… Sana may time and pc ako to learn new stuffs aside from my work…

support:

Congratulations, you’ve just completed the installation of this shoutbox.

pheng:

uy! you’re here again!

Jay:

Woooohhhh orange…sweat… nakakasilaw! hehe :)

jay:

tagboard flood hehe sensya… had nothing fun to do. :)

pheng:

jaaaaayyyyy….:) ketal man?:)

niel:

no spamming please :p hehehe joke lang jay.

Jay:

Uyyyyyy!!!! Grraaaaaaaiiiinnnneeee
:)
Sssshhhh, el sikret! :)
Niiiiiiiiiiiiieeeeeel
Sup dude!!!!
Paaaaaaaaaaaaaathy
Ketal!?

niel:

ei pheng! :D slick-elegant layout! love it!

Leave a message ▼