I have been searching and reading and going through Peter's drop box files until I'm bleary eyed but let me back up and start with what I'm trying to accomplish.
I know a bit about Forth, I can write simple programs and such and using DurexForth for the C64 have used the built in compiler to make my own words in 6502 assembly where needed. I recently got a Prop1 and went through the SimpleIDE tutorials, I know C fairly well so this was not a big deal and I learned a bit about the Prop in the process. Then I found out about Tachyon and it was no hard (but not simple) to find out what the latest version was and find the binary and load that onto my Quickstart board. So far so good.
So now I am wondering what would I like to do with Forth on this board? Well, using the Touch Buttons seemed like a logical place to start. I found the touch button demo code and worked my way through what the assembly code is doing (the Prop assembly is not too hard to follow I think). Then I went to looking at all the ways ports, pins and DDRs are controlled in Tachyon V5.4. I found the glossary of words which is out of date but still somewhat helpful, then I found the source for V3.or so and then I finally found the V5 dropbox folder. OK, so now I can find the relevant words.
For the touch buttons the basic idea is that you have those pins DDR set as inputs but have the outputs registers set to high. Then you set the DDR to make them outputs and then immediately set them as inputs again, pause and then read the inputs. So, after finding out what words like MASK, OUTPUTS, INPUTS, and OUTSET so I was able to set the output registers to high, and then set the DDR to make them inputs put of course trying to toggle the DDR input to output to input quickly enough is not feasible in Forth directly.
So, on to my attempt to figure out how to include the touch buttons 'driver'. After realizing that this involves saving the PASM code as a 'ROM' I set out trying to figure out how to do that. Well, after much searching, of the forum and reading about 50% of the Tachyon V5 thread, I found the readme.txt in the ROMS folder of the dropbox. OK, so this provides the method and Python code to convert a .spin file into PASM. So, I think I am close, finally.
So, I have the original touch button driver code modified with the ROM header thusly:
BUTTON_PINS = $FF ' The QuickStart's touch buttons are on the eight LSBs
SAMPLES = 32 ' Require 32 high redings to return true
Results := Rate
cognew(@Entry, @Results) ' Launch a new cog to read samples
PUB State | Accumulator
Accumulator := Results ' Sample multiple times and return true
repeat constant(SAMPLES - 1) ' if every sample was highw
Accumulator &= Results
byte ".ROM" ' ROM signature
word @TOUCHBTNEnd-@TOUCHBTN ' size
byte "TOUCHBTN " ' name
rdlong WaitTime, par
mov outa, #BUTTON_PINS ' set TestPins high, but keep as inputs
mov Wait, cnt ' preset the counter
add Wait, WaitTime
or dira, #BUTTON_PINS ' set TestPins as outputs (high)
andn dira, #BUTTON_PINS ' set TestPins as inputs (floating)
mov Reading, #BUTTON_PINS ' create a mask of applicable pins
waitcnt Wait, WaitTime ' wait for the voltage to decay
andn Reading, ina ' clear decayed pins from the mask
wrlong Reading, par ' write the result to RAM
Reading res 1
WaitTime res 1
Wait res 1
So, assuming this is correct I build in with PropellerIDE and get a binary file and get an error. I finally figure out that the UARTEND and UART in the readme are referring to labels in the text! So, I look at UART.spin code form the V5 dropbox and see where the labels are supposed to be. This part is simple now that I understand it but as a noob I did not understand what the @lable
was doing. So, now I am able to build the TOUCHBTN.binary!!!