Image noise: Difference between revisions

Content added Content deleted
(Added Axe)
(→‎{{header|Axe}}: Added optimizations, FPS count info, and randomization info)
Line 246: Line 246:
Instead of naively drawing each pixel to the screen, this implementation directly writes random numbers to the buffer, which randomly sets each pixel. Because Axe does not have native clock support, the FPS counter is simulated by counting "ticks" at the known interrupt rate of 107.79 Hz (rounded to 108).
Instead of naively drawing each pixel to the screen, this implementation directly writes random numbers to the buffer, which randomly sets each pixel. Because Axe does not have native clock support, the FPS counter is simulated by counting "ticks" at the known interrupt rate of 107.79 Hz (rounded to 108).


It is possible to notice some vertical line patterns in the noise. This is likely due to the pseudorandom number generator and not the drawing method.
<lang axe>0→F

This example gets steady 48 FPS on a TI-84 Plus Silver Edition running at 15 MHz. It gets 26 FPS when running at 6 MHz.

<lang axe>.Enable 15 MHz full speed mode
Full
.Disable memory access delays (adds 1 FPS)
Fullʳ

.Setup
0→F
0→N
0→N
Fix 5
Fix 5
fnInt(FPS,6)
fnInt(FPS,6)


.Flush key presses
While getKey(0)
While getKey(0)
End
End
Line 256: Line 267:
Repeat getKey(0)
Repeat getKey(0)
NOISE()
NOISE()
RecallPic
F++
F++
Text(0,0,F*108/N▶Dec)
Text(0,0,F*108/N▶Dec)
Line 262: Line 272:
End
End


.Clean up
LnRegʳ
LnRegʳ
Fix 4
Fix 4
Return
Return


.Draws random noise to the back buffer
Lbl NOISE
Lbl NOISE
ClrDraw
ClrDrawʳ
For(I,0,5)
For(I,0,5)
For(J,0,63)
For(J,0,63)
rand→{J*12+(I*2)+L₃
rand→{J*12+(I*2)+L₆
End
End
End
End
Return
Return


.Increments the tick counter
Lbl FPS
Lbl FPS
N++
N++