Open twillis-prog opened 6 months ago
The issue is that you are using CREATE rather than \
Another little note that does not affect this code because you are using the COMPAT module is that one difference between zeptoforth and both gforth and Mecrisp-Stellaris is that ALIGN ( addr|offset power-of-two -- addr'|offset' ) is meant to align an address or offset to a specified power of two, and to get the same behavior in zeptoforth you use CELL ALIGN, ─ however the traditional ANS ALIGN is provided by the COMPAT module which you are using.
Travis
Note, GitHub ate my references to \
The issue is that you are using CREATE rather than \
Another little note that does not affect this code because you are using the COMPAT module is that one difference between zeptoforth and both gforth and Mecrisp-Stellaris is that ALIGN ( addr|offset power-of-two -- addr'|offset' ) is meant to align an address or offset to a specified power of two, and to get the same behavior in zeptoforth you use CELL ALIGN, ─ however the traditional ANS ALIGN is provided by the COMPAT module which you are using.
Travis
Thank you for clarifying. I have not been able to determine the Dictionary structure with the goal of being able to print the name of a defined constant. The work-around is to build an array of tick addresses. Used Excel to import the rp2040 datasheet table on pages 236/237. Cleaned up imported table and copied into text editor to format to forth.
\ address of word name determined empirically: : name! >name 8 + , ;
\ array of GPIO functions here create func ' F1 name! ' F2 name! ....
\ array of dictionary pointers here create func-name ' CLOCK_GPIN0 name! ' CLOCK_GPIN1 name! ' CLOCK_GPOUT0 name! ....
\ Function Table Cross Reference here create func-xref ( PIN F1 F2 F3 F4 F5 F6 F7 F8 F9 ) ( 0 $00 ) SPI0_RX c, UART0_TX c, I2C0_SDA c, PWM0_A c, SIO c, PIO0 c, PIO1 c, NA c, USB_OVCUR_DET c, ...
\ type function name indexed by i : .func ( tbl i -- ) CELLS swap + @ count type ;
: .xref ( func pin -- ) 9 * 1- + func-xref + c@ func-name swap .func ;
\ Example: F3 Pin0 .xref I2C0_SDA ok
Competing a set of GPIO tools from 0033mer youtube video, which got me into forth. This was a good exercise.
Thanks for an amazing Forth!
Terry Willis
From: tabemann @.> Sent: Thursday, May 9, 2024 8:16 PM To: tabemann/zeptoforth @.> Cc: twillis-prog @.>; Author @.> Subject: Re: [tabemann/zeptoforth] No word being built (Issue #99)
Note, GitHub ate my references to
The issue is that you are using CREATE rather than
Another little note that does not affect this code because you are using the COMPAT module is that one difference between zeptoforth and both gforth and Mecrisp-Stellaris is that ALIGN ( addr|offset power-of-two -- addr'|offset' ) is meant to align an address or offset to a specified power of two, and to get the same behavior in zeptoforth you use CELL ALIGN, ─ however the traditional ANS ALIGN is provided by the COMPAT module which you are using.
Travis
— Reply to this email directly, view it on GitHubhttps://github.com/tabemann/zeptoforth/issues/99#issuecomment-2103782544, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BFQHVFOSQ7WSGDNUJUZTJN3ZBQ3XLAVCNFSM6AAAAABHLZ6EH6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBTG44DENJUGQ. You are receiving this because you authored the thread.Message ID: @.***>
The matter is that there is no way to programmatically print the name of a constant value because any number of constant
s may share a value. So if you want to print 1 as F1
you might get some completely unrelated constant foobar
which just happens to share the value of 1 printed instead.
Travis
Creating a constant string array. Works in Mecrisp and Gforth. On Zepoforth zeptoforth-1.5.4.3 - zeptoforth_kernel-1.5.4.3.uf2 Not clear what the issue. is.
compat import ok \ S" ( "ccc