diff --git a/sbus-to-ztex/prom.forth b/sbus-to-ztex/prom.forth index 27152c3..40d0871 100644 --- a/sbus-to-ztex/prom.forth +++ b/sbus-to-ztex/prom.forth @@ -1,16 +1,33 @@ -\ version1 fcode-revision -fcode-version1 - -\ beware the space with the quotes, Forth is strict -\ minimal required stuff -\ " RDOL,SBusFPGA" encode-string " name" property -\ my-address h# 200 + my-space encode-phys -\ h# 100 encode-int encode+ -\ " reg" property +fcode-version2 +\ Absolute minimal stuff; name & registers def. " RDOL,SBusFPGA" name my-address h# 200 + my-space h# 100 reg +\ we don't support ET +h# 7f xdrint " slave-burst-sizes" attribute +headers + +-1 instance value led-virt +my-address constant my-sbus-address +my-space constant my-sbus-space + +: map-in ( adr space size -- virt ) " map-in" $call-parent ; +: map-out ( virt size -- ) " map-out" $call-parent ; + +: map-in-led ( -- ) my-sbus-address h# 200 + my-sbus-space h# 4 map-in is led-virt ; +: map-out-led ( -- ) led-virt h# 4 map-out ; + +external + +: blink! ( pattern -- ) + map-in-led + led-virt l! ( pattern virt -- ) + map-out-led + ; + +\ works at probe time, but not as a user command +h# 12488421 blink! \ \hex