Please Check my code!!!

This is a Calendar Wizard in TASM.
a program that when a user enter his birthday, the output
must be his corresponding Zodiac sign and his horoscope.
But i dont know where to compare the inputted month and date and what label i am going to make to output the right zodiac sign and horoscope.

Please help me. I try to fixed it many times but it doesn't work. Please?

Thank you!!!!


.model small
.stack
.data

wizard db 13,10
db 13,30 dup(32),'Calendar Wizard','$'
db 13,10

msg db 13,10
db 13,10
db 13,15 dup(32),'Enter your birthday to know your horoscope','$'
db 13,10

month db 13,10
db 13,10,25 dup(32),'Months in the Calendar'
db 13,10
db 13,10,20 dup(32),'[A] January'
db 13,10,20 dup(32),' February'
db 13,10,20 dup(32),'[C] March'
db 13,10,20 dup(32),'[D] April'
db 13,10,20 dup(32),'[E] May'
db 13,10,20 dup(32),'[F] June'
db 13,10,20 dup(32),'[G] July'
db 13,10,20 dup(32),'[H] August'
db 13,10,20 dup(32),' September'
db 13,10,20 dup(32),'[J] October'
db 13,10,20 dup(32),'[K] November'
db 13,10,20 dup(32),'[L] December'
db 13,10
db 13,10,20 dup(32),'Enter the month:','$'

date db 13,10
db 13,10,20 dup(32),'Enter the date:','$'


cap db 13,10
db 13,10,25 dup(32),'CAPRICORN (21 December - 20 January)'
db 13,10,20 dup(32),'-- Planets in Capricorn will express themselves'
db 13,10,20 dup(32),'in a determined and serious manner, striving'
db 13,10,20 dup(32),'for honour and some kind of recognition in'
db 13,10,20 dup(32),'society. There is a desire and ability to'
db 13,10,20 dup(32),'reach the top through hard work and perseverence.','$'

aqu db 13,10
db 13,10,25 dup(32),'AQUARUIS - (21 January- 20 February)'
db 13,10,20 dup(32),'-- in this sign express themselves in a unique'
db 13,10,20 dup(32),'and unconventional manner. This can lead to an'
db 13,10,20 dup(32),'experience of alienation or social isolation.'
db 13,10,20 dup(32),'Nevertheless the energy of Aquarius is in essence'
db 13,10,20 dup(32),'friendly and expresses itself in social relationships'
db 13,10,20 dup(32),'where shared ideals play a greater role than emotions.','$'

pis db 13,10
db 13,10,25 dup(32),'PISCES (21 February - 20 March)'
db 13,10,25 dup(32),'-- Pisces express themselves sensitively and in'
db 13,10,25 dup(32),'a rather diffuse manner. The enhanced emotional'
db 13,10,25 dup(32),'sensitivity in Pisces is often channelled into'
db 13,10,25 dup(32),'creative outlets, particularly in connection'
db 13,10,25 dup(32),'with music and film,but also in connection with'
db 13,10,25 dup(32),'Nature, and people who need social care.','$'

ari db 13,10
db 13,10,25 dup(32),'ARIES (21 March - 20 April)'
db 13,10,25 dup(32),'-- There is little timidity in people under this'
db 13,10,25 dup(32),'sign - like the Ram,Arians are confident'
db 13,10,25 dup(32),'doers who often forge ahead confidently, regardless'
db 13,10,25 dup(32),'of the consequences. This impulsiveness can sometimes'
db 13,10,25 dup(32),'lead to problemswhen they leap before they look.','$'

tau db 13,10
db 13,10,25 dup(32),'TAURUS (21 April - 21 May)'
db 13,10,25 dup(32),'-- Taurus is also connected with the resources of'
db 13,10,25 dup(32),'Nature, and the whole issue of value and worth.'
db 13,10,25 dup(32),'Therefore it is associated with finance,worldly'
db 13,10,25 dup(32),'goods and security. People with a strong emphasis'
db 13,10,25 dup(32),'in this sign tend to be materialistic,'
db 13,10,25 dup(32),'and often get stuck in a rut.','$'

gem db 13,10
db 13,10,25 dup(32),'GEMINI (22 May - 21 June)'
db 13,10,25 dup(32),'-- Negative manifestations of Gemini influences are'
db 13,10,25 dup(32),'a flightiness and unreliability,and a tendency to'
db 13,10,25 dup(32),' get involved with too many things at any one time.'
db 13,10,25 dup(32),'There is a love of ideas.Planets here manifest'
db 13,10,25 dup(32),'considerable versatility andmental skills '
db 13,10,25 dup(32),'in regard to all forms of communication.','$'

can db 13,10
db 13,10,25 dup(32),'CANCER (22 June - 22 July)'
db 13,10,25 dup(32),'-- Planets in this sign will often reflect a'
db 13,10,25 dup(32),'vulnerable character and oversensitive nature.'
db 13,10,25 dup(32),'There is a strong attachment to the home and'
db 13,10,25 dup(32),'awareness of the environment.'
db 13,10,25 dup(32),'Planets in Cancer come to expression most'
db 13,10,25 dup(32),'clearly in connection with the home and family.','$'

leo db 13,10
db 13,10,25 dup(32),'LEO (23 July - 22 August)'
db 13,10,25 dup(32),'-- When planets are expressed negatively in this'
db 13,10,25 dup(32),'sign there will often be pride,narcissism and'
db 13,10,25 dup(32),'self-importance. When expressed positively there is a'
db 13,10,25 dup(32),'warmthand joy in being, and a playful, romantic nature.','$'

vir db 13,10
db 13,10,25 dup(32),'VIRGO (23 August - 22 September)'
db 13,10,25 dup(32),'-- Planets in this sign express themselves in a'
db 13,10,25 dup(32),'perfectionistic way,and give rise to a tendency'
db 13,10,25 dup(32),'to both criticism and self-criticism.'
db 13,10,25 dup(32),'There is a drive to work hard and a strong'
db 13,10,25 dup(32),'motivation to behelpful and of service to others.','$'

lib db 13,10
db 13,10,25 dup(32),'LIBRA (23 September - 22 October)'
db 13,10,25 dup(32),'-- There is a strong concern with the principles'
db 13,10,25 dup(32),'of fairness and justice, and great interest'
db 13,10,25 dup(32),' in getting people to function smoothly together.','$'

sco db 13,10
db 13,10,25 dup(32),'SCORPIO (23 October - 21 November)'
db 13,10,25 dup(32),'-- Truth be told, these strong-willed folks'
db 13,10,25 dup(32),'are happy to serve others and can be quite'
db 13,10,25 dup(32),'helpful, as long as it wont hurt them.'
db 13,10,25 dup(32),'There is a secretiveness and compulsiveness which'
db 13,10,25 dup(32),'is hidden under a facade of strong self-control.','$'


sag db 13,10
db 13,10,25 dup(32),'SAGITTARIUS (22 November - 20 December)'
db 13,10,25 dup(32),'-- Sagittarius in characterised by a love of'
db 13,10,25 dup(32),'truth and righteousness, and an unfortunate '
db 13,10,25 dup(32),'tendency to express it rather too directly,'
db 13,10,25 dup(32),'even when not asked. There is a love of open'
db 13,10,25 dup(32),'horizons and travel and a need'
db 13,10,25 dup(32),'to expand on an inner intellectual level.','$'

wrong db 13,10
db 13,10,25 dup(32),'WRONG INPUT','$'


.code
push dx
sub ax,ax
push ax
mov ax,@data
mov ds,ax

title1:
mov ah,09h
mov dx, offset wizard
int 21h
mes:
mov ah,09h
mov dx, offset msg
int 21h

enterMonth:
mov ah,09h
mov dx, offset month
int 21h
mov ah,01h
int 21h
mov bh,al
cmp bh,41h
jl entermonth
jge date1

Date1:
mov ah,09h
mov dx, offset date
int 21h
mov ah,0Ah
int 21h
mov bl,al
jle func

func:
jmp janA
invalid:
mov ah,09h
mov dx,offset wrong
int 21h


janA:
mov ah,09h
mov dx, offset cap
int 21h

mov ah ,4ch
int 21h
janB:
mov ah,09h
mov dx, offset aqu
int 21h

mov ah ,4ch
int 21h

febA:
mov ah,09h
mov dx, offset aqu
int 21h
mov ah ,4ch
int 21h

