Omnimaga

Calculator Community => TI Calculators => ASM => Topic started by: tama on July 10, 2007, 02:35:00 am

Title: Sprites ?
Post by: tama on July 10, 2007, 02:35:00 am
Here's my first question ^^

Does anybody know how can I make a grayscale sprite without using Ion nor Mirage OS ?
That would help me a lot
Thanks =)
Title: Sprites ?
Post by: calc84maniac on July 10, 2007, 03:32:00 am
I don't think the shells support greyscale anyway... oh well, just wait 'till Jim e comes, he can tell you. ;)wink.gif
Title: Sprites ?
Post by: Fallen Ghost on July 10, 2007, 04:07:00 am
QuoteBegin-calc84maniac+10 Jul, 2007, 9:32-->
QUOTE (calc84maniac @ 10 Jul, 2007, 9:32)
I don't think the shells support greyscale anyway... oh well, just wait 'till Jim e comes, he can tell you. ;)wink.gif

 ^^ May take some time

To have greyscale, you need to have 2 Black/White normal drawings of your thing (2 blacks=black, 2 white=white, 1 of both=grey) that you flip over very fast, to make illusion of it.
Title: Sprites ?
Post by: bfr on July 10, 2007, 05:29:00 am
I recommend the Revolution Grayscale Package.  I *think* the latest release can be downloaded http://www.revsoft.org/phpBB2/viewtopic.php?t=26&postdays=0&postorder=asc&start=45 (look at the attachment in Jim E's post).
Title: Sprites ?
Post by: tama on July 10, 2007, 05:35:00 am
ok.
and do you know how can the program stop a very few time ?
Title: Sprites ?
Post by: calc84maniac on July 10, 2007, 06:52:00 am
Sorry, can you rephrase that? I don't want to try decoding that message...
Title: Sprites ?
Post by: tama on July 10, 2007, 06:58:00 am
er...
ok I'll try

I want to stop a program for a few microseconds...

"Halt" don't seem to work...
I also tried "nop" but it does nothing
Title: Sprites ?
Post by: calc84maniac on July 10, 2007, 07:01:00 am
nop waits 4 clock cycles. That's 4/6000000 seconds.

halt waits for an interrupt to trigger, which takes various amounts of time, depending on when the last interrupt triggered. If interrupts are disabled, then don't try halt. ;)wink.gif
Title: Sprites ?
Post by: tama on July 10, 2007, 07:22:00 am
so how can I do ?
do a loop ?
Title: Sprites ?
Post by: Fallen Ghost on July 10, 2007, 10:11:00 am
well, depends on how many milliseconds you want to shove off.

nop stops for 1/1 500 000 of a second (exactly)
halt stops for about 1/120 or 1/140 of a second if you haven't messed up with interrupts (ei, di, port 3 or port 4).

To obtain a good timing, I suggest using a loop doing a bunch of nop instructions, saving the most possible bytes (we actually want to lose time, so why not save space)

c1-->
CODE
ec1
 
Title: Sprites ?
Post by: Liazon on July 10, 2007, 11:26:00 am
you'll want to pick up graylib.inc (the first release) as well because the second release is simply a modification of some of the original routines, while excluding the unmodified ones.
Title: Sprites ?
Post by: Iambian on July 12, 2007, 06:53:00 am
If you're trying to waste space, and you needed to use one more byte, why couldn't you use an instruction that takes up a helluvalot more time? The push/pop sequence is a good candidate for that. If you know that HL doesn't point to any ROM, you can also do a INC (HL) \ DEC (HL) sequence to waste one more CC than the push/pop sequence.

But if this wasn't greyscale and if you needed to waste a LOT of time, couldn't you just call the fastcopy routine again?
Title: Sprites ?
Post by: calc84maniac on July 12, 2007, 01:38:00 pm
If HL does point to ROM, would that affect anything?
Title: Sprites ?
Post by: Iambian on July 12, 2007, 03:30:00 pm
QuoteBegin-calc84maniac+12 Jul, 2007, 19:38-->
QUOTE (calc84maniac @ 12 Jul, 2007, 19:38)
If HL does point to ROM, would that affect anything?  

 I'm not sure, but it might be treated as implied load instructions by the FlashROM chip, which may tell it that you're attempting to send commands to it. Because of Flash locking, the microcontroller will see this and issue the standard response for attempting to issue instructions to Flash. I believe this is a calc reset. (RST 00h)

Need verification.
Title: Sprites ?
Post by: calc84maniac on July 13, 2007, 04:31:00 am
I tested this code oncalc and nothing happened:

c1-->
CODE
ec1ld hl,$4000
inc (hl)
dec (hl)
retc2
ec2
Title: Sprites ?
Post by: Iambian on July 13, 2007, 02:48:00 pm
Maybe if you happened to try to write to $4747 or $7474 and the value there happened to be $74 or $47?

Highly unlikely, but I'd do myself the favor of staying away from doing stuff like that.
Title: Sprites ?
Post by: tama on July 16, 2007, 04:03:00 am
I've tried Fallen Ghost's code, but after running the program 3 times, my calc crashed, don't know why
I didn't forget the "ret" at the end of the program ?
Title: Sprites ?
Post by: Fallen Ghost on July 16, 2007, 12:32:00 pm
that probably isn't because of my code, because the code I provided you, if unmodified, cannot make your calc crash by itself. You need to have some bad instruction somewhere else.

Can you post code?

A suggestion for you is to open your program with TI-Flash Debugger (that comes with TI-Connect) and breakpoint/tracelog where it crashes.