Jump to content

rankeney's Photo


Member Since 26 Dec 2017
OFFLINE Last Active Jan 18 2018 4:28 PM

Topics I've Started

TECO for the Atari

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:





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.





Assembly questions (porting TECO to Atari)

Tue Dec 26, 2017 4:36 PM

Back in the dawn of time (around '81-82), I wrote a n implementation of TECO (DEC's Text Editor and COrrector) for the 6502. It was written as part of an operating system I developed for the Ohio Scientific line of beasts. The OS was called GenerOS (Generic Operating System), and barely saw the light of day. Years ago I posted the source on Usenet, hoping someone would port it to Atari, Apple, Commodore or whatever, but I think it was forgotten.  A few years back someone nudged me about it, hoping to port it to the Atari. No word back on that, so I thought I'd have a look at doing it myself.


Digging through what I can find, I've installed Altirra on my windows box and both ATASM and MADS and am looking at the next steps to take. After browsing several assembly language manuals for the Atari, I have a few starter questions that may speed my efforts. No really obvious answers have presented themselves.

  • Is there some preferred starting address for my program? It seems like the start of available memory varies depending on configuration. I'd like a fixed address, and I gather $600 doesn't assure me something else might not live there.
  • Where should I place my text editor buffer? I'd want it to be as large as possible.
  • It seems like there should be simple routines I can JSR to put a character on the screen, check for a key pressed, and return the key pressed, but I can't find them. Do I need to set up an IOCB to do all this?
  • I hear great things about MADS, but my code uses '*=addr' instead of 'ORG addr', and '.BYTE 00' instead of whatever MADS uses. Should I bother converting? I'm not using any macros or conditional compilation.

Once I get these basic things running, I should be mostly there. The only other details would be file I/O, which looks manageable.


Any help would be appreciated!


BTW, this TECO is a pretty full implementation based on TECO for the PDP-11.

See: https://en.wikipedia...O_(text_editor)