# Line editor (more text here)

In the misty years of yore, when fanfold terminals walked the earth, there lived a strange creature. Oddly crippled and yet oddly powerful, the line editor teemed across the programming landscape in untold numbers; covering the earth as far as the eye could see.

Now it is fallen on hard times. That vast population hunted, hounded, and driven to the brink of extinction. Only a few specimens remain, most in cramped and unembelished cages in the less enlightened kind of zoo, though a few stuffed and mounted examples can be seen in backwater museums. Oh, and there is ed.

Frankenstein-like, we shall resurrect the noble beast!

## Commands

Our editor is fairly minimal and will support the following commands

Focus moving commands

• <number>[,<number>] -- move the focus to the stated line and if the second argument is given to the state column. Excessive line number gets the last line. Excessive column number gets the end of the line.
• ,<number> -- move to column number on the current line
• e -- move the focus to the end of the file but do not begin a new line.
• b -- move the focus to the beginning of the file.

Informational commands

• L -- Echo the current context. The five lines centered on the current line are printed. All five lines are indented by one character; the current line is marked with a ">", the others with a " ". Under these lines another line is printed consisting entirely of spaces except for a "^" in the current column (a total of six lines are printed).
• l -- echo the current line
• p [[<start>],[<end>]] -- Print the file from starting to ending address. These value default to 1 and 0 (the end of the file).

File altering commands

• A [<text>] -- Move to the line beyond the end of the file (that is begin a new line) and (possibly) append text.
• <return> (alone) -- Insert a newline. Thus a <return> <return> inserts a newline after the current one.
• r <text> -- replaces everything from the focus to the end of the line with text.
• i [<text>] -- inserts text followed by by newline at the current focus. Any portion of this line beyond the focus ends up on the next line.
• I <text> -- inserts text at the current focus, preserving the rest of the line. Focus remains on this line.
• d -- Delete the contents of the current line or if the current line is already empty, remove the line.
• j -- join this line to the next

Of this last group the first four end with the focus moving to the next line, while I preserves the focus at the end of the added text. When deleting or joining focus remains at the same line and column number.

The Interpretation of line numbers in commands

Number beginning with '+' or '-' are interpreted as offsets from the current line number. Numbers without a sign are interpreted as absolute line numbers, except that '0' means the last line of the file.

## Prompt and interaction

The editor functions as a shell, and the prompt has the form <line>','<column>'>' where line is the line number except that "end" is used when the focus is at the last character of the file.

Each command is accepted only when the user presses newline. And takes affect.

Readline support is allowed but not required.

No feedback is provided except the changing values of and in the prompt, unless explicitly stated in the commands description.

# Scoring

This is , so the shortest answer in each language wins.

### Special thanks to dmkee for making this in sandbox where I adopted it.

• Hello, I downvoted this challenge because personally I find it to not be extremely well defined, to not be extremely interesting, and also to have quite strict runtime requirements. For example, many languages are not able to perform I/O in that manner, such as almost all golfing languages. Additionally, the format for the entire challenge makes me wonder if this was designed to be good for a specific programming language. If you can explain to me why this challenge is especially interesting with these I/O requirements, I will gladly revert my downvote. Jun 27, 2017 at 2:07
• @HyperNeutrino I personally don't think a challenge is bad because golfing languages can't participate, but that's just my personal opinion, take it as you will. Also can you elaborate on the runtime requirements? I don't see anything pertaining to runtime in the question description Jun 27, 2017 at 3:28
• @HyperNeutrino If you had issues you have had several years to raise them in sandbox. Jun 27, 2017 at 9:37
• @mbomb007 so you want your text editor to be not interactive? This challenge is based on real stuff. Jun 29, 2017 at 14:38
• @mbomb007 but this is a actual piece of code that could be used irl. So practical language work better Jun 29, 2017 at 15:27

## C (gcc), 1288121211881171 1146 bytes

#define P printf(
#define A case
#define B break
#define L(i,e,t,f,s)for(o=i;o e;){strcpy(l[o t],l[o f]);c[o t]=c[s o];}
#define R(m,o){return b<1|b>m?m o:b;}
#define N(f)sscanf(f,"%d,%d",&i,&j)||sscanf(f,",%d",&j)
r,i,j,o,z,c[999],*C,x=1,y=1;char a[999],l[999][999],(*L)[999];D(){L(r,>y,,-1,--)r++?strcpy(l[o],l[o-1]+--x),c[o-1]=x,l[o-1][x]=0:0;c[y++]=strlen(l[o]);x=1;}U(){strcat(*L,l[y]);*C=strlen(*L);L(y+1,<r,-1,,++)--r;*l[r]=c[r]=0;}X(b)R(c[y-1],+1)Y(b)R(r,)main(){for(;;){z=i=y;L=l+--z;C=c+z;j=x;!r||y/r&&x>*C?P"end> "):P"%d,%d> ",y,x);scanf("%[^\n]%*c",a)?a[2]*=!!a[1],N(a)?y=Y(i+(i<0|*a=='+')*y),x=X(j+(j<0||strchr(a+1,'+'))*x):0:(*a=D(),scanf("%*c"));switch(*a){A'e':y=r;x=c[r-1]+1;B;A'b':y=1;x=1;B;A'L':for(o=y-4;++o<y+2;)o<0^o<r&&P"%c%s\n",o^z?' ':'>',l[o]);for(o=x+1;--o;)P" ");P"^\n");B;A'l':puts(*L);B;A'p':i=1;j=0;N(a+2);for(o=Y(i)-1;o<Y(j);++o)puts(l[o]);B;A'A':y=r++;strcpy(l[y],a+2);x=c[y]=strlen(a+2);++x;++y;B;A'i':D();--y;x=X(0);A'r':strcpy(*L+x-1,a+2);*C=strlen(*L);x=1;++y>r&&++r;B;A'I':o=strlen(a+2);memmove(*L+x+o-1,*L+x-1,*C-x+1);*C+=o;memcpy(*L+x-1,a+2,o);x+=o;B;A'd':**L?**L=*C=0,x=1:U();y=y>r?r:y;B;A'j':y<r&&U();}}}


