Image noise: Difference between revisions

→‎{{header|Axe}}: Added optimizations, FPS count info, and randomization info
(Added Axe)
(→‎{{header|Axe}}: Added optimizations, FPS count info, and randomization info)
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).
 
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
Fix 5
fnInt(FPS,6)
 
.Flush key presses
While getKey(0)
End
Line 256 ⟶ 267:
Repeat getKey(0)
NOISE()
RecallPic
F++
Text(0,0,F*108/N▶Dec)
Line 262 ⟶ 272:
End
 
.Clean up
LnRegʳ
Fix 4
Return
 
.Draws random noise to the back buffer
Lbl NOISE
ClrDraw
ClrDrawʳ
For(I,0,5)
For(J,0,63)
rand→{J*12+(I*2)+L₃L₆
End
End
Return
 
.Increments the tick counter
Lbl FPS
N++
Anonymous user