This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's Your Projects subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Project Ideas/Start New Projects => Your Projects
Author Message
Xeda112358


Active Member


Joined: 19 May 2009
Posts: 520

Posted: 10 Mar 2012 12:28:27 pm    Post subject:

Using the latest Grammer tools, I present this grayscale drawing tool. It works in 3 shades (black, white, gray) and saves the drawing to an appvar. The cursor can be resized as needed, too. Anyways, here is the download:
GrayDraw
And a screenie !


Last edited by Guest on 24 Mar 2012 02:58:16 pm; edited 1 time in total
Back to top
JoeYoung


Advanced Member


Joined: 15 Nov 2008
Posts: 316

Posted: 21 Mar 2012 10:23:18 am    Post subject:

hmm, how is it saved to the appvar?
Back to top
Xeda112358


Active Member


Joined: 19 May 2009
Posts: 520

Posted: 24 Mar 2012 09:09:21 am    Post subject:

Wow, I didn't notice through all the spam posts, sorry. If you mean what the memory map looks like, it stores the Black layer in the first 768 bytes and the gray layer in the next 768 bytes. I made a version of this, actually, that stored to pic vars, so when you did RecallPic in BASIC, it would display the black layer (so black and white), but using the same pic in Grammer would do a grayscale version of the pic.

If you mean "how is it possible," Grammer is an interpreted language and one of the commands lets it create vars of a given size. Since Grammer uses the BASIC program editor, it uses BASIC tokens. In this case, Send(1536,"UVar") will create an appvar named Var of 1536 bytes.
Back to top
jammasterz


Advanced Newbie


Joined: 28 Nov 2011
Posts: 72

Posted: 24 Mar 2012 11:37:03 am    Post subject:

This cant be done on TI- 83 or 84 right?
Back to top
Xeda112358


Active Member


Joined: 19 May 2009
Posts: 520

Posted: 24 Mar 2012 12:48:37 pm    Post subject:

This is for the 83+/84+ and the SE versions of them Smile (It runs in 6MHz or 15MHz well enough)
Back to top
jammasterz


Advanced Newbie


Joined: 28 Nov 2011
Posts: 72

Posted: 24 Mar 2012 01:16:01 pm    Post subject:

But isnt the screen of 83/84 monochrome? How can you display colors on it Surprised
Back to top
Xeda112358


Active Member


Joined: 19 May 2009
Posts: 520

Posted: 24 Mar 2012 02:56:57 pm    Post subject:

That is what makes grayscale on the calc so great. These models do have a b/w screen, but if you alternate displaying frames at the right speed, you can get a nice grayscale image. The trick I had to learn was that for 3-level gray:

You have a black buffer (all on pixels will result in black)
You have a gray buffer (all ON pixels will be gray so long as the black buffer also has white there)

Code:

Cycle 1: AND a checker pattern on the gray buffer
         OR this with the black buffer and display
Cycle 2: AND a checker pattern (the opposite of before)
         OR this with the black buffer and display

This helps get rid of flicker making a very nice grayscale on a monochrome screen Smile
Back to top
jammasterz


Advanced Newbie


Joined: 28 Nov 2011
Posts: 72

Posted: 25 Mar 2012 01:19:59 pm    Post subject:

Wow this must be really processor intensive Very Happy. Great Idea by the way!
Back to top
Xeda112358


Active Member


Joined: 19 May 2009
Posts: 520

Posted: 25 Mar 2012 01:23:12 pm    Post subject:

It is fairly intensive (but not as much as sound). However, you can make games with grayscale and whatnot, too. For example, combining physics and grayscale, you can see that after too many objects, the grayscale starts to get choppy:

However, if that was written totally in assembly, there could be even more objects before grayscale got choppy.
EDIT: If you are curious and would like to use my grayscale routine (in assembly), here is the LCD updating code:

Code:

;===============================================================
BufferToLCDGray:
;===============================================================
;Input:
;     HL points to the black buffer
;     IX points tot he gray buffer
;Outputs:
;
;Destroys:
;     assume all
;Notes:
;     If you start with HL=IX, then it will update in monochrome
;===============================================================
;   di
        ld a,80h
        xor (iy+33)
        ld (iy+33),a
   ld c,$55
        bit 7,(iy+33)
        jr z,$+4
        rrc c
setrow:
        LCDDelay()
   ld a,$80
   out (16),a
   ld de,12
   ld a,$20
col:
        push af
        LCDDelay()
        pop af
   out (10h),a
   push af
   ld b,64
row:
;(checker AND gray) OR black
;
        rrc c
   ld a,(ix)
        and c
        or (hl)
        add hl,de
        add ix,de
        bit 1,(iy+34)
        jr z,$+3
          cpl
        push af
        LCDDelay()
        pop af
   out ($11),a
   djnz row

   pop af
   inc a
   dec h
   dec h
   dec h
   inc hl
   dec ixh
   dec ixh
   dec ixh
   inc ix

   cp $2c
   jp nz,col
   ret

That is an altered version of safecopy to get the best results. I put as much of the code for the grayscale parsing as I could into wait cycles, so this is only slightly slower than a regular LCD update. Call this at a regular interval and you will get nice 3-level gray Smile If you have your gray buffer and black buffer at fixed addresses, you can put that at the beginning of the call to make your code easier, too. Then, whenever you want half a gray cycle, you do "call BufferToLCDGray" et voila Smile


Last edited by Guest on 25 Mar 2012 01:33:48 pm; edited 1 time in total
Back to top
jammasterz


Advanced Newbie


Joined: 28 Nov 2011
Posts: 72

Posted: 29 Mar 2012 01:19:00 am    Post subject:

Thanks! I will test it when i have some time. Just one question, port 16, what is it for? Also is there any place i could get a list of ports?
Back to top
Xeda112358


Active Member


Joined: 19 May 2009
Posts: 520

Posted: 29 Mar 2012 05:27:35 am    Post subject:

Port 16 is Port 10h. That is the LCD command port where you can turn it off or on, tell it the addressing mode, control the contrast, z-shifting (scrolls the screen up or down), and more importantly for that call, defining the coordinates to write data to port 17. Port 17 is how you access and modify the LCD RAM Smile As for information about the TI-83+ in general:
http://wikiti.brandonw.net/index.php?title=Category:83Plus
That gives documentation about ports, RAM, flags, bcalls, hooks, and others Smile
Specifically, here is the page for the LCD port:
http://wikiti.brandonw.net/index.php?title=83Plus:Ports:10


Last edited by Guest on 29 Mar 2012 05:30:02 am; edited 1 time in total
Back to top
jammasterz


Advanced Newbie


Joined: 28 Nov 2011
Posts: 72

Posted: 30 Mar 2012 01:04:31 am    Post subject:

Wow thanks! This is exactly what i've been looking for Smile
Back to top
Xeda112358


Active Member


Joined: 19 May 2009
Posts: 520

Posted: 30 Mar 2012 05:18:13 am    Post subject:

Very Happy I am not exactly a pro with z80 on the calcs, but if you have any specific questions, feel free to post them in the z80 thread Smile
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement