Jump to content

Photo

TECO for the Atari


7 replies to this topic

#1 rankeney OFFLINE  

rankeney

    Combat Commando

  • 6 posts

Posted Wed Jan 3, 2018 12:58 PM

I now have TECO ported and running on the Atari. TECO is an implementation of DEC's Text Editor and COrrector for the 6502. All editing functionality should be there (I haven't test this port much). File I/O (reading and writing input and output files) has yet to be ported:. Yeah, I know, it's pretty useless without. I'll be looking at doing that part next. For those not familiar with TECO, not only is it a character-oriented editor, but it is considered Turing complete, meaning you can write programs with it. For example, the code:

 

10U1$10<Q1\$Q1+10U1$I

$>$HT$$

 

will insert the numbers 10 to 100 with increments of 10 into the text buffer, then print the buffer. Note the '$' shown in the command is the ESC key. Two ESCs terminates and executes the command. The code means:

 

  1. 10U1 = Assign the value 10 to Q-register 1 (Q-registers are numeric or text-holding registers).
  2. 10<...> means execute the enclosed text 10 times
  3. Q!\ = Insert the value held in Q-register 1 into the text buffer
  4. Q1+10U1 = Take the value held in Q-register 1, add 10 to it and place the result back in Q-register 1
  5. I<eol> = Insert an end of line
  6. HT = Show the entire text buffer

TECO is pretty cryptic, but very cool. Like Perl, it has pattern-matching capabilities too. Anyway, give it a shot and let me know what you think.

 

You can find a copy of the executable attached.

 

Robert

 

 

Attached Files

  • Attached File  teco.obx   10.89KB   22 downloads


#2 squonk OFFLINE  

squonk

    Space Invader

  • 19 posts

Posted Wed Jan 3, 2018 1:59 PM

Good lord.  I haven't used TECO since high school, when I was learning Pascal on a PDP11/ running RSTS/E and that was the editor we had available.  I used it briefly in college until I was introduced to the TPU editor on our VAXCluster.  FULL SCREEN EDITING!

 

TECO was weirdly powerful in what you could do, but extremely cryptic.  A command might do marvelous things to your code.  Or it might turn it into mash.  Good luck!  Save early, save often.

I might actually need to play with this.

Interesting folklore:
-The 'T' in TECO originally stood for Tape.  Because TECO really is THAT old.
- the EMACS editor was originally written using TECO macros, and the name was derived from 'Editing MACroS'.



#3 dmsc OFFLINE  

dmsc

    Moonsweeper

  • 310 posts
  • Location:Viņa del Mar, Chile

Posted Wed Jan 3, 2018 6:33 PM

Hi!
 

I now have TECO ported and running on the Atari. TECO is an implementation of DEC's Text Editor and COrrector for the 6502. All editing functionality should be there (I haven't test this port much). File I/O (reading and writing input and output files) has yet to be ported:. Yeah, I know, it's pretty useless without. I'll be looking at doing that part next. For those not familiar with TECO, not only is it a character-oriented editor, but it is considered Turing complete, meaning you can write programs with it. For example, the code:
 
10U1$10<Q1\$Q1+10U1$I
$>$HT$$
 
will insert the numbers 10 to 100 with increments of 10 into the text buffer, then print the buffer. Note the '$' shown in the command is the ESC key. Two ESCs terminates and executes the command. The code means:


Great, thanks for the effort!

I tested the editor, found some problems:
- Newlines are not recognized with $9B, only with $10 (this is CONTROL-J, in the Atari it's a triangle). This means that standard text is interpreted as one long line.
- Backspace ($7E) also is not recognized, I think that $08 (CONTROL-H) is used, as when I press it the previous line is printed.
- Typing CONTROL-C just executes an RTS, instead of calling DOS. To properly terminate a program you must end it with "jmp (DOSVEC)".

#4 sanny OFFLINE  

sanny

    Chopper Commander

  • 200 posts
  • Location:Bavaria

Posted Thu Jan 4, 2018 10:37 AM

- Typing CONTROL-C just executes an RTS, instead of calling DOS. To properly terminate a program you must end it with "jmp (DOSVEC)".

 

Why is a RTS not sufficient? Works fine in my programs.



#5 ivop OFFLINE  

ivop

    Dragonstomper

  • 559 posts
  • Location:The Netherlands

Posted Thu Jan 4, 2018 12:39 PM

Here's a nice article I came across: The Glorious Horror Of TECO.

 

Also reminds me a lot of UNIX sed(1), which is only slightly more readable :)



#6 rankeney OFFLINE  

rankeney

    Combat Commando

  • Topic Starter
  • 6 posts

Posted Thu Jan 4, 2018 2:46 PM

@dmsc - Thanks for your comments! I've corrected newline handling and CTRL-C (it was calling a BRK instruction). I also modified the code to echo control characters as ^X (for CTL-X). As to your backspace comment, with Altirra, I receive a $7F for backspace (left arrow on my keyboard). It looks like DELETE returns $FE, so I guess that's the Atari equivalent, maybe prior to masking the parity bit?

It looks like either way, backspace isn't actually deleting the previous character from my input buffer, so I have some work to do. I'll post an update when it's fixed.



#7 dmsc OFFLINE  

dmsc

    Moonsweeper

  • 310 posts
  • Location:Viņa del Mar, Chile

Posted Thu Jan 4, 2018 8:53 PM

Hi!
 

Why is a RTS not sufficient? Works fine in my programs.


You are right, but I tough that "jmp (DOSVEC)" is more compatible with all DOS.

#8 dmsc OFFLINE  

dmsc

    Moonsweeper

  • 310 posts
  • Location:Viņa del Mar, Chile

Posted Thu Jan 4, 2018 9:07 PM

Hi!
 

@dmsc - Thanks for your comments! I've corrected newline handling and CTRL-C (it was calling a BRK instruction). I also modified the code to echo control characters as ^X (for CTL-X). As to your backspace comment, with Altirra, I receive a $7F for backspace (left arrow on my keyboard). It looks like DELETE returns $FE, so I guess that's the Atari equivalent, maybe prior to masking the parity bit?
It looks like either way, backspace isn't actually deleting the previous character from my input buffer, so I have some work to do. I'll post an update when it's fixed.


Good, but I'm fairly sure that backspace key gives $7E.

The remaining keys are:
- $7F is TAB,
- $9E is CONTROL-TAB
- $9F is SHIFT-TAB.
- $9C is SHIFT-backspace (delete line),
- $FE is CONTROL-backspace (delete char),
- $9D is SHIFT-> (insert line),
- $FF is CONTROL-> (insert char),
- $7D is SHIFT-< (clear screen),
- $FD is CONTROL-2 (bell)

You can also detect BREAK key by a return with error 128.




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users