Spin2CPP, FlexSpin, FlexCC, FlexProp (PASM, Spin, BASIC, C)
Verfasst: Do 25. Feb 2016, 17:53
----------8<-----{20160225-1753-CET}----->8----------
Eigentlich wollte ich ja den spin2pasm-Branch von spin2cpp ausprobieren, aber irgendwie ist das noch zu heiß...
Status Quo: Ich hab den spin2pasm-Branch kompilieren können... aber Spinkram von interessanter Größe habe ich damit noch nicht nach PASM übersetzt bekommen, es fehlert mich an...
Stattdessen hab ich mal mit nur den Spin->C++-Features davon gespielt...
The source this is, Luke: ...das ist das Integerarrithmetik-Mandelbrötchen, in dem noch irgendwie ein kleiner Denkfehler im Mitzählen oder der Abbruchbedingung steckt... das Innere der Menge wird schon hinreichend korrekt bestimmt, aber bei den Farben drumrum verdaddelt's sich noch irgendwie...
....aber für den spin2cpp-Test kann es trotzdem gut herhalten...
...und es war einmal ein Makefile:
Tun oder nicht tun es du mußt...
Na? Wie ist das?
Von Spin zu Binary ohne "offiziellen" Spin-Compiler...
Nebenbei zeigt's beim Lauf via spinsim mit "-b" Option auch noch wie spinsim die serielle Ausgabe auf Pin 30/31 "versteht" und ins Terminal leitet...
Ist doch hübsch, oder?
...und eiiines Taaages wird auch die Spin->PASM-Übersetung mich nimmer anzicken...
Eigentlich wollte ich ja den spin2pasm-Branch von spin2cpp ausprobieren, aber irgendwie ist das noch zu heiß...
Status Quo: Ich hab den spin2pasm-Branch kompilieren können... aber Spinkram von interessanter Größe habe ich damit noch nicht nach PASM übersetzt bekommen, es fehlert mich an...
Stattdessen hab ich mal mit nur den Spin->C++-Features davon gespielt...
The source this is, Luke:
Code: Alles auswählen
' mandelbrot-20150214-fds
'
con
_clkmode = xtal1+pll16x
_clkfreq = 80_000_000
xmin=-563714457 ' -2.1
xmax=187904819 ' 0.7
ymin=-322122547 ' -1.2
ymax=322122547 ' 1.2
maxiter=24
MPX=79 ' 0..79
MPY=24 ' 0..24
c4=1073741824
obj
ser : "FullDuplexSerial"
pub main | c,cx,cy,dx,dy,x,y,xn,yn,rsq,iter,px,py
ser.start(31, 30, 0, 115200)
dx:=(xmax-xmin)/MPX
dy:=(ymax-ymin)/MPY
cy:=ymin
repeat py from 0 to MPY
cx:=xmin
repeat px from 0 to MPX
x:=0
y:=0
rsq:=0
iter:=0
repeat while iter=<maxiter and rsq=<c4
xn:=((x**x-y**y)<<4)+cx
yn:=((x**y)<<5)+cy
x:=xn
y:=yn
rsq:=(x**x+y**y)<<4
iter+=1
cx+=dx
ser.tx(iter+32)
cy+=dy
ser.tx(13)
waitcnt(_clkfreq+cnt)
ser.stop
cogstop(0)
....aber für den spin2cpp-Test kann es trotzdem gut herhalten...
...und es war einmal ein Makefile:
Code: Alles auswählen
SPINSIM = /opt/parallax/bin/spinsim
SPIN2CPP = /opt/spin2cpp/bin/spin2cpp
SPINSTDLIB = /opt/parallax.spin.src/spin
main.binary: main.spin Makefile
PATH="/opt/parallax/bin:$PATH" $(SPIN2CPP) -L ../lib -L $(SPINSTDLIB) --binary main.spin
run: main.binary Makefile
$(SPINSIM) main.binary -b
clean: Makefile
rm -f main.binary *~
Code: Alles auswählen
$ ls -l
insgesamt 8
-rw-r--r-- 1 yeti yeti 842 Feb 25 17:27 main.spin
-rw-r--r-- 1 yeti yeti 385 Feb 25 17:45 Makefile
$ make
PATH="/opt/parallax/bin:ATH" /opt/spin2cpp/bin/spin2cpp -L /opt/parallax.spin.src/spin --binary main.spin
$ ls -l
insgesamt 40
-rw-r--r-- 1 yeti yeti 11405 Feb 25 17:46 FullDuplexSerial.cpp
-rw-r--r-- 1 yeti yeti 935 Feb 25 17:46 FullDuplexSerial.h
-rwxr-xr-x 1 yeti yeti 6388 Feb 25 17:46 main.binary
-rw-r--r-- 1 yeti yeti 1551 Feb 25 17:46 main.cpp
-rw-r--r-- 1 yeti yeti 778 Feb 25 17:46 main.h
-rw-r--r-- 1 yeti yeti 842 Feb 25 17:27 main.spin
-rw-r--r-- 1 yeti yeti 385 Feb 25 17:45 Makefile
$ make run
/opt/parallax/bin/spinsim main.binary -b
!!!!!!!!!!!!!!!"""""""""""""(&###$('$)*'&%)*####################"""""""""""""""+
!!!!!!!!!!!!!"""""""""$,%)##'1%$%$%%')#######$0'%+$$%'0(%&-$$1%$####$"""""""""""
!!!!!!!!!!!"""""""%$)###$&&)+%%'%)#######$)%%&&$$'&%4&(+,)+3'$$$&%'&####)$""""""
!!!!!!!!!"""""()&##$$$,'$,$$'&#######5%&(/)$$$$)+%%&'1*99/**)(%+$$$%%(####'%$"""
!!!!!!!!""""(##$%-+%%%%%%$#######)+)('%$$$$&%%))&)'/,9999999+'&%%%&($$$/####$$('
!!!!!!!"""#%-+($%$(2$%########&')$$$$$'&%&'-,+)-(+)*/999999..)+('&&&&/&&$&###$&&
!!!!!!""-)&%&&%%$##########$$$$$%.1'%%&+&'+.99908999999999999999/+.9739)%*$####'
!!!!!"$&+$/$##########$$$/)+*'&%%%%,4&&'+-+799999999999999999999999997(&++$$####
!!!!"6+%#######')$$$)%&(,,**-+''(-*('((/259999999999999999999999999994,)4-&$%###
!!!!+###9'(&(($$&)(*%*0*20922+89-7,)),*99999999999999999999999999999999+''*$&'##
!!!!#,%'&&)$$$*(%%%%+''++.7999999999902999999999999999999999999999999999'%0$,'-#
!!!#'$$$$$$%'**&**)).24.69999999999999999999999999999999999999999999999'(%)$$%&#
!!!69999999999999999999999999999999999999999999999999999999999999992++'&(%*$$(%#
!!!#'$$$$$$%'**&**)).24.69999999999999999999999999999999999999999999999'(%)$$%&#
!!!!#,%'&&)$$$,(%%%%1''++.7999999999902999999999999999999999999999999998'%-$+')#
!!!!9###+'(&(($$&)(+%*/*30926+69-7,)),*99999999999999999999999999999998+''-$&'##
!!!!"+*%#######')$$$)%&(,1**-+''(4*('((0259999999999999999999999999994,)47&$%###
!!!!!"$&*$+$##########$$$/)0)'&%%%%+*&&'+-+799999999999999999999999999(&/5$$####
!!!!!!"",)&%&&%%$##########$$$$$%+,'%%&6&'+.99908999999999999999/+.9939)%*$####'
!!!!!!!"""#%+3($%$()$%########&'*$$$$$'&%&'/,+)0(+)*/999999..)+('&&&&/&&$&###$&&
!!!!!!!!""""(##$%,+%%%%%%$#######)+)('%$$$$&%%))&)'2,9999999+'&%%%&($$$.####$$('
!!!!!!!!!"""""*)&##$$$)'$+$$'&#######6%&(,,$$$$),%%&'-*99/**)(%*$$$%%(####'%$"""
!!!!!!!!!!!"""""""%$,###$&&-.%%'%)#######$)%%&&$$'&%.&(+,)+/'$$$&%'&####*$""""""
!!!!!!!!!!!!!"""""""""$*%)##'*%$%$%%')#######$2'%5$$%'0(%&0$$)%$####$"""""""""""
!!!!!!!!!!!!!!!"""""""""""""(&###$('$+*'&%)0####################""""""""""""""")
$ _
Von Spin zu Binary ohne "offiziellen" Spin-Compiler...
Nebenbei zeigt's beim Lauf via spinsim mit "-b" Option auch noch wie spinsim die serielle Ausgabe auf Pin 30/31 "versteht" und ins Terminal leitet...
Ist doch hübsch, oder?
...und eiiines Taaages wird auch die Spin->PASM-Übersetung mich nimmer anzicken...