Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Xeda112358 on January 21, 2012, 02:36:31 pm

Title: Fire
Post by: Xeda112358 on January 21, 2012, 02:36:31 pm
Okay, after having some fun with Builderboy's Flame tutorial and Deep Thought's ORG ide, I put together this little program (136 bytes). Pretty much, you send a number in Ans and this program uses that picture as fuel for a fire. If the picture doesn't exist, it just disintegrates the screen. It will keep burning until the user presses a key, too, so you can use this for an intro screen in a game!

Things I am wondering if I should add:
-making white fire instead
-using the current screen as fuel
-seeing if I could add this in as an interrupt to be disabled or enabled
-Adding in 15MHz mode
Title: Re: Fire
Post by: systwo on January 21, 2012, 03:09:20 pm
That's pretty cool! The white fire idea would be a good idea because it would look like more of a fire, as fire is usually brighter. Just a question from a beginning programmer, what does the "3:" and "6:" do?
Title: Re: Fire
Post by: ben_g on January 21, 2012, 03:14:21 pm
they store 3 or 6 into ans before running the program.
Title: Re: Fire
Post by: Xeda112358 on January 21, 2012, 03:21:54 pm
Oh, well pictures are named by 60xx in memory. When I do 3, my program looks for the picture 6003 (Pic4) and when I do 6, it searches for Pic7 (6006). Pretty much, I do something like this:
Code: [Select]
     bcall(_RclAns)
     or a                    ;tests if A is 0. this is the type and we want 0 (o is a number)
     jr nz,PicNotFound
     bcall(_ConvOP1)   ;we find the number
     ld d,e
     ld e,60h              ;so DE is xx60. in RAM, it is stored in reverse as 60xx
     ld (OP1+1),de      ;we load the name to OP1
     xor a                  ;optimised way to do ld a,0 (3 cycles faster, 1 byte smaller)
     ld (OP1+3),a        ;we add a zero after the name
     rst rFindSym        ;we locate the var
     jr c,PicNotFound
     inc de
     inc de                 ;de now points tot he picture data :)
Also, it now handles the options using the current graph screen as fuel as well as using white fire (program and screenie coming soon!)
Title: Re: Fire
Post by: Builderboy on January 21, 2012, 03:31:50 pm
You should have white fire, black fire, and maybe even greyscale fire like in FireFall :D
(http://www.omnimaga.org/index.php?action=dlattach;topic=10774.0;attach=9767;image)
But it's looking really cool ^^ Do you think the intensity of the fire should be a possible argument?
Title: Re: Fire
Post by: Xeda112358 on January 21, 2012, 03:34:09 pm
That is a good idea, too o.o And I think I will keep the fire options simple XD I want it so any BASIC user can use it with ease :) Also, ORG is not working for me at the moment, so bug testing and stuff is not working D:

EDIT: Okay, here is an updated version:
-Use a number >255 to use the graph screen as an image for fuel
-Use - before the number to use white fire instead
Title: Re: Fire
Post by: ZippyDee on January 21, 2012, 04:53:40 pm
Heh...It'd be cool to be able to have your screen burning with grayscale fire while using the calc normally.
Title: Re: Fire
Post by: Xeda112358 on January 21, 2012, 04:56:41 pm
Hmm, well I was thinking of making an interrupt to keep a burning picture...

EDIT: It might go well with zStart...
Title: Re: Fire
Post by: cooliojazz on January 21, 2012, 05:06:29 pm
That would be amazing if you could do that.  I would totally program with fire... XD
Title: Re: Fire
Post by: Darl181 on January 21, 2012, 05:07:31 pm
/me wonders if something like this would work well as an Axiom
It's not that hard to do yourself but still 0.o
Title: Re: Fire
Post by: Xeda112358 on January 21, 2012, 05:39:13 pm
As an axiom command, you would only need to execute one frame and let the user put the frame in a loop. The loop that is executed is this:
Code: [Select]
Fire:
    ld hl,934Ch
    ld de,9340h
    ld bc,2F4h
Random:         ;feel free to give me a smaller rand routine that is pretty random x.x
    push hl
    push de
    ld hl,0
    ld a,r
    ld h,a
    add a,(hl)
    inc hl
    rrca
    add a,(hl)
    inc hl
    rrca
    xor (hl)
    inc hl
    rrca
    rrca
    ld l,a
    ld (Random+3),hl
    and 7
    ld d,8Bh
    ld e,a
    ld a,(de)
    pop de
    pop hl
