Jump to content
IGNORED

TECO for the Atari


rankeney

Recommended Posts

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

 

 

teco.obx

  • Like 10
Link to comment
Share on other sites

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'.

  • Like 2
Link to comment
Share on other sites

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)".

Link to comment
Share on other sites

@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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...