## Demo

First time trying to do something like this, so there are probably some missed opportunities for making it smaller. (Thanks Jerry Jeremiah for pointing out some)

Here's a (slightly) more readable version:

// often used functions/keywords:
#define P printf(
#define A case
#define B break

// loops for copying rows upwards/downwards are similar -> macro
#define L(i,e,t,f,s)for(o=i;o e;){strcpy(l[o t],l[o f]);c[o t]=c[s o];}

// range check for rows/columns is similar -> macro
#define R(m,o){return b<1|b>m?m o:b;}

// checking for numerical input is needed twice (move and print command):
#define N(f)sscanf(f,"%d,%d",&i,&j)||sscanf(f,",%d",&j)

// room for 999 rows with each 999 cols (not specified, should be enough)
// also declare "current line pointers" (*L for data, *C for line length),
// an input buffer (a) and scratch variables
r,i,j,o,z,c[999],*C,x=1,y=1;char a[999],l[999][999],(*L)[999];

// move rows down from current cursor position
D()
{
L(r,>y,,-1,--)
r++?strcpy(l[o],l[o-1]+--x),c[o-1]=x,l[o-1][x]=0:0;
c[y++]=strlen(l[o]);
x=1;
}

// move rows up, appending uppermost to current line
U()
{
strcat(*L,l[y]);
*C=strlen(*L);
L(y+1,<r,-1,,++)
--r;
*l[r]=c[r]=0;
}

// normalize positions, treat 0 as max
X(b)R(c[y-1],+1)
Y(b)R(r,)

main()
{
for(;;)
{
// initialize z as current line index, the current line pointers,
// i and j for default values of positioning
z=i=y;L=l+--z;C=c+z;j=x;

// prompt:
!r||y/r&&x>*C?P"end> "):P"%d,%d> ",y,x);

// read a line of input (using scanf so we don't need an include)
scanf("%[^\n]%*c",a)?

// no command arguments -> make check easier:
a[2]*=!!a[1],

// numerical input -> have move command:
// calculate new coordinates, checking for "relative"
N(a)?y=Y(i+(i<0|*a=='+')*y),x=X(j+(j<0||strchr(a+1,'+'))*x):0:

// check for empty input, read single newline and perform <return> command:
(*a=D(),scanf("%*c"));

switch(*a)
{
A'e':y=r;x=c[r-1]+1;B;
A'b':y=1;x=1;B;
A'L':for(o=y-4;++o<y+2;)o<0^o<r&&P"%c%s\n",o^z?' ':'>',l[o]);for(o=x+1;--o;)P" ");P"^\n");B;
A'l':puts(*L);B;
A'p':i=1;j=0;N(a+2);for(o=Y(i)-1;o<Y(j);++o)puts(l[o]);B;
A'A':y=r++;strcpy(l[y],a+2);x=c[y]=strlen(a+2);++x;++y;B;
A'i':D();--y;x=X(0);
// Commands i and r are very similar -> fall through from i to r
// after moving rows down and setting position at end of line:
A'r':strcpy(*L+x-1,a+2);*C=strlen(*L);x=1;++y>r&&++r;B;
A'I':o=strlen(a+2);memmove(*L+x+o-1,*L+x-1,*C-x+1);*C+=o;memcpy(*L+x-1,a+2,o);x+=o;B;
A'd':**L?**L=*C=0,x=1:U();y=y>r?r:y;B;
A'j':y<r&&U();
}
}
}


This challenge leaves quite a lot of corner cases to explore -- I guess I fixed all bugs by now, but if somebody finds one more, please comment. Regarding the revisions, I removed byte counts for earlier versions that contained subtle bugs.

• In the part of D after the loop, I think you can save bytes by replacing the references to o-1 and o with o ,--o, o, o, ++o. Also, you can do similar things with x in the same area. Jun 27, 2017 at 18:18
• @CalculatorFeline thanks for the hint, I have to check. I think a --o for the first o-1 here would be UB because it's unsequenced with another access of o :( Jun 27, 2017 at 21:11
• UB is allowed. Also, try [this](tio.run). Jun 27, 2017 at 21:13
• @CalculatorFeline sure, I thought so, just these sequencing issues might change even between compiler versions :o should I just add an explicit version? And for your link, thanks, but I don't think it supports interactive programs? Jun 27, 2017 at 21:54
• Unfortunately not. However, you can use prespecified sequences of input. May be convenient for testing. Jun 27, 2017 at 21:58

# AWK, 747 807 829 807 bytes

func d(D){if(D>0){for(;D<NR;)f[D++]=f[D+1];NR--}else{for(c=NR;x>-D;x--)f[x+1]=f[x];NR++}}
{f[r=NR]=$0} END{while(1){printf"%s,%d>",r==NR?"end":r,c getline v<"-" split(" > ",l,"") if(v=="e")r=NR if(v=="b")r=1 if(v=="L"){for(i=-2;i<3;i++)print l[i+3] f[r+i];printf"%"c+1"s\n","^"}if(v=="l")print f[r] if(v=="d")z=f[r]=""?d(r):f[r]="" if(v=="j"){f[r]=f[r] f[r+1];d(r+1)} S=index(v," ") z=S?substr(v,S+1):v a=substr(v,1,1) n=split(z,N,",") x=N[1]~/[-+].*/?r+N[1]:N[1] y=N[2]~/[-+].*/?c+N[2]:N[2] if(!S&&v~/[0-9+-,]+.*/){r=x?x>NR?NR:x:x=="0"?NR:r C=length(f[r]) c=n>1?y>C?C:y:c} if(a=="p")for(i=x?x:1;i<=(y?y:NR);)print f[i++] if(a=="r"||a=="i"||a=="I"){k=substr(f[r],c) if(a=="i"){if(c<length(f[r])){d(-r-1);f[r+1]=k}f[r]=substr(f[r],1,c) z (a=="I"?k:"")}if(a="a"||a=="A"){if(a=="A")r=NR;r=r+1;d(r);f[r]=z}}}}  Try it online! Removing the elses makes the lines a bit shorter/readable but the cursor assignment is a bit more complicated. Just for giggles, I created a version to add a bit more "functionality": q quits the program w <outfile[defaults to input file]> writes the changes. Try it online! • Not getting a caret for column position with L command here... Jun 29, 2017 at 8:40 • Ah. I didn't see that requirement. Thanks for finding that @FelixPalmen Jun 29, 2017 at 12:22 • Working now! I also see some requirements interpreted differently from my solution, maybe the challenge should be more precise here... Jun 29, 2017 at 12:44 • my character-index in a line is 1-based, you use 0-based. EOF position in my program is one after the last character of the last line, in your program its the first character of the line after the last line. My prompt shows only end> at the EOF position, yours shows end,[col]> in the last line. both aren't exactly what is specified I guess ... Jun 29, 2017 at 13:29 • Those were definitely left out of the spec. Perhaps that was to on purpose to allow for simplifications in different languages? Jun 29, 2017 at 13:34 ## 6502 Assembly (C64, BASIC loader), 5761 5352 bytes 0fOa=49152to50573:rEb:pOa,b:nE:sY49152 1dA162,54,134,1,162,1,134,7,134,8,202,142,0,96,134,251,162,96,134,21,162,128 2dA142,145,2,162,23,142,24,208,166,8,169,0,160,253,32,98,194,32,126,195,32,173 3dA195,166,2,240,103,202,202,16,2,162,0,142,160,191,173,162,191,201,69,240,93 4dA201,66,240,95,201,204,240,97,201,76,240,96,201,80,240,100,201,193,240,99,201 5dA73,240,123,201,82,240,122,201,201,240,121,201,68,240,123,201,74,240,122,162 6dA0,32,108,196,165,34,166,251,32,81,194,201,255,240,10,133,8,170,169,0,160,253 7dA32,98,194,160,0,177,253,170,232,165,35,201,255,208,2,165,7,32,81,194,133,7 8dA16,134,32,156,194,76,30,192,169,0,133,35,240,204,169,1,133,35,208,198,76,76 9dA193,166,8,32,198,193,76,30,192,76,233,192,166,251,232,134,251,134,8,169,0 10dA160,253,32,98,194,169,0,168,145,253,200,132,7,32,244,193,76,30,192,76,153 11dA193,76,178,193,32,244,193,76,30,192,76,45,193,32,8,195,76,30,192,166,251 12dA240,249,162,1,134,34,202,134,35,162,2,173,160,191,240,3,32,49,196,165,34 13dA166,251,32,81,194,201,255,208,2,169,1,133,34,166,251,165,35,201,255,208,2 14dA169,0,32,81,194,141,37,193,166,34,32,198,193,166,34,224,255,240,190,232,134 15dA34,208,242,160,0,177,253,208,17,165,8,197,251,208,5,198,8,200,132,7,32,8 16dA195,76,30,192,152,145,253,200,132,7,208,245,166,251,240,70,166,8,160,3,202 17dA240,6,200,202,240,2,200,202,232,140,120,193,142,122,193,228,8,240,7,169,32 18dA32,210,255,208,5,169,62,32,210,255,32,198,193,160,255,162,255,136,240,4,228 19dA251,208,219,169,32,166,7,32,210,255,202,208,250,169,94,32,210,255,169,13,32 20dA210,255,76,30,192,32,156,194,198,8,160,0,177,253,133,7,230,7,32,244,193,230 21dA8,162,1,134,7,76,30,192,160,0,166,7,202,138,145,253,32,244,193,230,8,162,1 22dA134,7,76,30,192,169,193,160,219,32,98,194,174,219,193,232,142,229,193,174 23dA220,193,142,230,193,174,255,255,240,16,142,236,193,160,0,185,255,255,32,210 24dA255,200,192,255,208,245,169,13,76,210,255,165,253,24,101,7,141,38,194,141 25dA57,194,165,254,105,0,141,39,194,141,58,194,173,38,194,109,160,191,141,41 26dA194,173,39,194,105,0,141,42,194,160,0,177,253,56,229,7,48,11,170,24,189,255 27dA255,157,255,255,202,16,247,174,160,191,202,16,1,96,189,164,191,157,255,255 28dA202,16,247,160,0,177,253,24,109,160,191,145,253,165,7,24,109,160,191,133,7 29dA96,141,93,194,201,255,240,9,201,0,240,4,224,255,16,1,138,96,141,154,194,141 30dA146,194,140,153,194,200,140,145,194,202,138,41,7,168,138,74,74,74,170,169,0 31dA24,202,48,4,105,3,144,249,141,161,191,185,129,197,41,3,109,161,191,105,96 32dA141,255,255,185,129,197,41,240,141,255,255,96,166,251,232,134,251,142,172 33dA194,169,195,160,120,32,98,194,162,255,202,142,194,194,228,8,240,16,48,14 34dA169,195,160,117,32,98,194,32,101,195,162,255,16,220,173,120,195,141,244,194 35dA141,235,194,173,121,195,141,245,194,141,236,194,160,0,177,253,141,240,194 36dA198,7,56,229,7,72,165,7,145,253,104,170,142,255,255,240,11,160,255,177,253 37dA157,255,255,136,202,208,247,162,1,134,7,166,8,228,251,240,3,232,134,8,96 38dA166,8,228,251,240,86,232,169,195,160,53,32,98,194,173,53,195,141,39,195,173 39dA54,195,141,40,195,160,0,177,253,174,255,255,240,18,142,48,195,24,105,255 40dA145,253,168,189,255,255,145,253,136,202,208,247,166,8,232,228,251,240,30 41dA142,79,195,169,195,160,120,32,98,194,162,255,232,142,95,195,169,195,160,117 42dA32,98,194,32,101,195,162,255,208,222,198,251,96,173,117,195,141,114,195,173 43dA118,195,141,115,195,174,255,255,189,255,255,157,255,255,202,16,247,96,165,8 44dA197,251,144,22,160,0,177,253,197,7,16,14,162,0,189,137,197,32,210,255,232 45dA224,5,208,245,96,165,8,32,196,196,169,44,32,210,255,165,7,32,196,196,162,3 46dA208,225,162,0,134,2,134,204,32,228,255,240,251,36,21,240,17,166,2,224,30 47dA240,241,32,210,255,157,162,191,232,134,2,16,230,201,13,208,19,169,0,166,2 48dA157,162,191,230,204,169,32,32,210,255,169,13,76,210,255,201,20,208,203,166 49dA2,240,199,32,210,255,202,134,2,16,191,141,11,196,141,22,196,32,117,197,160 50dA0,189,162,191,240,44,201,43,208,7,169,1,133,255,232,208,9,201,45,208,8,169 51dA255,133,255,232,189,162,191,240,19,201,48,48,15,201,58,16,11,153,194,191 52dA232,200,192,3,16,2,48,232,96,142,69,196,160,0,132,25,132,32,136,132,34,132 53dA35,169,25,32,244,195,224,255,240,10,142,81,196,32,31,197,133,34,162,255,189 54dA162,191,201,44,208,18,232,142,99,196,169,32,32,244,195,224,255,240,5,32,31 55dA197,133,35,96,32,49,196,169,1,36,25,240,36,16,21,165,34,197,8,48,6,169,1 56dA133,34,208,22,165,8,56,229,34,133,34,208,13,165,8,24,101,34,133,34,144,4 57dA169,0,133,34,169,1,36,32,240,36,16,21,165,35,197,7,48,6,169,1,133,35,208,22 58dA165,7,56,229,35,133,35,208,13,165,7,24,101,35,133,35,144,4,169,0,133,35,96 59dA32,215,196,162,0,189,194,191,240,3,32,210,255,232,224,3,208,243,96,133,20 60dA32,117,197,162,8,160,2,185,194,191,201,5,48,5,105,2,153,194,191,136,16,241 61dA160,2,165,20,10,133,20,185,194,191,42,201,16,41,15,153,194,191,136,16,242 62dA202,208,215,173,196,191,9,48,141,196,191,160,1,185,194,191,240,8,9,48,153 63dA194,191,136,16,243,96,173,196,191,208,19,173,195,191,141,196,191,173,194 64dA191,141,195,191,169,0,141,194,191,240,232,160,2,185,194,191,240,5,41,207 65dA153,194,191,136,16,243,162,8,160,125,24,185,69,191,144,2,9,16,74,153,69,191 66dA200,16,242,165,20,106,202,208,1,96,133,20,160,2,185,194,191,201,8,48,5,233 67dA3,153,194,191,136,16,241,48,211,169,0,141,194,191,141,195,191,141,196,191 68dA96,0,96,192,33,129,225,66,162,69,78,68,62,32  ## Demo This entry is just for fun and will probably never reach a decent byte count. It's just because the challenge is about some "ancient" tool, why not implement it for an ancient machine ;) In the course of creating this thing, I was reminded once again that the C64 system doesn't provide any sensible way of converting between strings and integers -- only strings and floats are covered and this is ridiculous, so this piece of code contains own conversion routines. In fact, the only OS routines called are GETIN (read a single character from keyboard) and CHROUT (write a single character to the screen). Now, assembly is probably the "least golfy" language ever. For how to "golf" this, my idea as seen here is a BASIC loader, writing the bytes of the final binary to some memory location and jumping there. It's a working BASIC program this way ;) If anyone has a better idea how to golf this, please leave a comment! The text buffer is quite limited, using up the space between $6000 and $BFFF (BASIC ROM is turned off as it's not needed) and the program itself resides at $C000. All in all, there's room for 255 lines with 95 characters each, and the program doesn't do any bounds checking, so playing with it, make sure your lines don't grow too large ;)

Finally, look here for the readable source, including my "golfing tool".

As this is pretty limited stuff, and the C64 can do better, here comes the "deluxe edition" using 80 columns display. To do this, the Kernal must be deactivated, so basic things like a keyboard driver, a font, bitmap manipulation logic for output, interrupt handling etc must be included, therefore it's quite a challenge to fit all this in the 4K area $C000-$CFFF (and this is needed for loading the program from a BASIC program to work).

• fits in the 4K, but narrowly ... got 6 "spare" bytes now 3686 3841 bytes ;)
• the basic loader is 13743 13385 13963 bytes (used the saved bytes for new feature "line editing")
• screen color and sprite data is hidden in the ram "below" the MMIO area $D000-$DFFF
• The PC-style text cursor is a "hardware cursor", using a sprite
• the bitmap uses the area $E000-$FF3F, freely accessible because the kernal is switched off
• There's an additional command implemented: q exits the editor
• Extra feature: command line editing using cursor RIGHT and LEFT, Pos1 (HOME), End (SHIFT + HOME) and backspace (DEL)

## Demo

Program to type in yourself, if you want 80s computer mag feeling:

0fOa=49152to52992:rEb:pOa,b:nE:sY49152
1dA162,2,181,0,157,0,207,232,208,248,173,32,208,133,2,173,33,208,133,3,173,17
2dA208,133,5,120,169,0,141,21,208,169,52,133,1,169,15,162,0,32,67,196,32,96,196
3dA162,127,169,0,157,0,218,202,16,250,169,240,141,18,218,141,21,218,169,104,141
4dA248,223,169,53,133,1,169,25,141,0,208,169,50,141,1,208,169,0,141,16,208,141
5dA29,208,141,23,208,141,28,208,169,1,141,39,208,141,27,208,141,21,208,169,228
6dA141,250,255,169,195,141,251,255,169,0,141,14,221,141,4,221,141,5,221,169,129
7dA141,13,221,169,1,141,14,221,173,0,221,41,252,141,0,221,173,24,208,133,4,32
8dA241,195,32,39,196,169,0,133,6,133,7,141,32,208,88,162,1,134,46,32,156,196
9dA120,32,25,196,173,0,221,9,3,141,0,221,165,4,141,24,208,169,55,133,1,169,1
10dA141,13,221,173,13,221,165,5,141,17,208,165,2,141,32,208,165,3,141,33,208
11dA169,0,141,21,208,162,2,189,0,207,149,0,232,208,248,88,96,133,10,169,0,133
12dA11,165,10,10,38,11,10,38,11,10,38,11,133,10,169,1,24,101,10,133,10,169,203
13dA101,11,133,11,96,169,0,133,9,165,6,10,10,10,10,38,9,10,38,9,10,38,9,133,8
14dA165,9,101,6,105,224,133,9,165,12,10,10,10,144,3,230,9,24,101,8,144,2,230,9
15dA133,8,96,160,224,132,9,200,132,11,160,64,132,10,160,0,132,8,162,50,169,0
16dA168,224,3,48,2,177,10,145,8,200,192,160,208,243,202,240,23,169,159,101,8
17dA133,8,144,3,230,9,24,169,160,101,10,133,10,144,218,230,11,176,214,96,72,132
18dA21,76,199,193,72,132,21,201,13,240,15,201,17,240,30,32,241,193,230,7,160,80
19dA196,7,208,52,160,0,132,7,230,6,160,25,196,6,208,40,198,6,32,59,193,240,33
20dA169,32,164,7,240,5,136,132,7,16,19,160,79,132,7,164,6,240,5,136,132,6,16,6
21dA160,0,132,7,240,3,32,241,193,165,6,10,10,10,105,50,141,1,208,169,0,141,16
22dA208,165,7,10,10,144,4,238,16,208,24,105,24,144,3,238,16,208,141,0,208,32
23dA229,195,104,164,21,96,24,74,176,67,32,235,192,160,7,177,10,41,240,153,13,0
24dA136,16,246,165,7,74,133,12,176,18,32,12,193,160,7,177,8,41,15,25,13,0,145,8
25dA136,16,244,96,32,12,193,160,7,177,8,41,240,74,74,74,74,74,25,13,0,106,106
26dA106,106,145,8,136,16,235,96,32,235,192,160,7,177,10,41,15,153,13,0,136,16
27dA246,165,7,74,133,12,176,25,32,12,193,160,7,177,8,10,10,10,10,10,25,13,0,42
28dA42,42,42,145,8,136,16,237,96,32,12,193,160,7,177,8,41,240,25,13,0,145,8,136
29dA16,244,96,174,113,202,236,114,202,240,11,181,22,202,16,2,162,15,142,113,202
30dA24,96,169,0,133,43,133,38,133,40,169,127,141,0,220,173,1,220,73,255,240,25
31dA170,41,4,240,6,165,43,9,128,133,43,138,41,251,240,9,230,40,32,161,195,105
32dA56,133,38,169,191,141,0,220,173,1,220,73,255,240,25,170,41,16,240,6,165,43
33dA9,64,133,43,138,41,239,240,9,230,40,32,161,195,105,48,133,38,169,223,141,0
34dA220,173,1,220,73,255,240,9,230,40,32,161,195,105,40,133,38,169,239,141,0
35dA220,173,1,220,73,255,240,9,230,40,32,161,195,105,32,133,38,169,247,141,0
36dA220,173,1,220,73,255,240,9,230,40,32,161,195,105,24,133,38,169,251,141,0
37dA220,173,1,220,73,255,240,9,230,40,32,161,195,105,16,133,38,169,253,141,0
38dA220,173,1,220,73,255,240,25,170,41,128,240,6,165,43,9,64,133,43,138,41,127
39dA240,9,230,40,32,161,195,105,8,133,38,169,254,141,0,220,173,1,220,73,255,240
40dA7,230,40,32,161,195,133,38,165,40,208,5,169,128,133,39,96,165,38,197,39,240
41dA51,133,39,162,25,134,41,162,1,134,42,5,43,174,114,202,149,22,202,16,2,162
42dA15,142,114,202,236,113,202,208,8,202,16,2,162,15,142,113,202,96,162,7,74
43dA176,4,202,16,250,96,138,24,96,166,41,240,4,202,134,41,96,166,42,240,4,202
44dA134,42,96,162,1,134,42,76,132,195,133,44,134,45,198,46,208,12,169,24,133,46
45dA169,1,77,21,208,141,21,208,32,141,194,169,255,141,25,208,166,45,165,44,64
46dA120,160,1,140,21,208,160,24,132,46,88,96,169,127,141,13,220,173,13,220,169
47dA1,141,26,208,141,25,208,169,16,141,18,208,173,17,208,41,127,141,17,208,169
48dA196,141,254,255,169,195,141,255,255,96,169,0,141,26,208,141,25,208,169,131
49dA141,13,220,96,173,17,208,9,32,141,17,208,169,121,141,24,208,96,173,17,208
50dA41,223,141,17,208,169,114,141,24,208,96,134,47,10,10,10,10,101,47,162,220
51dA134,48,160,0,132,47,162,4,145,47,200,208,251,230,48,202,208,246,96,169,0
52dA168,133,47,162,224,134,48,162,31,145,47,200,208,251,230,48,202,208,246,160
53dA63,145,47,136,16,251,96,32,121,194,184,176,24,170,16,3,44,115,202,41,127
54dA170,189,116,202,80,2,9,128,201,31,176,3,44,115,202,24,96,162,1,134,56,134
55dA55,202,142,0,96,134,54,166,55,160,57,32,208,198,32,188,199,32,235,199,166
56dA65,240,108,202,202,16,2,162,0,134,49,165,128,201,69,240,99,201,66,240,101
57dA201,108,240,103,201,76,240,102,201,80,240,105,201,97,240,103,201,73,240,124
58dA201,82,240,122,201,105,240,120,201,68,240,121,201,74,240,119,201,81,208,1
59dA96,162,0,32,104,201,165,67,166,54,224,0,240,167,32,191,198,201,255,240,8
60dA133,55,170,160,57,32,208,198,160,0,177,57,170,232,165,68,201,255,208,2,165
61dA56,32,191,198,133,56,16,131,32,0,199,16,63,169,0,133,68,240,203,169,1,133
62dA68,208,197,76,10,198,166,55,32,87,198,80,41,240,42,166,54,232,134,54,134,55
63dA160,57,32,208,198,169,0,168,145,57,200,132,56,32,118,198,16,14,240,82,240
64dA104,32,118,198,16,5,240,122,32,94,199,76,168,196,166,54,240,249,162,1,134
65dA67,202,134,68,162,2,165,49,240,3,32,49,201,165,67,166,54,32,191,198,201,255
66dA208,2,169,1,133,67,166,54,165,68,201,255,208,2,169,0,32,191,198,141,167,197
67dA166,67,32,87,198,166,67,224,255,240,191,232,134,67,208,242,32,0,199,198,55
68dA160,0,177,57,133,56,230,56,32,118,198,230,55,162,1,134,56,208,162,160,0,166
69dA56,202,138,145,57,32,118,198,166,54,228,55,240,124,230,55,162,1,134,56,208
70dA116,160,0,196,54,240,110,177,57,208,24,165,55,197,54,208,5,198,55,200,132
71dA56,32,94,199,160,1,196,55,48,86,132,55,16,82,152,145,57,200,132,56,208,74
72dA166,54,240,70,166,55,160,3,202,240,6,200,202,240,2,200,202,232,140,54,198
73dA142,56,198,228,55,240,7,169,32,32,125,193,208,5,169,62,32,125,193,32,87,198
74dA160,255,162,255,136,240,4,228,54,208,219,169,32,166,56,32,125,193,202,208
75dA250,169,38,32,125,193,169,13,32,125,193,76,168,196,160,50,32,208,198,160,0
76dA177,50,240,15,141,110,198,230,50,177,50,32,125,193,200,192,255,208,246,169
77dA13,76,125,193,165,57,24,101,56,133,50,165,58,105,0,133,51,165,50,101,49,133
78dA52,165,51,105,0,133,53,160,0,177,57,56,229,56,48,8,168,177,50,145,52,136,16
79dA249,164,49,136,16,1,96,185,130,0,145,50,136,16,248,160,0,177,57,24,101,49
80dA145,57,165,56,24,101,49,133,56,96,141,203,198,201,255,240,9,201,0,240,4,224
81dA255,16,1,138,96,140,254,198,200,140,247,198,202,138,41,7,168,138,74,74,74
82dA170,169,0,24,202,48,4,105,3,144,249,133,63,185,244,202,41,3,101,63,105,96
83dA133,255,185,244,202,41,240,133,255,96,166,54,232,134,54,134,64,160,59,32
84dA208,198,198,64,166,64,228,55,240,14,48,12,160,61,32,208,198,32,175,199,166
85dA64,16,227,165,59,141,74,199,165,60,141,75,199,160,0,177,57,141,70,199,198
86dA56,56,229,56,72,165,56,145,57,104,160,0,145,59,170,240,11,160,255,177,57
87dA157,255,255,136,202,208,247,162,1,134,56,166,55,228,54,240,3,232,134,55,96
88dA166,55,228,54,240,74,232,160,61,32,208,198,165,61,141,134,199,165,62,141
89dA135,199,160,0,177,61,240,20,170,177,57,134,64,24,101,64,145,57,168,189,255
90dA255,145,57,136,202,208,247,166,55,232,134,64,228,54,240,21,160,59,32,208
91dA198,230,64,166,64,160,61,32,208,198,32,175,199,166,64,208,231,198,54,96,160
92dA0,177,61,168,177,61,145,59,136,16,249,96,165,55,197,54,144,22,160,0,177,57
93dA197,56,16,14,162,0,189,252,202,32,125,193,232,224,5,208,245,96,165,55,32
94dA192,201,169,44,32,125,193,165,56,32,192,201,162,3,208,225,166,7,134,74,166
95dA6,134,75,160,0,132,65,132,66,132,76,164,76,240,6,169,13,32,125,193,96,32
96dA125,196,176,241,112,86,164,65,192,80,240,233,196,66,240,7,182,127,150,128
97dA136,16,245,32,125,193,166,6,134,72,166,7,134,73,208,8,166,6,228,75,208,2
98dA198,75,153,128,0,200,132,66,230,65,196,65,240,23,185,128,0,32,125,193,165,7
99dA208,10,169,24,197,72,208,4,198,72,198,75,200,16,229,166,72,134,6,166,73,134
100dA7,32,119,193,16,153,201,13,208,4,230,76,208,40,201,11,208,10,166,66,228,65
101dA240,135,230,66,16,30,201,12,208,8,166,66,240,46,198,66,16,18,201,15,208,6
102dA162,0,134,66,16,8,201,16,208,31,166,65,134,66,166,75,134,6,24,165,74,101
103dA66,201,80,133,7,144,6,233,80,133,7,230,6,32,119,193,76,251,199,201,17,208
104dA249,164,66,240,245,136,198,65,132,66,196,65,240,7,182,129,150,128,200,16
105dA245,32,125,193,166,6,134,72,166,7,134,73,164,66,196,65,240,9,185,128,0,32
106dA125,193,200,16,243,169,32,32,125,193,166,72,134,6,166,73,134,7,32,119,193
107dA76,251,199,141,12,201,141,23,201,32,104,202,160,0,181,128,240,43,201,43
108dA208,7,169,1,133,255,232,208,9,201,45,208,7,169,255,133,255,232,181,128,240
109dA19,201,48,48,15,201,58,16,11,153,209,0,232,200,192,3,16,2,48,233,96,134,71
110dA160,0,132,69,132,70,136,132,67,132,68,169,69,32,246,200,228,71,240,9,134
111dA71,32,24,202,133,67,166,71,181,128,201,44,208,17,232,134,71,169,70,32,246
112dA200,228,71,240,5,32,24,202,133,68,96,32,49,201,169,1,36,69,240,36,16,21
113dA165,67,197,55,48,6,169,1,133,67,208,22,165,55,56,229,67,133,67,208,13,165
114dA55,24,101,67,133,67,144,4,169,0,133,67,169,1,36,70,240,36,16,21,165,68,197
115dA56,48,6,169,1,133,68,208,22,165,56,56,229,68,133,68,208,13,165,56,24,101
116dA68,133,68,144,4,169,0,133,68,96,32,210,201,162,0,181,209,240,3,32,125,193
117dA232,224,3,208,244,96,133,212,32,104,202,162,8,160,2,185,209,0,201,5,48,5
118dA105,2,153,209,0,136,16,241,160,2,165,212,10,133,212,185,209,0,42,201,16,41
119dA15,153,209,0,136,16,242,202,208,215,165,211,9,48,133,211,160,1,185,209,0
120dA240,8,9,48,153,209,0,136,16,243,96,165,211,208,14,165,210,133,211,165,209
121dA133,210,169,0,133,209,240,238,160,2,185,209,0,240,5,41,207,153,209,0,136
122dA16,243,162,8,160,125,24,185,84,0,144,2,9,16,74,153,84,0,200,16,242,165,212
123dA106,202,208,1,96,133,212,160,2,185,209,0,201,8,48,5,233,3,153,209,0,136,16
124dA241,48,211,169,0,133,209,133,210,133,211,96,15,15,127,9,5,3,1,7,11,13,17,0
125dA69,83,90,52,65,87,51,88,84,70,67,54,68,82,53,86,85,72,66,56,71,89,55,78,79
126dA75,77,48,74,73,57,44,64,58,46,45,76,80,43,47,94,61,0,15,59,42,124,21,81,19
127dA32,50,0,0,49,10,6,4,2,8,12,14,18,0,101,115,122,36,97,119,35,120,116,102,99
128dA38,100,114,37,118,117,104,98,40,103,121,39,110,111,107,109,48,106,105,41
129dA60,64,91,62,45,108,112,43,63,94,61,0,16,93,42,124,22,113,20,32,34,0,0,33,0
130dA96,192,33,129,225,66,162,69,78,68,62,32,34,20,34,85,119,85,85,0,82,5,34,85
131dA119,85,85,0,34,20,119,68,102,68,119,0,82,5,119,68,102,68,119,0,34,20,34,85
132dA85,85,34,0,82,5,34,85,85,85,34,0,65,34,85,85,85,85,34,0,82,5,80,85,85,85
133dA34,0,0,34,20,102,17,51,119,0,0,82,5,102,17,51,119,0,0,34,20,34,119,68,34,0
134dA0,82,5,34,119,68,34,0,0,34,20,34,85,85,34,0,0,82,5,34,85,85,34,0,0,65,34
135dA85,85,85,51,0,0,82,5,80,85,85,51,0,2,2,2,2,2,0,2,0,102,102,15,6,15,6,6,0
136dA37,113,66,98,18,100,37,0,34,82,4,0,0,0,0,0,36,66,66,66,66,66,36,0,0,82,34
137dA119,34,82,0,0,0,0,0,7,0,32,32,64,1,1,2,2,2,36,36,0,33,83,117,113,81,81,33
138dA0,34,85,17,34,33,69,114,0,23,52,86,113,17,21,18,0,39,65,65,98,82,82,34,0
139dA34,85,85,35,81,81,34,0,0,34,34,0,0,34,34,4,0,16,39,64,39,16,0,0,2,69,33,18
140dA34,64,2,0,32,80,118,81,115,69,39,0,64,64,99,84,84,84,99,0,16,16,50,85,87
141dA84,50,0,16,32,115,37,37,35,33,2,66,64,98,82,82,82,82,0,36,4,37,38,38,38,37
142dA64,32,32,38,39,37,37,37,0,0,0,98,85,85,85,82,0,0,0,99,85,85,99,65,65,0,0
143dA98,84,70,65,70,0,32,32,117,37,37,37,19,0,0,0,85,85,87,119,34,0,0,0,85,37
144dA37,34,82,4,1,2,114,36,34,66,113,0,36,34,34,33,34,34,36,0,82,165,5,6,5,5,6
145dA4,34,37,21,7,5,5,5,0,99,84,84,100,84,84,99,0,103,84,84,86,84,84,103,0,118
146dA69,68,103,69,69,71,0,87,82,82,114,82,82,87,0,21,21,22,22,22,85,37,0,69,71
147dA71,69,69,69,117,0,82,85,117,117,117,85,82,0,98,85,85,101,69,71,67,0,98,85
148dA84,98,97,85,82,0,117,37,37,37,37,37,34,0,85,85,85,85,87,119,37,0,85,85,37
149dA34,34,82,82,0,115,18,34,34,34,66,115,0,6,50,66,114,226,66,54,0,48,64,67,68
150dA68,51,17,34,221,235,221,170,136,170,170,255,173,250,221,170,136,170,170
151dA255,221,235,136,187,153,187,136,255,173,250,136,187,153,187,136,255,221
152dA235,221,170,170,170,221,255,173,250,221,170,170,170,221,255,190,221,170
153dA170,170,170,221,255,173,250,175,170,170,170,221,255,255,221,235,153,238
154dA204,136,255,255,173,250,153,238,204,136,255,255,221,235,221,136,187,221
155dA255,255,173,250,221,136,187,221,255,255,221,235,221,170,170,221,255,255
156dA173,250,221,170,170,221,255,255,190,221,170,170,170,204,255,255,173,250
157dA175,170,170,204,255,253,253,253,253,253,255,253,255,153,153,240,249,240
158dA249,249,255,218,142,189,157,237,155,218,255,221,173,251,255,255,255,255
159dA255,219,189,189,189,189,189,219,255,255,173,221,136,221,173,255,255,255
160dA255,255,248,255,223,223,191,254,254,253,253,253,219,219,255,222,172,138
161dA142,174,174,222,255,221,170,238,221,222,186,141,255,232,203,169,142,238
162dA234,237,255,216,190,190,157,173,173,221,255,221,170,170,220,174,174,221
163dA255,255,221,221,255,255,221,221,251,255,239,216,191,216,239,255,255,253
164dA186,222,237,221,191,253,255,223,175,137,174,140,186,216,255,191,191,156
165dA171,171,171,156,255,239,239,205,170,168,171,205,255,239,223,140,218,218
166dA220,222,253,189,191,157,173,173,173,173,255,219,251,218,217,217,217,218
167dA191,223,223,217,216,218,218,218,255,255,255,157,170,170,170,173,255,255
168dA255,156,170,170,156,190,190,255,255,157,171,185,190,185,255,223,223,138
169dA218,218,218,236,255,255,255,170,170,168,136,221,255,255,255,170,218,218
170dA221,173,251,254,253,141,219,221,189,142,255,219,221,221,222,221,221,219
171dA255,173,90,250,249,250,250,249,251,221,218,234,248,250,250,250,255,156,171
172dA171,155,171,171,156,255,152,171,171,169,171,171,152,255,137,186,187,152
173dA186,186,184,255,168,173,173,141,173,173,168,255,234,234,233,233,233,170
174dA218,255,186,184,184,186,186,186,138,255,173,170,138,138,138,170,173,255
175dA157,170,170,154,186,184,188,255,157,170,171,157,158,170,173,255,138,218
176dA218,218,218,218,221,255,170,170,170,170,168,136,218,255,170,170,218,221
177dA221,173,173,255,140,237,221,221,221,189,140,255,249,205,189,141,29,189,201
178dA255,207,191,188,187,187,204,238,221

• Holy crud you did it Jul 2, 2017 at 18:37
• Hehe yep, it's fun :) "deluxe edition" with 80col text mode coming soon, this is a challenge to fit in 4K (needs a font, a keyboard driver and handling a bitmapped mode for text display -- I think it can be done) Jul 3, 2017 at 22:51
• With now 259 bytes left for additional code and 2306 unused bytes below the I/O area, a command history comes to mind ... (would be enough to hold 28 lines of history) ... doing it in 259 bytes of code seems challenging ;) Jul 6, 2017 at 16:39
• Do it! Plez do it Jul 6, 2017 at 16:42
• I guess I misjudged the complexity of a good command history ;) You have to make sure there aren't two identical adjacent entries and you have to save the "current" line while browsing the history ... seems impossible to implement this in 259 bytes, I'll have to find some other tricks to reduce size first ;) Jul 11, 2017 at 6:58