Alright, here we go. For this example we are going to assume that your choices of color are black, white and grey. After I explain it in this format, you can easily apply it with more shades of grey. My goal is to get this pic:


On my calculator. Also, I want to acieve the least flicker possible so I will use my alternating routine described above. So I will create this pic in Sprite to Hex or however you want to do it, and then when I hit convert it will give me this as an output (note: it's in binary so it's easier for me to convert with my eye):


Code:
Layer1:
.db %11111111,%11111111,%11111111,%11111111
.db %11010101,%01010101,%01010101,%01010101
.db %11000100,%10100100,%10010101,%01010101
.db %11000101,%01001000,%10010010,%00100101
.db %11000001,%01000100,%10001001,%00010011
.db %11000100,%10100010,%00100100,%01001011
.db %11010101,%01010101,%01010101,%01010101
.db %10101001,%01010101,%01010101,%01010101
.db %10101010,%10100100,%10101010,%10101011
.db %10001001,%01010101,%10101010,%10101011
.db %10100100,%10100100,%10101010,%10101011
.db %11010010,%10101000,%10101010,%10101011
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11111111,%11111111,%11111111,%11111111

Layer2:
.db %11111111,%11111111,%11111111,%11111111
.db %10101010,%10101010,%10101010,%10101011
.db %10010001,%01001010,%00101010,%10101011
.db %10010010,%10100010,%00100100,%01001011
.db %10000100,%10100010,%00100100,%01000101
.db %10010001,%01001000,%10001001,%00100101
.db %10101010,%10101010,%10101010,%10101011
.db %10010100,%10101010,%10101010,%10101011
.db %10010101,%01010010,%01010101,%01010101
.db %10000100,%10101010,%01010101,%01010101
.db %10001001,%01010010,%01010101,%01010101
.db %10101001,%01010001,%01010101,%01010101
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %11111111,%11111111,%11111111,%11111111


The strategy here has been to keep a tally of what we did for the last grey. If we put a one on this layer for the previous grey we encountered, we will put a zero for the current one and vise-versa. This provides us with a checkerboard of grey so to speek, which will virtually eliminate flicker when we switch between the two layers. Now with this knowledge we can create an asm program with this flickerless greyscale to prove my point. Here's 5 minutes of programming (and 30 min of debugging - I made one of the % a $ but didn't catch it for a while Sad ).


Code:
;Author: Patrick Stetter
;Program:
;Date:


#include   "ti83plus.inc"
#include   "mirage.inc"
   
   
   
   .org   $9d93
   .db   $BB,$6D
   ret
   .db   1
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   "POOP",0

mainloop:
   call fastclear
   ld hl,Layer1
   ld a,32
   ld e,16
   ld b,a
   call putsprite32bit
   call ifastcopy
   call fastclear
   ld hl,Layer2
   ld b,32
   ld a,b
   ld e,16
   call putsprite32bit
   call ifastcopy
   bcall(_getcsc)
   cp skenter
   jr nz,mainloop
   ret
   
   
fastclear:
   ld hl,PlotsScreen
   ld bc,60*12
fastclearloop:
   xor a
   ld (hl),a
   inc hl
   dec bc
   ld a,c
   or b
   jr nz,fastclearloop
   ret
   
putsprite32bit:
;hl=address of sprite
;e=y
;a=x
;b=rows
;32pixels per row
   push hl
   call getplot
   pop de
   and 7
   jr z,aligned
outerloop:
   push bc
   push af
   ld b,a
   ex de,hl
   ld c,(hl)
   inc hl
   ex de,hl
   xor a
shiftloop:
   srl c
   rra
   djnz shiftloop
   inc hl
   or (hl)
   ld (hl),a
   dec hl
   ld a,c
   or (hl)
   ld (hl),a
   inc hl
   pop af
   push af
   ld b,a
   ex de,hl
   ld c,(hl)
   inc hl
   ex de,hl
   xor a
shiftloop1:
   srl c
   rra
   djnz shiftloop1
   inc hl
   or (hl)
   ld (hl),a
   dec hl
   ld a,c
   or (hl)
   ld (hl),a
   inc hl
   pop af
   push af
   ld b,a
   ex de,hl
   ld c,(hl)
   inc hl
   ex de,hl
   xor a
shiftloop2:
   srl c
   rra
   djnz shiftloop2
   inc hl
   or (hl)
   ld (hl),a
   dec hl
   ld a,c
   or (hl)
   ld (hl),a
   inc hl   
   pop af
   push af
   ld b,a
   ex de,hl
   ld c,(hl)
   inc hl
   ex de,hl
   xor a
shiftloop3:
   srl c
   rra
   djnz shiftloop3
   inc hl
   or (hl)
   ld (hl),a
   dec hl
   ld a,c
   or (hl)
   ld (hl),a
   ld bc,9
   add hl,bc   
   pop af
   pop bc
   djnz outerloop
   ret
aligned:
   push bc
   ex de,hl
   ld a,(hl)
   inc hl
   ex de,hl
   or (hl)
   ld (hl),a
   inc hl
   ex de,hl
   ld a,(hl)
   inc hl
   ex de,hl
   or (hl)
   ld (hl),a
   inc hl
   ex de,hl
   ld a,(hl)
   inc hl
   ex de,hl
   or (hl)
   ld (hl),a
   inc hl
   ex de,hl
   ld a,(hl)
   inc hl
   ex de,hl
   or (hl)
   ld (hl),a
   inc hl
   ld bc,8
   add hl,bc
   pop bc
   djnz aligned
   ret
   
getplot:
   ld h,0
   ld d,h
   ld l,e
   add hl,hl
   add hl,de
   add hl,hl
   add hl,hl
   ld e,a
   srl e
   srl e
   srl e
   add hl,de
   ld de,plotsScreen
   add hl,de
   ret
   
   

Layer1:
.db %11111111,%11111111,%11111111,%11111111
.db %11010101,%01010101,%01010101,%01010101
.db %11000100,%10100100,%10010101,%01010101
.db %11000101,%01001000,%10010010,%00100101
.db %11000001,%01000100,%10001001,%00010011
.db %11000100,%10100010,%00100100,%01001011
.db %11010101,%01010101,%01010101,%01010101
.db %10101001,%01010101,%01010101,%01010101
.db %10101010,%10100100,%10101010,%10101011
.db %10001001,%01010101,%10101010,%10101011
.db %10100100,%10100100,%10101010,%10101011
.db %11010010,%10101000,%10101010,%10101011
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11010101,%01010101,%01010101,%01010101
.db %11111111,%11111111,%11111111,%11111111

Layer2:
.db %11111111,%11111111,%11111111,%11111111
.db %10101010,%10101010,%10101010,%10101011
.db %10010001,%01001010,%00101010,%10101011
.db %10010010,%10100010,%00100100,%01001011
.db %10000100,%10100010,%00100100,%01000101
.db %10010001,%01001000,%10001001,%00100101
.db %10101010,%10101010,%10101010,%10101011
.db %10010100,%10101010,%10101010,%10101011
.db %10010101,%01010010,%01010101,%01010101
.db %10000100,%10101010,%01010101,%01010101
.db %10001001,%01010010,%01010101,%01010101
.db %10101001,%01010001,%01010101,%01010101
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %10101010,%10101010,%10101010,%10101011
.db %11111111,%11111111,%11111111,%11111111

.end
end


Here's a screenie.



Also, you should note that this looks much much better on calc. But pindurti does a decent job with it. Also, if could have alternated my alternating at the bottom if I had more time (to make it even more checkerboard like) but I prefered copy and pasting becuase I'm not a machine (but your program should do it that way.

Now you can clearly see why this is better than a visibly flashing on and off program. Smile If you still don't believe me, I can make a screenshot of the flicker type, but this whole thing took me about an hour to do. Wink
Shock Shock Please tell me you didn't make that from scratch specifically for this, that you used your gs engine from your TIFW contest entry...
It's all custom made, just for this. Smile It only took about 10 minutes to make (which is why the 32 bit sprite routine is so unoptomized), and another 20 min to debug. My TIFW gs engine is not made for 32 bit wide sprites so I figured what the heck Wink

Kllrnohj, I really hope you add this feature. I did put in a good amount of effort into showing you how it's done. Smile I would, of course, be willing to put more effort in if you need further explanation.
Really for

4 level gs:
2 layers, display time for each at a ratio of 1:2. To figure out how dark it is, just add up the numbers of each layer a pixel is turned on. 3 is black, 0 is white.

Correct me if i'm wrong:

8 level gs:
3 layers, display time for each at a ratio of 1:2:4. Same method to figure outhow dark something is. 7 is black, 0 is white.

I just noticed this, but I guess that's why 8 level is probably difficult right? It's even more data, and the timing has to be perfect. Plus, if you add scrolling all the detail will probably blur again. Am I right about this assessment.

kllrnohj: I'd like to use this program instead of Istudio if you can adjust the formating of the outputted hex.

In TIGCC, an 8 pixel wide sprite looks like this: 0xYY
a 16 pixel wide looks like this: 0xYYYY
and a 32 bit : 0xYYYYYYYY
where the Y's are hexidecimal digits, you probably knew that already. My issue with istudio is that it outputs everything as chars, so I sometimes have to manually delete a bunch of ,0x to make shorts or longs.
You're correct about 4- and 8-level gs, Liazon. And yes, that's why 8-level is difficult, and can often lead to flicker if not done correctly. I recommend you just stick with .db $nn,$mm,$ss,$qq
Alright, I think I got it for both 3lvl (chip style) and 4lvl (1:2 ratio style) grayscale - now I just need to program it Smile

I already have the grayscale clicking done (so you can draw in grayscale), it just doesn't produce meaningful hex yet.

For the saved HEX, I only have exporting to Z80 available right now, but adding others won't be hard. Also, I have the hex-prefix as user-configurable, so if you (or the compiler) would rather have 0x or # instead of the default of $, you don't need to muck about in the source to change that Wink (for C output - if I add that - I will make it so you can change the type of it.)

EDIT: New screenshots Wink (with working 3- and 4-lvl grayscale Smile )









(Yes, I noticed that the hex prefix is missing in roughly half of those in test.z80 in the last screenshot - I noticed it right after I did the screenshot, and I fixed it, but I was too lazy to remake the screenshot)
I like what I see. If it isn't too much trouble, I'd like to ask a few questions/make suggestions. And if it's in Python, I may be able to help even.

-Will this allow importing of images (PNG, JPG, BMP, GIF, etc.)?
-Will there be the ability to edit entire tilesets (like CalcGS)?
-Will multiple sizes be included (8n x h)?
-Will other tools be available (bucket, line, eraser)?

8-level is/will be supported in TIGCC, so it might be another option once it makes it in (if it hasn't already).
kirb wrote:
I like what I see. If it isn't too much trouble, I'd like to ask a few questions/make suggestions. And if it's in Python, I may be able to help even.

Its all in C++

Quote:
-Will this allow importing of images (PNG, JPG, BMP, GIF, etc.)?

It will. wxWidgets allows me to access images the same way I currently access the drawing and preview areas. I will also add a "from hex" option. These will all come after I've got the core down and verified that its working Smile

Quote:
-Will there be the ability to edit entire tilesets (like CalcGS)?

What are tilesets?

Quote:
-Will multiple sizes be included (8n x h)?

You mean like an 8x16 or something? That will require a *bit* of restructuring, as currently the for() loops that iterate through the image use the same variable to determine the size. Adding a second variable for the Y size shouldn't be too difficult, however, so that is a possibility

Quote:
-Will other tools be available (bucket, line, eraser)?

I doubt bucket or line will be available, but I was planning on implementing more of a pen rather than the click (as in you can drag-draw). As for the eraser, my idea was something like shift-click erases, ctrl-click == gray/gray lvl1, alt-click == gray/gray lvl2 - is that acceptable, or would you prefer to be able to select different "colors"? (like an eraser or just draw gray) - they are both easily implemented, its just a design choice

Quote:
8-level is/will be supported in TIGCC, so it might be another option once it makes it in (if it hasn't already).

I'll look into it. It shouldn't be much harder to add, as when I went through and added grayscale I made it so others could be added.


NEW RELEASE:

Here is the version 0.2 SOURCE and the first WINDOWS BINARY. I haven't really *verified* that the windows binary is working correctly (as in whether or not it needs wxWidgets DLLs - I think I compiled it statically, so that it doesn't, but I'm not 100% positive), so if you get a wierd error message, please take a screenshot of it and send it to me....
Looks like it might need GTK, no?
It worked fine for me, but I have GTK+ installed.
So do I. I just looked at the interface, and it appeared to be using GTK stuff, unless that's just because it was running under Gnome.
Kllrnohj wrote:
As for the eraser, my idea was something like shift-click erases
How about also letting right click erase?

I'm lovin' the progress so far. Good Idea This is definitely my sprite creator from now on!

Edit: So are you looking into compression? I'd recommend RLE and vertical RLE compression.
Kllrnohj wrote:
Quote:
-Will there be the ability to edit entire tilesets (like CalcGS)?

What are tilesets?

Working on more than one at a time is what I mean. Instead of opening/closing to get to another file, have thumbnails at the top so that quick access is available.

EDIT: I can confirm that it works without wxWidgets DLLs (unless wxPython installs them) and GTK wouldn't be needed anyway...wxWidgets is ∞x better.
Yup, someone actually suggested I also use tilesets in an editor for SC2; that might be a feature for SC3.
KermMartian wrote:
So do I. I just looked at the interface, and it appeared to be using GTK stuff, unless that's just because it was running under Gnome.


wxWidgets uses GTK on Linux, so thats why it looked like it needed GTK. The windows version of wxWidgets, however, links straight to the Win32 API - so GTK is not needed in any way whatsoever (unless you are using wxGTK in linux Wink )

@Chip: Right-click can be erase, I'll work on that once I get my comp back up (its down now, switching cases for my new system which arrives today)

@Kirb: I'll try and add tileset / tab support, it shouldn't be *too* difficult
Since when did TIGCC allow 8 level gs?
Liazon wrote:
Since when did TIGCC allow 8 level gs?

Kevin's been working on it. It probably got pushed to the back burner since KTIGCC was started.
What happened to the limitations of HW2-4? Would the purpose of adding 8 level to TIGCC be to allow for 8 level gs splash screens. I've never seen 8 level gs before, so I wouldn't know how practical it is.
Liazon: unless you work out some good scan-line interleaving or other non-linear display method, it would be pretty flickery.
  
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
Page 2 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement