| 10 Mar 2012 12:28:27 pm by Sven.Thomas0 |
|
|
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 !
 |
| 21 Mar 2012 10:23:18 am by JoeYoung |
|
|
| hmm, how is it saved to the appvar? |
| 24 Mar 2012 09:09:21 am by Sven.Thomas0 |
|
|
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. |
| 24 Mar 2012 11:37:03 am by jammasterz |
|
|
| This cant be done on TI- 83 or 84 right? |
| 24 Mar 2012 12:48:37 pm by Sven.Thomas0 |
|
|
This is for the 83+/84+ and the SE versions of them (It runs in 6MHz or 15MHz well enough) |
| 24 Mar 2012 01:16:01 pm by jammasterz |
|
|
But isnt the screen of 83/84 monochrome? How can you display colors on it  |
| 24 Mar 2012 02:56:57 pm by Sven.Thomas0 |
|
|
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  |
| 25 Mar 2012 01:19:59 pm by jammasterz |
|
|
Wow this must be really processor intensive . Great Idea by the way! |
| 25 Mar 2012 01:23:12 pm by Sven.Thomas0 |
|
|
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 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  |
| 29 Mar 2012 01:19:00 am by jammasterz |
|
|
| 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? |
| 29 Mar 2012 05:27:35 am by Sven.Thomas0 |
|
|
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 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
Specifically, here is the page for the LCD port:
http://wikiti.brandonw.net/index.php?title=83Plus:Ports:10 |
| 30 Mar 2012 01:04:31 am by jammasterz |
|
|
Wow thanks! This is exactly what i've been looking for  |
| 30 Mar 2012 05:18:13 am by Sven.Thomas0 |
|
|
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  |