febB:
mov ah,09h
mov dx, offset pis
int 21h
mov ah ,4ch
int 21h

marA:
mov ah,09h
mov dx, offset pis
int 21h
mov ah ,4ch
int 21h
marB:
mov ah,09h
mov dx, offset ari
int 21h
mov ah ,4ch
int 21h
aprA:
mov ah,09h
mov dx, offset ari
int 21h
mov ah ,4ch
int 21h

aprB:
mov ah,09h
mov dx, offset tau
int 21h
mov ah ,4ch
int 21h

mayA:
mov ah,09h
mov dx, offset tau
int 21h
mov ah ,4ch
int 21h

mayB:
mov ah,09h
mov dx, offset gem
int 21h
mov ah ,4ch
int 21h
junA:
mov ah,09h
mov dx, offset gem
int 21h
mov ah ,4ch
int 21h

junB:
mov ah,09h
mov dx, offset can
int 21h
mov ah ,4ch
int 21h
julA:
mov ah,09h
mov dx, offset can
int 21h
mov ah ,4ch
int 21h
julB:
mov ah,09h
mov dx, offset leo
int 21h
mov ah ,4ch
int 21h
augA:
mov ah,09h
mov dx, offset leo
int 21h
mov ah ,4ch
int 21h
augB:
mov ah,09h
mov dx, offset vir
int 21h
mov ah ,4ch
int 21h
sepA:
mov ah,09h
mov dx, offset vir
int 21h
mov ah ,4ch
int 21h
sepB:
mov ah,09h
mov dx, offset lib
int 21h
mov ah ,4ch
int 21h
octA:
mov ah,09h
mov dx, offset lib
int 21h
mov ah ,4ch
int 21h
octB:
mov ah,09h
mov dx, offset sco
int 21h
mov ah ,4ch
int 21h

novA:
mov ah,09h
mov dx, offset sco
int 21h
mov ah ,4ch
int 21h
novB:
mov ah,09h
mov dx, offset sag
int 21h
mov ah ,4ch
int 21h

decA:
mov ah,09h
mov dx, offset sag
int 21h
mov ah ,4ch
int 21h

decB:
mov ah,09h
mov dx, offset cap
int 21h
mov ah ,4ch
int 21h

end

Recommended Answers

All 6 Replies

After you've entered Month & Day, your program has no way of knowing which sign those entries are applicable too.

One way would be to calculate the number of days that have elapsed since Jan 1 and then compare that with a table that provides a pointer to appropriate text using a loop

Signs    dw janA, 20, febA, 48, febB, 78

Notice how Signs are in data pairs (1) Pointer to the text (2) Maximum value before next sign.

You can use whatever menthod you like, but basically in a loop you will compare you calcuated day number with that of the maximum for that sign. As soon as the value is less than the one in the table you know the previously read is the correct sign

but i can't compare 2 digits or more. only 1. Can you give me a sample output like in Aquarius and Pisces that i can be used as a referenced? Please..

1 am already..:(

another thing is how can apply the loop??.. Please help me.. :( Please.

but i can't compare 2 digits or more. only 1. Can you give me a sample output like in Aquarius and Pisces that i can be used as a referenced? Please..

1 am already..:(

I'm not sure what you mean by this, but when making comparisons if you have more than one value you do it successively, meaning check value A then if true value B and so on.

Loop example:

Pointer     dw     3f, 22, 18, 19, 47, 5f, 18, -3, 0

        mov esi, Pointer

Loop
        lods
        cmp     ax, 0
        jz         Done
        lods
        cmp     al, 5fH
        jnz      Done
        jmp     Loop

Done

You can see by this example 18, -3, 0 are never evaluated. This is how you would test data pairs or at least one way of doing it.

I never write code from scratch without you making some sort of legitimate attempt in the form of code. Remember too please to enclose your code in tags code & /code

I've read your private message and appealing to me on what you perceive to be a private area is not going to work. Although I empathize with your dilemma, but there are two problems. (1) Your depriving other members of what might be a solution or partial solution to their problem, which defeats the purpose of a public message board. (2) As this is your first thread, you may not appreciate that those of us that have been here for a while anticipate the weekend panic scenarios . I am more than willing to help, but you MUST produce some relevant code first.

tenk.. i'l try working again. Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.