Method:
    or (hl)            ;change to AND for t'other method
    ld (de),a
    inc de
    cpi
    jp pe,Random
    ret
And 8B00h contains the bytes 0102040810204080. Use FEFDFBF7EFDFBF7F for black fire.
After that, you just draw your picture back over it with display the graph to the LCD :)

To lessen the intensity, you can change the and 7 to and 3 and the values at 8B00h to 18244281 or something similar.
To raise the intensity, change to and 15 and put an FF between each byte at 8B00h, so FEFFFDFFFBFFF7FFEFFFDFFFBFFF7FFF
Title: Re: Fire
Post by: thepenguin77 on January 21, 2012, 06:49:26 pm
Heh...It'd be cool to be able to have your screen burning with grayscale fire while using the calc normally.

Those kind of mods are rather difficult as many OS processes only update the screen and nothing else. That means it would be difficult to keep a memory of what was actually on the screen.

The only solution I see would be to read the entire LCD back before every single grayscale interrupt and compare it to a known copy of what the screen looked like. This however would require two full screen updates and therefore 100% of cpu time at 60hz. It should run at 30hz though.

So, if I get bored... (Or if xeda gets bored (make a getCSC hook that enables your interrupt :D))
Title: Re: Fire
Post by: TIfanx1999 on January 21, 2012, 09:37:00 pm
Xeda, that's an awesome program! ;D
Title: Re: Fire
Post by: Xeda112358 on January 21, 2012, 09:38:01 pm
Thanks :D I hope it will be useful to some BASIC coder out there some day :)
Title: Re: Fire
Post by: Yeong on January 22, 2012, 01:52:06 pm
whoa. I just read this. :D
Looks great. XD
Title: Re: Fire
Post by: Deep Toaster on January 22, 2012, 11:00:26 pm
Heh...It'd be cool to be able to have your screen burning with grayscale fire while using the calc normally.
Those kind of mods are rather difficult as many OS processes only update the screen and nothing else. That means it would be difficult to keep a memory of what was actually on the screen.
That would be epic. Something like ON+GRAPH to set the current screen on fire? :D
Title: Re: Fire
Post by: chattahippie on January 22, 2012, 11:13:35 pm
Or when you clear the screen with [CLEAR], instead of vanishing, the screen burns away ;D
Title: Re: Fire
Post by: Thundermagnet on January 22, 2012, 11:24:06 pm
THAT is a cool program...
Title: Re: Fire
Post by: ZippyDee on January 23, 2012, 12:04:48 am
Heh...It'd be cool to be able to have your screen burning with grayscale fire while using the calc normally.

Those kind of mods are rather difficult as many OS processes only update the screen and nothing else. That means it would be difficult to keep a memory of what was actually on the screen.

The only solution I see would be to read the entire LCD back before every single grayscale interrupt and compare it to a known copy of what the screen looked like. This however would require two full screen updates and therefore 100% of cpu time at 60hz. It should run at 30hz though.

So, if I get bored... (Or if xeda gets bored (make a getCSC hook that enables your interrupt :D))

Oh yeah, I hadn't thought of the fact that the OS tends to write directly to the LCD :\
Title: Re: Fire
Post by: Xeda112358 on January 23, 2012, 07:30:16 am
Wow, I really like the idea of pressing clear an burning away the screen o.o If I get time, I want to work on that!
Title: Re: Fire
Post by: hellninjas on February 15, 2012, 03:38:26 pm
Thanks for this Xeda!
It helps alot :D
Title: Re: Fire
Post by: Xeda112358 on February 15, 2012, 03:55:42 pm
No problem :3 I am glad it helped!
Title: Re: Fire
Post by: DJ Omnimaga on February 15, 2012, 03:57:25 pm
Yeong should use this as part of the new ROL3 magic animations (maybe Omnima which has 4 elements?)
Title: Re: Fire
Post by: Xeda112358 on February 16, 2012, 06:27:27 am
Hmm, Grammer can use assembly programs... But I could add it as a fill option as well.
Title: Re: Fire
Post by: chattahippie on February 16, 2012, 07:06:01 am
Hmm, Grammer can use assembly programs... But I could add it as a fill option as well.

That would be awesome! :D
Title: Re: Fire
Post by: Yeong on February 16, 2012, 05:53:49 pm
Yeong should use this as part of the new ROL3 magic animations (maybe Omnima which has 4 elements?)
What I was thinking about Omnima is using pyro, quasar, freeze, and blitz animation to elemental attack.