Skip to content

Commit

Permalink
Update shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
mole99 committed Jan 12, 2025
1 parent 25e26b5 commit f30b9da
Show file tree
Hide file tree
Showing 23 changed files with 123 additions and 36 deletions.
2 changes: 1 addition & 1 deletion sw/binary/test1.bit
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
00_0000_00 // SETRGB R0
00_0100_01 // GETX R1
00_0101_10 // GETY R2
11_010000 // LDI 0x10
00_0110_00 // GETTIME R0
00_1000_01 // IFEQ R1
00_0000_01 // SETRGB R1
00_1000_10 // IFEQ R2
Expand Down
10 changes: 10 additions & 0 deletions sw/binary/test10.bit
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
00_0100_00 // GETX R0
00_0110_01 // GETTIME R1
10_01_01_00 // ADD R0 R1
00_1111_10 // SINE R2
00_0101_00 // GETY R0
00_0110_01 // GETTIME R1
10_01_01_00 // ADD R0 R1
00_1111_00 // SINE R0
10_01_10_00 // ADD R0 R2
00_0000_00 // SETRGB R0
10 changes: 10 additions & 0 deletions sw/binary/test11.bit
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
00_1100_00 // DOUBLE R0
00_0000_00 // SETRGB R0
00_1110_11 // CLEAR R3
00_1000_11 // IFEQ R3
00_0110_00 // GETTIME R0
01_00_00_00 // NOP
01_00_00_00 // NOP
01_00_00_00 // NOP
01_00_00_00 // NOP
01_00_00_00 // NOP
10 changes: 10 additions & 0 deletions sw/binary/test12.bit
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
00_0100_00 // GETX R0
00_1111_01 // SINE R1
00_0101_00 // GETY R0
00_1111_00 // SINE R0
01_11_01_00 // XOR R0 R1
00_0110_01 // GETTIME R1
10_01_01_00 // ADD R0 R1
00_0000_00 // SETRGB R0
01_00_00_00 // NOP
01_00_00_00 // NOP
6 changes: 3 additions & 3 deletions sw/binary/test2.bit
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
00_0110_10 // GETTIME R2
00_0100_00 // GETX R0
10_01_10_00 // ADD R0 R2
00_1111_01 // SINE R1
00_0001_01 // SETR R1
00_0101_00 // GETY R0
10_01_10_00 // ADD R0 R2
00_1111_01 // SINE R1
00_0010_01 // SETG R1
01_00_00_00 // NOP
01_00_00_00 // NOP
01_00_00_00 // NOP
01_00_00_00 // NOP
2 changes: 1 addition & 1 deletion sw/binary/test7.bit
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
00_1110_11 // CLEAR R3
00_0100_00 // GETX R0
00_0111_01 // GETUSER R1
00_0110_01 // GETTIME R1
10_01_01_00 // ADD R0 R1
00_0000_00 // SETRGB R0
00_1111_00 // SINE R0
Expand Down
12 changes: 6 additions & 6 deletions sw/binary/test8.bit
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
00_0100_00 // GETX R0
00_0110_01 // GETTIME R1
10_01_01_00 // ADD R0 R1
00_1111_10 // SINE R2
00_1110_11 // CLEAR R3
00_0101_00 // GETY R0
00_0110_01 // GETTIME R1
10_01_01_00 // ADD R0 R1
00_0000_00 // SETRGB R0
00_1111_00 // SINE R0
10_01_10_00 // ADD R0 R2
00_0000_00 // SETRGB R0
00_1101_00 // HALF R0
00_0100_01 // GETX R1
00_1010_01 // IFGE R1
00_0000_11 // SETRGB R3
Binary file modified sw/images/test1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sw/images/test10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sw/images/test11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sw/images/test12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sw/images/test7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sw/images/test8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion sw/shader/test1.shader
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ SETRGB R0
GETX R1
GETY R2

LDI 0x10
#LDI 0x10
GETTIME R0

IFEQ R1
SETRGB R1
Expand Down
19 changes: 19 additions & 0 deletions sw/shader/test10.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Colored Circles (moving)

# Sine value of X+Time in R2
GETX R0
GETTIME R1
ADD R0 R1
SINE R2

# Sine value of Y+Time in R0
GETY R0
GETTIME R1
ADD R0 R1
SINE R0

# Add the colors up
ADD R0 R2

# Output
SETRGB R0
13 changes: 13 additions & 0 deletions sw/shader/test11.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This is a special shader that
# only works on real hardware

# Each pixel (line) shifts R0 one to the left,
# if R0 is zero it is set to TIME
# R0 is then written into RGB

DOUBLE R0
SETRGB R0

CLEAR R3
IFEQ R3
GETTIME R0
17 changes: 17 additions & 0 deletions sw/shader/test12.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Psychedelic dream

# XOR the sine values of X and Y
# and add the current time

GETX R0
SINE R1

GETY R0
SINE R0

XOR R0 R1

GETTIME R1
ADD R0 R1

SETRGB R0
7 changes: 6 additions & 1 deletion sw/shader/test2.shader
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Use sine to set the colors for r and g
# Use sine values of X and Y to set the colors for R and G
# Add the time for an animation

GETTIME R2

GETX R0
ADD R0 R2
SINE R1
SETR R1

GETY R0
ADD R0 R2
SINE R1
SETG R1
2 changes: 2 additions & 0 deletions sw/shader/test3.shader
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Set red color channel to X coord
GETX R0
SETR R0

# Set green color channel to Y coord
GETY R1
SETG R1
1 change: 1 addition & 0 deletions sw/shader/test4.shader
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Xor both coordinates and write to rgb
# Add the time for an animation

GETX R0
GETY R1
Expand Down
17 changes: 7 additions & 10 deletions sw/shader/test7.shader
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
# Sine
# Draw a rectified sine wave

# Clear R3
CLEAR R3

# Get sine value depending on x
# Get X coord (and add time)
GETX R0
GETUSER R1
GETTIME R1
ADD R0 R1

# Set color to x
# Set color to X
SETRGB R0

# Get sine value and half it
# Get sine value for X and halve it
SINE R0
HALF R0

# Get y
# If sine value is greater than Y
# clear color to black
GETY R1

# If sine value is greater than y
# set color to black
IFGE R1
SETRGB R3
26 changes: 14 additions & 12 deletions sw/shader/test8.shader
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# Colored Circles
# Draw a rectified sine wave

# Sine value of X+Time in R2
GETX R0
GETTIME R1
ADD R0 R1
SINE R2
CLEAR R3

# Sine value of Y+Time in R0
# Get Y coord (and add time)
GETY R0
GETTIME R1
ADD R0 R1
SINE R0

# Add the colors up
ADD R0 R2

# Output
# Set color to Y
SETRGB R0

# Get sine value for Y and halve it
SINE R0
HALF R0

# If sine value is greater than X
# clear color to black
GETX R1
IFGE R1
SETRGB R3
2 changes: 1 addition & 1 deletion sw/shader/test9.shader
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sine
# Colored Circles (morphing)

# Sine value of X in R2
GETX R0
Expand Down

0 comments on commit f30b9da

Please sign in to comment.