A89: Re: Re: Few Code Questions Plz.
[Prev][Next][Index][Thread]
A89: Re: Re: Few Code Questions Plz.
> >void sprintf(char *destinationtext, char *printfstring, [value1,
> [value2...]]);
> >
> >An example in asm:
>
>
> Hmmm...
>
> what is sp? I don't understand this... what will this do? Enable you to
> press the arrow key's and the number will change?
SP = Stack Pointer = a7. It's a habit, plus I think it's better somehow to write
sp when I mean the stack...
The program will prodice a string that looks like this:
"The number is 25!"
...if d0 was 25 of course.
> exe
>
> right add's +100
> left sub's -100
> up +1`
> down -1
> something like that so i can do the money for DW. I am not sure how to add
> getkeky's and stuff with it also never done this b4 sorry for confusion :
There are many tutorials on the TI sites on how to read the keyboard so I won't
go into that here.
> also what is %d!?
Like I said, search for printf on the net to find out what you can put in the
printf string.
% means it's a control code that will be replaced with the value(s) you push
onto the stack first.
%d means it's an integer, i.e. a 16-bit signed number.
> >---------- BEGIN CODE ------------
> >...
> > move.w d0,-(sp) ;Your value
> > pea dstruct(pc) ; Your printf string
> > pea dstr(pc)
> > jsr doorsos::sprintf
> > lea 10(sp),sp
> >...
> > Code that prints/uses dstr.
> >...
> > dstr ds.b 100
> > dstruct dc.b "The number is %d!",0;
> >...
> >---------- END CODE ------------
> >
> >In this example I use an "int" type by putting a "%d" in the printf string.
> >Check any good C page on the net for a secription of printf and you'll get
> it.
/ Niklas Brunlid
Check out Prosit for the TI-89 / TI-92+ at http://prosit.ticalc.org
Random PQF Quote follows:
- "ALL YOU CAN HOPE FOR IS THE MERCY OF HELL."
- "Yeah?"
- "JUST OUR LITTLE JOKE."
- "Ngk," said Crowley.
-- Crowley in conversation with his superiors
(Terry Pratchett & Neil Gaiman, Good Omens)
References: