Author Topic: Stripes instead of flickerless  (Read 5048 times)

0 Members and 1 Guest are viewing this topic.

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Stripes instead of flickerless
« on: August 28, 2011, 05:58:57 pm »
In my topic on the game "Elimination," I mentioned that my grayscale was "almost" flickerless.  However, no matter what I attempt (fixed timings for the LCD delay, never using di, etc.)  I see wierd gray stripes starting from the bottom and working their way to the top, like a barbership pole.  Any ideas as to why?  (Note: when you select this program from applications, press 2nd even if nothing appears.  Also, YOU WILL NEED TO START YOUR CALCULATOR FRESH when using this program, as entrances and exits are unstable.)

EDIT: Here's the interrupt routine I'm using.

Code: [Select]

relocate($F6F6)
F:

di


_
push af
push de
push bc
push hl

ld a, (frameage)
inc a
ld (frameage),a
cp 1
jr z, doregular
cp 3
jr z, dogray
cp 4
jr nz, EndInterrupt
xor a
ld (frameage), a
jr EndInterrupt

doregular:
ld hl, regularbuffer
call safecopy2
jr EndInterrupt

dogray:
ld hl, grayscalebuffer
call safecopy2

EndInterrupt:

pop hl
pop bc
pop de

ld a, %00001000
out (3), a
ld a, %00001010
out (3), a
pop af




ei
ret
SafeCopy:
;ld hl, plotsscreen
safecopy2:

ld c,$10
ld a,$80
setrow:
in b,(c)
rl b
jp c,setrow
out ($10),a
ld de,12
ld a,$20
col:
in b,(c)
rl b
jp c,col

out ($10),a
push af
inc c
ld b,64
row:

rowwait:
in a,($10)
rla
jp c,rowwait
ld a, (hl)
out (c), a
add hl,de
dec b
jp nz, rowwait
pop af
dec h
dec h
dec h
dec c
inc hl
inc a
cp $2c
jp nz,col

ret

« Last Edit: August 28, 2011, 06:02:35 pm by Hot_Dog »

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Stripes instead of flickerless
« Reply #1 on: August 28, 2011, 08:13:07 pm »
I've got a feeling that the second I see the effect that is happening, I'll be able to tell what's wrong. But, at the moment, the app crashes the moment I start it in wabbitemu. The program works until I press 2nd. Pressing 2nd I believe tries to draw the screen and that is when it crashes. (I can move up or down, but the moment I press 2nd, it locks)
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline annoyingcalc

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1953
  • Rating: +140/-72
  • Found in Eclipse.exe
    • View Profile
Re: Stripes instead of flickerless
« Reply #2 on: August 28, 2011, 08:25:33 pm »
what do you do to get past the gemini screen?
This used to contain a signature.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Stripes instead of flickerless
« Reply #3 on: August 28, 2011, 09:09:00 pm »
It looks like you're trying to do grayscale like this (warning epilepsy :P), but usually we do grayscale like this, which blends together much better. We can't reliably synchronize with the LCD on the TI-83+, plus we usually can't update the screen quickly enough to keep up anyway.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Stripes instead of flickerless
« Reply #4 on: August 28, 2011, 10:34:30 pm »
It looks like you're trying to do grayscale like this (warning epilepsy :P), but usually we do grayscale like this, which blends together much better. We can't reliably synchronize with the LCD on the TI-83+, plus we usually can't update the screen quickly enough to keep up anyway.

Actually the first one is how I drew grayscale.  So you're saying that grayscale blends much better if I use a checkerboard pattern?

Offline ralphdspam

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 841
  • Rating: +38/-1
  • My name is actually Matt.
    • View Profile
Re: Stripes instead of flickerless
« Reply #5 on: August 28, 2011, 10:52:04 pm »
I will refrain from suggesting the Axe routine and give you a link to Thepenguin77's explanation.  

http://ourl.ca/9538/182589

You can't really apply the crystal timers or the extra ram, but it does have a good algorithm for creating the stripe patterns.  :)

Oh, also use horizontal auto increment instead of vertical auto increment. 
« Last Edit: August 28, 2011, 10:53:54 pm by ralphdspam »
ld a, 0
ld a, a

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Stripes instead of flickerless
« Reply #6 on: August 28, 2011, 10:59:24 pm »
I guess what you're saying is it doesn't work if I have two buffers where pixels alternate in a checkboard pattern?

EDIT: Oh, it's because no matter how fast or how slow you refresh the screen RAM, it displays 60 times a second.  I missed that part.
« Last Edit: August 28, 2011, 11:03:36 pm by Hot_Dog »

Offline ralphdspam

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 841
  • Rating: +38/-1
  • My name is actually Matt.
    • View Profile
Re: Stripes instead of flickerless
« Reply #7 on: August 28, 2011, 11:42:12 pm »
I guess what you're saying is it doesn't work if I have two buffers where pixels alternate in a checkboard pattern?
No, that should work if you time the picture properly.  

Quote
EDIT: Oh, it's because no matter how fast or how slow you refresh the screen RAM, it displays 60 times a second.  I missed that part.
Yeah.  That might be the problem.  
« Last Edit: August 28, 2011, 11:42:34 pm by ralphdspam »
ld a, 0
ld a, a

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Stripes instead of flickerless
« Reply #8 on: August 28, 2011, 11:51:34 pm »
I guess what you're saying is it doesn't work if I have two buffers where pixels alternate in a checkboard pattern?

EDIT: Oh, it's because no matter how fast or how slow you refresh the screen RAM, it displays 60 times a second.  I missed that part.
You can keep the buffers how they are, but you should combine them in such a way that it takes 2 pixels from the dark buffer, 1 pixel from the light buffer, 2 pixels from the dark buffer, 1 pixel from the light buffer, etc. This can be done with some clever bitmasking. You'll have to do 3 screen updates before the pattern repeats itself.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Stripes instead of flickerless
« Reply #9 on: August 28, 2011, 11:59:05 pm »
I guess what you're saying is it doesn't work if I have two buffers where pixels alternate in a checkboard pattern?

EDIT: Oh, it's because no matter how fast or how slow you refresh the screen RAM, it displays 60 times a second.  I missed that part.
You can keep the buffers how they are, but you should combine them in such a way that it takes 2 pixels from the dark buffer, 1 pixel from the light buffer, 2 pixels from the dark buffer, 1 pixel from the light buffer, etc. This can be done with some clever bitmasking. You'll have to do 3 screen updates before the pattern repeats itself.

I'm only doing 3-color grayscale.  I think my problem is the screen refresh.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Stripes instead of flickerless
« Reply #10 on: August 29, 2011, 12:05:08 am »
I guess what you're saying is it doesn't work if I have two buffers where pixels alternate in a checkboard pattern?

EDIT: Oh, it's because no matter how fast or how slow you refresh the screen RAM, it displays 60 times a second.  I missed that part.
You can keep the buffers how they are, but you should combine them in such a way that it takes 2 pixels from the dark buffer, 1 pixel from the light buffer, 2 pixels from the dark buffer, 1 pixel from the light buffer, etc. This can be done with some clever bitmasking. You'll have to do 3 screen updates before the pattern repeats itself.

I'm only doing 3-color grayscale.  I think my problem is the screen refresh.
Oh I see, I misread your code. You can still do something similar with 3-level, by taking alternating pixels from each buffer (which makes good use of the lcd output delay). Either that or you can draw the buffers in a checkerboard pattern to begin with, but that might hurt performance.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Stripes instead of flickerless
« Reply #11 on: August 29, 2011, 10:04:27 pm »
Thanks to everyone for helping me get this to work.  Now I just need to write a calibration routine :)