Hi Martin,
I ran your Mandelbrot in Tachyon on the P2 as a quick test but even though it only takes about half a second to run, it doesn't look right
I can zoom in by 100 instead and it does zoom (takes about a second) so that part works correctly. BTW, this code is one of the simple benchmark tests I will run on the 65816/37702 chips when I convert Tachyon.
I haven't really looked into what is going wrong. Any ideas?
Code:
-------------------------------------------------------------------------------
Parallax P2 *TAQOZ* Extensible Firmware V2.0 'CHIP' 125MHz 190212-1700
-------------------------------------------------------------------------------
TAQOZ# 300 P2MHZ --- ok
$0004_0627 Parallax P2 *TAQOZ* Extensible Firmware V2.0 'CHIP' 300MHz 190212-1700
52 ---
53 lines and 274 bytes compiled, with 0 errors in 72ms ok
TAQOZ# GO ---
..!.. .,'.~ ,.!.' .,.!....~~',.!.,.,.,.....^..~...,,...,...,'.
,.~,' ..,!. .:'... .'.'.'.^.',^..,.!.,.,....,.,',..,....^.',,,.'
,.'.. ~,'.. ~.,.', ,.........''',.,...~!.'.'..~...,,.''~.,.'!,..,
.^.,: ^..'. ''~;'. ,,.!., ~,''..'...''.'.'....,'...~!.,,,....'.,,,
,^,.. ,'.., ,,',.. '~.~.. .'''...,'.,'.!,'....,.~.,...''..^.',,..!
.'..' ...,~ '...'. '.,,!, ,......,..~...'^.,'.~,
!... ..!., ..,,., ,.'...
.!. .,... ~.,.,~ ....,^ ~
,. ...^^ .~',.! ..,.,. ~'
, ,...' ,.,~~' ',.~.. ,..
,,,., ...!~. .!,.,~ ..,.~...'..,..,,,.~'',.'.'.'.:...^..,,~.''..
..,.. .,,'.. ,~..., .....~~..,.',',,..,...,~.,,'...';'...~',.,'..
'.... ..,,,, ',~..' ',,.,,..,,........,.''.,,'..,...,,~.!,.,,...'.
,.'~, '.'.,' .,~~.. ,.''., !.,~.,~.'^....~,.,,,.,.'.,.,,...',,.',.!
,.!.. '...'' ,!...! ...... .............'....,.!.,.:.,.~.~.~,,.!^.,
.,.,. ''.,.. '',... .',.,. ,.',.:.,.',~~,.'.,,!..'.,.,.,,,'.
.,~' ...,., ,.,,., .,.'..
'.. ,.,,.. ..!.^. .,.,', .
'. ,'.,,. .:.~,~ .;'.,, '.
. .~,... ...... '~..., ''.
'.~'., ''.~.~ ...''. '..,..',,...!.....~....,....,~~.:,.''.',,...
,,.,'. .',..~ .,..., .'..,,,...,,'.',.';.,!.,'!...~''.!'....,'.,,,
'..,.. ''..,. ,'.,^~ ''[.,....,.'.,~,,.',.~,.~','.'.'~....'',,.,...
.,.... ,,,... ,.,,'. :..:.. .'...',,./'...,...',,.,.'..~~~',',..'.,.
,.~..' .',,'. ^,,'.. :''~'^ ~.,,'...,...!'.~'~...',,...'..!',.,',...
,.,.~, ~^..'! ....., ....., ..,',,,..,''!,.,,,....,.,..^..'..,...,
.,,,, ',,... ,..... ,...~.
.',. ,.,.'. ..'',. ..,.~. ,
~.^ ,.~,,, ,~'... '..... ..
'. .',,~, .~'''. .,.',. ...
....', ,:..., ,,.'.' ,.'',.,,''..,.,,.!,.,^.,..~,^.~,.':,...:..,.
.!.,,. .,~.,. .!'.~, ~..,..'...!...'..,,,.',,....~'....,,.~,!.,,.,
,.~.,' ..^'.. ,,..., ..:',,.,...,...,.,.',.,'.'.:...'..'.',...~~,,.
....![ ',,.,' ...,', ::,..' ..,..'...,,.'..'...,'!.,.....,,'...~'~,.
,^~.., .~.,', ,...,. .,~,!. ,,....~'~..,.....,.'.~.,,..~.~..,',.''.'
,,,~., ..~',, ..,.!~ ,,.... .,.,'.'',.,,.....,.~.,...!.../'[...,!.,.
,.,.. .,,.., '.'.., .,~.!.
'!!, ~.,~., ,:..,! ..,,.. .
^.. ...... ,..,:' ...',. ..
..!,.' .,,!~, '~..~, .,.,'. WWWWWW<:^!~''',,,,,,,...................
.'...^ .!,,.! .,.!,, .,',,, .WWWWWW[^!~''',,,,,,....................
'.,,'. ,...'. ~.~... !...., .WWWWWWW;!~''',,,,,,....................
,,..,; '.~!., .''~.! .,':., .WWWWWWW:!~''',,,,,,....................
'.~,!. ~....! .,,'.' .~',.[ .WWWWWWW~~;''',,,,,,....................
.'...~ .'..,. ,..... ,.~,., ..WWWWW~!;~''',,,,,,....................
..^:.. '...,! .~!'., .,..,. ..,WWW'''~~'',,,,,,,....................
.,.... ,...,, .!,,,' '..... ...,,''!!'~'',,,,,,.....................
,.',,, .;,!,. .,;,., '...!. ...,,,,,'!:!!,,,,,,.....................
',..,. ....,, '...~. .!'',. ,...,,,,,,,!',,,,,,....................
,.,'~' ,...,. ^.,... .,,,.^ ^....~''''~,,,,,,,.....................
,.'!.' '...,! ..~.~. ^..... ',...~,,,,,,~~~,,,.....................
''^,,' ,.,.,. .!',.~ .,.,^~ ,~,...,,!~'~!',,,......................
!.,,.' ^.,.,. ~,.,.' ~...,. ,!,'...~~,,,,,,,,.....................
.,..~. ,...!, .','., '...:. .~~',...,'',,,,,......................
.'..., ,.~... ^...^. .,.^^. ...,,'...,'~,,,.......................
.,..,, ~.'... .,',.. ~.,... ....',,..','',,......................
,.!'.. !...,. .!',.. .'!,.' ,....~'!..!,',.......................
,.,,,' .,'~.~ ,...!. '.~,., ,,,...,',..,'.......................
;.''., .!,,.~ .,,~.. ,...'. ,!,'...,,,..........................
.,..'' !.,,.. .,',.' .!,.~. .,'''...~'~........................
'...,. ,,',.. .....; ....,, ...',,,..'!'.......................
.'.,, '~.'.. .!,.,, ,,,,.. '....~,'...,,.....................
,.'.. .,'.,. .'/.', '..^.~ !,'...,,'...!,...................
.,',. ,..'.. ...'., ,..,.' ,,,~....',...',..................
,.,.. ,...., .,,.^, ,,,,.. ...,',...^,,..',................
.'.,, ,..,.. ,',,!. ,..,., ....'~,^..',,..,'..............
....' .,'.~~ .,'.,, ....,' ~',...,[,...,,..~,............
.,.,' .,,.'. ,..~.. ~...'~ .,'',...,'~..'~..,~..........
!.,.. .'!.'. ....,~ .,~'.. ...&':,..;,,..,'..,^........
,.''. ,..,., ....., ..'.,' ~....,,~...^~..,'..~,......
...'. ..~.,, !~.~., ,^'... ',,,...,,^..~;'..,..!,....
.,,.' ,.'... '!,... ...,,~ ..',!,...~:,..!,..',.,,..
,~,.' .~.,! ~~.,.' ,'.,.. ,....~',...,,..,,..,,.'
.,,., '^.'. ..,.^. ...,,, ,,~'...~,!..,^..,,..!,
,..,. .'.,. ,,.,', ..,.,, ...,''...'',..,'..'!
...,. ..!., ...,,! ...,:, ,....,'!...''..,'.
,..~. ...!, ..,.,. !^.,.. ,~,'...!,,...,'.
.,'.' ...!' ,'.,~ ...,,^ ...~,',...,,.
.,,., ,,'.. !,.'. ~''.': ,~....,,, ok
TAQOZ#
This is my source code:
Code:
TAQOZ
FORGET *MANDELBROT*
: *MANDELBROT* ;
\ Setup constants to remove magic numbers to allow
\ for greater zoom with different scale factors.
20 := #MAXITER
40 := #MAXVAL
-39 := #MINVAL
: SCALE 5 << ;
20 SCALE := #RESCALE
\ These variables hold values during the escape calculation.
long CREAL
long CIMAG
long ZREAL
long ZIMAG
long ESCCNT
\ Compute squares, but rescale to remove extra scaling factor.
: ZSQ @ DUP #RESCALE */ ;
\ Translate escape ESCCNT 1 to MAXITER+1 to ascii greyscale 1=black
\ ..0123456789ABCDEF012345
: .GRAY " .,'~!^:;[/<&?oxOX#MW" + C@ EMIT ;
\ Increment ESCCNT and compare to max iterations.
: COUNT? ESCCNT ++ ESCCNT @ #MAXITER > ;
\ stores the row column values from the stack for the escape calculation.
: INIT_VARS
SCALE DUP CREAL ! ZREAL !
SCALE DUP CIMAG ! ZIMAG !
1 ESCCNT ! ;
\ Performs a single iteration of the escape calculation.
: DOESCAPE
ZREAL ZSQ ZIMAG ZSQ 2DUP +
#RESCALE 4* > IF
2DROP
TRUE
ELSE
- CREAL @ + ( result )
ZREAL @ ZIMAG @ #RESCALE */ 2* ( result val )
CIMAG @ + ZIMAG ! ( result )
ZREAL !
COUNT?
THEN ;
\ Iterates on a single cell to compute its escape factor.
: DOCELL ( row cell -- )
INIT_VARS
BEGIN
DOESCAPE
UNTIL
ESCCNT @ .GRAY
;
\ For each cell in a row.
: DOROW
#MAXVAL #MINVAL DO
DUP I DOCELL
LOOP
DROP ;
\ For each row in the set.
: MANDELBROT
#MAXVAL #MINVAL DO
CRLF I DOROW
LOOP ;
: ZOOM ( n -- ) SCALE ' #RESCALE :=! MANDELBROT ;
\ Run the computation with defaults
: GO 20 ZOOM ;
END