I'm looking at the spin program. I have never written anything in spin before, but it really just looks like C.
If you open the project and click "VT100_Emulator-2.spin" on the left side... you will see the emulator code.
The biggest routine there is:
'' Process next byte from our host port
Which you can see is where the brains are for decoding the escape sequences.
It's a state machine, in State 0, it's just displaying characters and handling the simple control characters.
When an escape sequence starts (ie character 27) the line:
if c ==27
then kicks the state machine to state 1.
I'm not too familiar with C, but I can see that the following operators probably do this....
:= (colon-equal) assign the number
== (equal-equal) compare the expressions
+= (plus-equal) add the value of the right _expression_ to the variable on the left.
|= (bar-equal) logically OR's the value of the right _expression_ to the variable on the left.
So, in BASIC you would write:
a = a + 5
Here you would just write:
a += 5
BASIC: a = 99
SPIN: a := 99
on CR (13) I see the line:
pos := pos - (pos // text#cols)
I guess they could have wrote:
pos -= pos // text#cols
Either way, I conclude that the _expression_ pos//text#cols
would give the remainder of pos (current position) divided by the number of columns.
So this would effectively put the current position to the start of the line.
The reference "text#cols" probably works through a link at the top of the source in the OBJ section.
and if you look at the VGA_1024.spin file, you'll see what I believe is a definition for the cols.
since it's in a section called "CON" I will guess that means "Constant", so cols is a constant set for 80.
Anyway, look back at that state machine.... in state 1, it will process any escape sequence.
If the sequence then has a square bracket, it advances to state 2 where it will fetch the first parameter, then to state 3 to fetch the 2nd parameter and finally state 4 to process that command. I see in State 4, that it calls another routine called ansi. Check that subroutine out! It looks like it covers all the escape sequences I'm familiar with.
Make backups of your files, and try something new!
Date: Sat, 14 Mar 2015 18:54:44 -0700
Subject: [N8VEM-S100:6541] Re: Propeller console IO board
My EPROM programmer is not working so when I needed to get the FW for the console IO I paid Josh for the new version 2.3. However he also included another EPROM with version 2.4. The only difference between the two is that in version 2.4 you can also have a terminal running through the serial IO of the CPU board. Anyway, I don't know if Josh has actually finalized version 2.4. If he is following this thread he may comment.
As far as the ESC codes go I just used BASIC to construct the VT100 terminal codes that I found online. Unfortunately the VT100 emulation that I downloaded and compiled with the consoleIO.spin does not have all of the codes. They could be added if I understood the program well enough.
On Friday, March 13, 2015 at 11:07:38 AM UTC-4, hl...@aol.com wrote:
You received this message because you are subscribed to the Google Groups "N8VEM-S100" group.
To unsubscribe from this group and stop receiving emails from it, send an email to n8vem-s100+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.