最終更新 1730503328

修正履歴 57b885dcf73d480315c99ab9dbf4ea493240957b

rgb400.nv Raw Playground
1|--| Are we at the end of a line?
2|eol?,x|x,~eol|eol?|eol
3
4|--| Are we at the end of the screen?
5|eos?,y|y,~eos|eos?|eos
6
7|--| Copy the pixel coordinates from `x/y` to `@pixel-x/@pixel-y`.
8|px=x,x|*x,@pixel-x,px=x
9|px=x|
10|py=y,y|*y,@pixel-y,py=y
11|py=y|
12
13|--| Compute some pixel colors based on the `x/y` coordinates.
14|--| r = x, g = y, b = x + y
15|pr=x,x|*x,@pixel-r,pr=x|pr=x|
16|pg=y,y|*y,@pixel-g,pg=y|pg=y|
17|pb=x+y,x|*x,@pixel-b,pb=x+y
18|pb=x+y,y|*y,@pixel-b,pb=x+y
19|pb=x+y|
20
21|--| Copy temporaries back to their respective variables.
22|*x|x|*y|y
23
24|--| Plot a pixel.
25|pp|px,py,pr,pg,pb,ps
26|px|px=x:399
27|py|py=y:399
28|pr|pr=x:399
29|pg|pg=y:399
30|pb|pb=x+y:399
31|ps|@set-pixel
32
33|--| Move the `x/y` coordinates.
34|x-,x||x-||y-,y||y-|
35
36|--| Clear the previous color values before computing a new color.
37|@pixel-r||@pixel-g||@pixel-b|
38
39|--| Main loop.
40||x:399,y:399
41|f,eol,x|f,eol,f
42|f,eol|f,eos?, @display
43|f,~eol|pp,x-,f
44|f,eos|pp,x:399,y:399
45|f,~eos,x|f,~eos
46|f,~eos|y-,x:399,f
47|f|eol?,f
48||f