forked from MightyPork/crsn
parent
b5016c6b12
commit
40d4b272e4
@ -0,0 +1,87 @@ |
||||
( |
||||
(def W 128) |
||||
(def H 48) |
||||
(def MAXITER 50) |
||||
|
||||
(sym asciigr r10) |
||||
|
||||
(mkbf asciigr ( |
||||
'.' ',' ':' '+' '=' '%' '@' '#' |
||||
'$' '&' '*' '|' '-' ':' '.' ' ' |
||||
)) |
||||
|
||||
(sym x r7) |
||||
(sym y r8) |
||||
(:row) |
||||
(:col) |
||||
(call pixel x y) |
||||
(sub r0 MAXITER 1) |
||||
(rcmp res0 1 r0 |
||||
(eq? |
||||
(mod r0 res0 16) |
||||
(bfrd @cout @asciigr r0) |
||||
) |
||||
(else? |
||||
(ld @cout ' ') |
||||
) |
||||
) |
||||
(sc-wr x y r0) |
||||
(inc x) |
||||
(cmp x W) |
||||
(j.ne :col) |
||||
(ld x 0) |
||||
(inc y) |
||||
(ld @cout '\n') |
||||
(cmp y H) |
||||
(j.ne :row) |
||||
|
||||
(halt) |
||||
|
||||
(proc pixel xi yi |
||||
(sym x0 r7) |
||||
(sym y0 r8) |
||||
(itf x0 xi) |
||||
(itf y0 yi) |
||||
|
||||
; Scale to the interesting range |
||||
(itf r0 W) |
||||
(itf r1 H) |
||||
|
||||
(fdiv x0 r0) |
||||
(fmul x0 3.5) |
||||
(fsub x0 2.5) |
||||
|
||||
(fdiv y0 r1) |
||||
(fmul y0 2.4) |
||||
(fsub y0 1.2) |
||||
|
||||
(sym x r5) |
||||
(sym y r6) |
||||
(ld x 0.0) |
||||
(ld y 0.0) |
||||
(sym iter r4) |
||||
|
||||
(:iter) |
||||
(cmp iter MAXITER) |
||||
(j.eq :end) |
||||
(fmul r0 x x) |
||||
(fmul r1 y y) |
||||
(fadd r2 r1) |
||||
(fcmp r2 4.0) |
||||
(j.gt :end) |
||||
|
||||
(fsub r2 r0 r1) |
||||
(fadd r2 x0) |
||||
|
||||
(fmul r0 x y) |
||||
(fmul r0 2.0) |
||||
(fadd r0 y0) |
||||
(ld y r0) |
||||
(ld x r2) |
||||
(inc iter) |
||||
(j :iter) |
||||
|
||||
(:end) |
||||
(ret iter) |
||||
) |
||||
) |
@ -0,0 +1,92 @@ |
||||
( |
||||
(sc-init 800 600) |
||||
(sc-opt SCREEN_AUTOBLIT 0) |
||||
(def W 800) |
||||
(def H 600) |
||||
(def MAXITER 50) |
||||
|
||||
(sym gradient r9) |
||||
(sym asciigr r10) |
||||
|
||||
(mkbf gradient ( |
||||
0x421e0f 0x19071a 0x09012f 0x040449 0x000764 0x0c2c8a 0x1852b1 0x397dd1 |
||||
0x86b5e5 0xd3ecf8 0xf1e9bf 0xf8c95f 0xffaa00 0xcc8000 0x995700 0x6a3403)) |
||||
|
||||
(sym x r7) |
||||
(sym y r8) |
||||
(:row) |
||||
(:col) |
||||
(call pixel x y) |
||||
(sub r0 MAXITER 1) |
||||
(rcmp res0 1 r0 |
||||
(eq? |
||||
(mod r0 res0 16) |
||||
(bfrd r0 @gradient r0) |
||||
) |
||||
(else? (ld r0 0)) |
||||
) |
||||
(sc-wr x y r0) |
||||
(inc x) |
||||
(cmp x W) |
||||
(j.ne :col) |
||||
(ld x 0) |
||||
(inc y) |
||||
(sc-blit) ; Render after every row |
||||
(cmp y H) |
||||
(j.ne :row) |
||||
|
||||
;(sc-blit) |
||||
|
||||
(:slp) |
||||
(sc-poll) |
||||
(mslp 10) |
||||
(j :slp) |
||||
|
||||
(proc pixel xi yi |
||||
(sym x0 r7) |
||||
(sym y0 r8) |
||||
(itf x0 xi) |
||||
(itf y0 yi) |
||||
|
||||
; Scale to the interesting range x -2.5..1 and y -1..1 |
||||
(itf r0 W) |
||||
(itf r1 H) |
||||
|
||||
(fdiv x0 r0) |
||||
(fmul x0 3.5) |
||||
(fsub x0 2.5) |
||||
|
||||
(fdiv y0 r1) |
||||
(fmul y0 2.4) |
||||
(fsub y0 1.2) |
||||
|
||||
(sym x r5) |
||||
(sym y r6) |
||||
(ld x 0.0) |
||||
(ld y 0.0) |
||||
(sym iter r4) |
||||
|
||||
(:iter) |
||||
(cmp iter MAXITER) |
||||
(j.eq :end) |
||||
(fmul r0 x x) |
||||
(fmul r1 y y) |
||||
(fadd r2 r1) |
||||
(fcmp r2 4.0) |
||||
(j.gt :end) |
||||
|
||||
(fsub r2 r0 r1) |
||||
(fadd r2 x0) |
||||
|
||||
(fmul r0 x y) |
||||
(fmul r0 2.0) |
||||
(fadd r0 y0) |
||||
(ld y r0) |
||||
(ld x r2) |
||||
(inc iter) |
||||
(j :iter) |
||||
|
||||
(:end) |
||||
(ret iter) |
||||
) |
||||
) |
@ -0,0 +1,93 @@ |
||||
( |
||||
(sc-init 1024 768) |
||||
(sc-opt SCREEN_AUTOBLIT 0) |
||||
(sc-opt SCREEN_UPSCALE 8) |
||||
(def W 128) |
||||
(def H 96) |
||||
(def MAXITER 50) |
||||
|
||||
(sym gradient r9) |
||||
(sym asciigr r10) |
||||
|
||||
(mkbf gradient ( |
||||
0x421e0f 0x19071a 0x09012f 0x040449 0x000764 0x0c2c8a 0x1852b1 0x397dd1 |
||||
0x86b5e5 0xd3ecf8 0xf1e9bf 0xf8c95f 0xffaa00 0xcc8000 0x995700 0x6a3403)) |
||||
|
||||
(sym x r7) |
||||
(sym y r8) |
||||
(:row) |
||||
(:col) |
||||
(call pixel x y) |
||||
(sub r0 MAXITER 1) |
||||
(rcmp res0 1 r0 |
||||
(eq? |
||||
(mod r0 res0 16) |
||||
(bfrd r0 @gradient r0) |
||||
) |
||||
(else? (ld r0 0)) |
||||
) |
||||
(sc-wr x y r0) |
||||
(inc x) |
||||
(cmp x W) |
||||
(j.ne :col) |
||||
(ld x 0) |
||||
(inc y) |
||||
(sc-blit) ; Render after every row |
||||
(cmp y H) |
||||
(j.ne :row) |
||||
|
||||
;(sc-blit) |
||||
|
||||
(:slp) |
||||
(sc-poll) |
||||
(mslp 10) |
||||
(j :slp) |
||||
|
||||
(proc pixel xi yi |
||||
(sym x0 r7) |
||||
(sym y0 r8) |
||||
(itf x0 xi) |
||||
(itf y0 yi) |
||||
|
||||
; Scale to the interesting range x -2.5..1 and y -1..1 |
||||
(itf r0 W) |
||||
(itf r1 H) |
||||
|
||||
(fdiv x0 r0) |
||||
(fmul x0 3.5) |
||||
(fsub x0 2.5) |
||||
|
||||
(fdiv y0 r1) |
||||
(fmul y0 2.4) |
||||
(fsub y0 1.2) |
||||
|
||||
(sym x r5) |
||||
(sym y r6) |
||||
(ld x 0.0) |
||||
(ld y 0.0) |
||||
(sym iter r4) |
||||
|
||||
(:iter) |
||||
(cmp iter MAXITER) |
||||
(j.eq :end) |
||||
(fmul r0 x x) |
||||
(fmul r1 y y) |
||||
(fadd r2 r1) |
||||
(fcmp r2 4.0) |
||||
(j.gt :end) |
||||
|
||||
(fsub r2 r0 r1) |
||||
(fadd r2 x0) |
||||
|
||||
(fmul r0 x y) |
||||
(fmul r0 2.0) |
||||
(fadd r0 y0) |
||||
(ld y r0) |
||||
(ld x r2) |
||||
(inc iter) |
||||
(j :iter) |
||||
|
||||
(:end) |
||||
(ret iter) |
||||
) |
||||
) |
@ -0,0 +1,48 @@ |
||||
::::::::::::::::::::::::::::::::::::::::+++++++++++++++++++++++++++++++++==============+++++++++++++++++++=::::::::::::::::::::: |
||||
:::::::::::::::::::::::::::::::::::::::+++++++++++++++++++++++++++++++++========%%%%%=@%%%%%++++++++========:::::::::::::::::::: |
||||
::::::::::::::::::::::::::::::::::::::+++++++++++++++++++++++++++++++++=========%%@#.&$#%%%%%%%%=============::::::::::::::::::: |
||||
:::::::::::::::::::::::::::::::::::::===+++++++++++++++++++++++++++++==========%%%%##.-##@@@%%%===============:::::::::::::::::: |
||||
::::::::::::::::::::::::::::::::::::=======+++++++++++++++++++++++++==========%%%%##$&::& ||#@%%===============::::::::::::::::: |
||||
:::::::::::::::::::::::::::::::::::===========+++++++++++++++++++%%%=========@@@@@##$**:.|&$@@@@================:::::::::::::::: |
||||
::::::::::::::::::::::::::::::::::=================++++++++++%%%%%%%%%%%%%@@@@@@@$$&*& ::=&$##@@@%================:::::::::::::: |
||||
::::::::::::::::::::::::::::::::=========================%%%%%%%%%%%%%%%%%@@@@##$:#$.#& :-:$$@@@%%%%%%%%%=========::::::::::::: |
||||
:::::::::::::::::::::::::::::::==========================%%%%%%%%%%%%%%%%@@@@@##$*:= :&###%%%%%%%%%%=========+::::::::::: |
||||
:::::::::::::::::::::::::::::============================%%%%%%%%%@%%%%####@$$$&&|. *.&$####@%@@@@%%=========++:::::::::: |
||||
:::::::::::::::::::::::::::==============================%%%%%%%%@@##$$$:*$$&&**|-:$ -**&&$##@@@#|#%========+++++:::::::: |
||||
:::::::::::::::::::::::::+==============================%%%%%%%%%@@@&|:&,:|*|# , | *..#.*$&$&&: #@@=====++++++++:::::: |
||||
:::::::::::::::::::::::+++============================@@%%%%%%%%@@@$&|:@ =, * + --,%% :,#%%%%%=++++++++++:::: |
||||
:::::::::::::::::::::++++++==============%%%========@@@@@@@%%%#####$$*. @-*#%%%%%%++++++++++++:: |
||||
:::::::::::::::::::++++++++=============%%%%%%%%%@@@@@@@@@@@@###$$&* - : :,*$@@@%%%%++++++++++++++ |
||||
::::::::::::::::++++++++++==============%%%@####@@@@@#@@@@@@####$*=: -&###@%%%%++++++++++++++ |
||||
::::::::::::::++++++++++++=============%%%%@$||&#$$##$$##$$$$##&&&- %-*&:@%%%%++++++++++++++ |
||||
:::::::::::++++++++++++++=============%%%%##&.:**&&$&::**&&$$$&&*% =,#%%%==+++++++++++++ |
||||
::::::::++++++++++++++++%%%%========@@@@@@##&&|. ,.::.+ .,.****|-&* *#@@@====++++++++++++ |
||||
::::::+++++++++++++++++%%%%%%%%%%%@@@@@@@@$$$*|.& @ =::-:. |$@@======+++++++++++ |
||||
:::++++++++++++++++++%%%%%%%%%%%%%@@@@####$$*--.$ , , %-#@@========+++++++++ |
||||
:++++++++++++++++++==%%%%%%%%%%%%@@@@@#*-&**--= %# :$#%%%=========+++++++ |
||||
+++++++++++++++++====%%%%%@@@@#####$$$$&|:. .- , $$@@%%%%==========+++++ |
||||
++++++++++++++======@@@##@$*$$##$#&$$-*|.+ : #$#@@@%%%%%==========+++ |
||||
+++++++++++++====%@ - |*$$#@@@%%%%%=========+++ |
||||
++++++++++++++======@@@##@$*$$##$#&$$-*|.+ : #$#@@@%%%%%==========+++ |
||||
+++++++++++++++++====%%%%%@@@@#####$$$$&|:. .- , $$@@%%%%==========+++++ |
||||
:++++++++++++++++++==%%%%%%%%%%%%@@@@@#*-&**--= %# :$#%%%=========+++++++ |
||||
:::++++++++++++++++++%%%%%%%%%%%%%@@@@####$$*--.$ , , %-#@@========+++++++++ |
||||
::::::+++++++++++++++++%%%%%%%%%%%@@@@@@@@$$$*|.& @ =::-:. |$@@======+++++++++++ |
||||
::::::::++++++++++++++++%%%%========@@@@@@##&&|. ,.::.+ .,.****|-&* *#@@@====++++++++++++ |
||||
:::::::::::++++++++++++++=============%%%%##&.:**&&$&::**&&$$$&&*% =,#%%%==+++++++++++++ |
||||
::::::::::::::++++++++++++=============%%%%@$||&#$$##$$##$$$$##&&&- %-*&:@%%%%++++++++++++++ |
||||
::::::::::::::::++++++++++==============%%%@####@@@@@#@@@@@@####$*=: -&###@%%%%++++++++++++++ |
||||
:::::::::::::::::::++++++++=============%%%%%%%%%@@@@@@@@@@@@###$$&* - : :,*$@@@%%%%++++++++++++++ |
||||
:::::::::::::::::::::++++++==============%%%========@@@@@@@%%%#####$$*. @-*#%%%%%%++++++++++++:: |
||||
:::::::::::::::::::::::+++============================@@%%%%%%%%@@@$&|:@ =, * + --,%% :,#%%%%%=++++++++++:::: |
||||
:::::::::::::::::::::::::+==============================%%%%%%%%%@@@&|:&,:|*|# , | *..#.*$&$&&: #@@=====++++++++:::::: |
||||
:::::::::::::::::::::::::::==============================%%%%%%%%@@##$$$:*$$&&**|-:$ -**&&$##@@@#|#%========+++++:::::::: |
||||
:::::::::::::::::::::::::::::============================%%%%%%%%%@%%%%####@$$$&&|. *.&$####@%@@@@%%=========++:::::::::: |
||||
:::::::::::::::::::::::::::::::==========================%%%%%%%%%%%%%%%%@@@@@##$*:= :&###%%%%%%%%%%=========+::::::::::: |
||||
::::::::::::::::::::::::::::::::=========================%%%%%%%%%%%%%%%%%@@@@##$:#$.#& :-:$$@@@%%%%%%%%%=========::::::::::::: |
||||
::::::::::::::::::::::::::::::::::=================++++++++++%%%%%%%%%%%%%@@@@@@@$$&*& ::=&$##@@@%================:::::::::::::: |
||||
:::::::::::::::::::::::::::::::::::===========+++++++++++++++++++%%%=========@@@@@##$**:.|&$@@@@================:::::::::::::::: |
||||
::::::::::::::::::::::::::::::::::::=======+++++++++++++++++++++++++==========%%%%##$&::& ||#@%%===============::::::::::::::::: |
||||
:::::::::::::::::::::::::::::::::::::===+++++++++++++++++++++++++++++==========%%%%##.-##@@@%%%===============:::::::::::::::::: |
||||
::::::::::::::::::::::::::::::::::::::+++++++++++++++++++++++++++++++++=========%%@#.&$#%%%%%%%%=============::::::::::::::::::: |
||||
:::::::::::::::::::::::::::::::::::::::+++++++++++++++++++++++++++++++++========%%%%%=@%%%%%++++++++========:::::::::::::::::::: |
After Width: | Height: | Size: 104 KiB |
Loading…
Reference in new issue