papierkorb:ledit.blk
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| papierkorb:ledit.blk [2025-08-16 17:50] – ↷ Seite von projects:ledit.blk nach papierkorb:ledit.blk verschoben mka | papierkorb:ledit.blk [Unbekanntes Datum] (aktuell) – gelöscht - Externe Bearbeitung (Unbekanntes Datum) 127.0.0.1 | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| - | ===DOSEDIT style forth input line editor=== | ||
| - | < | ||
| - | Screen 0 not modified | ||
| - | | ||
| - | 1 \ Last change: | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 10 | ||
| - | 11 | ||
| - | 12 | ||
| - | 13 | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 1 not modified | ||
| - | 0 \ LEDIT LOAD SCREEN | ||
| - | | ||
| - | 2 ONLY FORTH DEFINITIONS ALSO | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 10 | ||
| - | 11 | ||
| - | 12 | ||
| - | 13 | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 2 not modified | ||
| - | 0 \ Line editor variables | ||
| - | | ||
| - | 2 ONLY EDITOR ALSO FORTH DEFINITIONS | ||
| - | | ||
| - | 4 VARIABLE %MOD \ Type-over/ | ||
| - | 5 VARIABLE %BUF \ Address of line buffer. | ||
| - | 6 VARIABLE %MLEN \ Length of line buffer. | ||
| - | 7 VARIABLE %OFF \ Offset to start of line. | ||
| - | 8 VARIABLE %ROW \ Current row or vertical position on screen. | ||
| - | 9 VARIABLE %POS \ Current position in the line. | ||
| - | 10 VARIABLE %DONE \ Finished flag. If true then quit. | ||
| - | 11 VARIABLE LKEY \ Last key code pressed. | ||
| - | 12 | ||
| - | 13 | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 3 not modified | ||
| - | 0 \ #R POS@ | ||
| - | | ||
| - | 2 : #R ( -- n ) \ Leave n, characters to right of cursor. | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 9 : POS@ ( -- adr ) \ Leave address of current cursor position. | ||
| - | 10 | ||
| - | 11 %BUF @ \ Fetch address of line buffer. | ||
| - | 12 %POS @ \ Fetch current cursor position. | ||
| - | 13 + ; \ Add leaving current address of cursor. | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 4 not modified | ||
| - | 0 \ CUR 09: | ||
| - | | ||
| - | 2 : CUR ( row col -- ) \ Position cursor at (col, | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 10 | ||
| - | 11 | ||
| - | 12 | ||
| - | 13 | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 5 not modified | ||
| - | 0 \ .POS | ||
| - | | ||
| - | 2 : .POS ( -- -- ) \ Move cursor to its current position. | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 10 | ||
| - | 11 CUR ; \ Position cursor at (col, | ||
| - | 12 | ||
| - | 13 | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 6 not modified | ||
| - | 0 \ !POS +POS | ||
| - | | ||
| - | 2 : !POS ( n -- ) \ Set current position to n. | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 9 : +POS ( n -- ) \ Increment current position by n. | ||
| - | 10 | ||
| - | 11 %POS @ + \ Fetch current position in line and add | ||
| - | 12 !POS ; \ value " | ||
| - | 13 \ position in line. | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 7 not modified | ||
| - | 0 \ +.POS HOM | ||
| - | | ||
| - | 2 : +.POS ( n -- ) \ Increment by n and display at new location | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 8 : HOM ( -- -- ) \ To begining of line, type-over mode. | ||
| - | | ||
| - | 10 %POS OFF \ Set current position in line to zero. | ||
| - | 11 | ||
| - | 12 %MOD OFF ; \ Set insert mode to false. | ||
| - | 13 | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 8 not modified | ||
| - | 0 \ !CHAR ECHO 09: | ||
| - | | ||
| - | 2 : !CHAR ( char -- ) \ Store character at current position. | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 9 : ECHO ( char -- ) \ Echo character and store character. | ||
| - | 10 | ||
| - | 11 | ||
| - | 12 !CHAR ; \ Store character at current position. | ||
| - | 13 | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 9 not modified | ||
| - | 0 \ CTYPE 09: | ||
| - | | ||
| - | 2 : CTYPE ( adr cnt -- ) \ Send string to console only. | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 10 | ||
| - | 11 | ||
| - | 12 | ||
| - | 13 | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 10 not modified | ||
| - | 0 \ .LIN | ||
| - | | ||
| - | 2 : .LIN ( -- -- ) \ Update entire line. | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 10 | ||
| - | 11 | ||
| - | 12 | ||
| - | 13 | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 11 not modified | ||
| - | 0 \ RUB 09: | ||
| - | | ||
| - | 2 : RUB ( -- -- ) \ Rub out character behind cursor. | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 10 | ||
| - | 11 | ||
| - | 12 | ||
| - | 13 | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 12 not modified | ||
| - | 0 \ MEOL | ||
| - | | ||
| - | 2 : MEOL ( -- -- ) \ Move to end of line. | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 10 | ||
| - | 11 | ||
| - | 12 | ||
| - | 13 | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 13 not modified | ||
| - | 0 \ DEOL DEALL 09: | ||
| - | | ||
| - | 2 : DEOL ( -- -- ) \ Delete to end of field. | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 10 : DEALL ( -- -- ) \ Delete entire line. | ||
| - | 11 | ||
| - | 12 %BUF @ %MLEN @ \ Get address and length of line buffer. | ||
| - | 13 BL FILL \ Fill line with blanks. | ||
| - | 14 | ||
| - | 15 HOM ; \ Move cursor to beginning of line. | ||
| - | |||
| - | |||
| - | Screen 14 not modified | ||
| - | 0 \ DCHAR 09: | ||
| - | | ||
| - | 2 \ Delete character at cursor position and close gap created. | ||
| - | 3 : DCHAR ( -- -- ) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 10 1+ CTYPE \ Add one to cursor and send | ||
| - | 11 .POS ; \ string to console. Move cursor | ||
| - | 12 \ to current position. | ||
| - | 13 | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 15 not modified | ||
| - | 0 \ ICHAR 09: | ||
| - | | ||
| - | 2 \ Insert character char at current position and update display. | ||
| - | 3 : ICHAR ( char -- ) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 10 \ cursor one to right. | ||
| - | 11 ELSE BEEP 2DROP \ No, beep then clean up stack. | ||
| - | 12 THEN R> DROP ; \ Clean up return and parameter | ||
| - | 13 \ stack. | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 16 not modified | ||
| - | 0 \ OVER-STRIKE | ||
| - | | ||
| - | 2 : OVER-STRIKE ( -- -- ) \ Set over-strike mode. | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 10 : INSERT | ||
| - | 11 | ||
| - | 12 %MOD @ NOT IF \ If over-strike mode then | ||
| - | 13 | ||
| - | 14 %MOD ON \ set insert mode | ||
| - | 15 THEN ; \ otherwise continue. | ||
| - | |||
| - | |||
| - | Screen 17 not modified | ||
| - | 0 \ L-ARROW | ||
| - | | ||
| - | 2 : L-ARROW | ||
| - | | ||
| - | | ||
| - | 5 : R-ARROW | ||
| - | | ||
| - | | ||
| - | | ||
| - | 9 : CLR ( -- -- ) \ Clear screen, & redisplay at home. | ||
| - | 10 | ||
| - | 11 0 0 79 24 15 INIT-WINDOW | ||
| - | 12 %ROW OFF .LIN ; \ Update entire first line. | ||
| - | 13 | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 18 not modified | ||
| - | 0 \ INSS +TRANS | ||
| - | | ||
| - | 2 : INSS ( -- -- ) \ Insert/ | ||
| - | | ||
| - | | ||
| - | 5 : +TRANS ( -- -- ) \ | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 10 THEN ; \ | ||
| - | 11 | ||
| - | 12 | ||
| - | 13 : -TRANS ( -- -- ) | ||
| - | 14 %POS @ | ||
| - | 15 IF -1 +.POS +TRANS L-ARROW | ||
| - | |||
| - | |||
| - | Screen 19 not modified | ||
| - | 0 \ BK.PTR | ||
| - | 1 256 CONSTANT BK.SIZE | ||
| - | | ||
| - | | ||
| - | | ||
| - | 5 \ Leave address of the top of the backup buffer. | ||
| - | 6 : BK.ADR ( -- adr ) | ||
| - | | ||
| - | | ||
| - | 9 \ Increment pointer to top of backup buffer by n. | ||
| - | 10 : +BK.PTR ( n -- ) BK.PTR +! ; | ||
| - | 11 \ Leave address of the previous line. | ||
| - | 12 : PR.ADR ( -- adr ) | ||
| - | 13 | ||
| - | 14 \ Increment pointer to previous line by n. | ||
| - | 15 : +PR.PTR ( n -- ) PR.PTR +! ; | ||
| - | |||
| - | |||
| - | Screen 20 not modified | ||
| - | 0 \ DELETE-1ST-LINE | ||
| - | 1 \ Delete first line in backup buffer and adjust pointer counts. | ||
| - | 2 : DELETE-1ST-LINE ( -- -- ) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 7 \ Leave a true flag if there is no room for string of size n. | ||
| - | 8 : NO-ROOM? | ||
| - | | ||
| - | 10 | ||
| - | 11 \ Delete lines till there is room for string of size n. | ||
| - | 12 : MAKE-ROOM ( n -- ) | ||
| - | 13 | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 21 not modified | ||
| - | 0 \ SAVE-LINE | ||
| - | | ||
| - | | ||
| - | 3 : RLFLAG? | ||
| - | | ||
| - | 5 \ Save current line in the backup buffer. | ||
| - | 6 : SAVE-LINE ( -- -- ) | ||
| - | | ||
| - | | ||
| - | | ||
| - | 10 TUCK BK.ADR 2+ SWAP CMOVE \ Move the line. | ||
| - | 11 | ||
| - | 12 | ||
| - | 13 | ||
| - | 14 ELSE DROP THEN ; | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 22 not modified | ||
| - | 0 \ < | ||
| - | 1 \ Decrement previous line pointer to start of the previous line. | ||
| - | 2 : < | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 8 \ Increment previous line pointer to start of the next line. | ||
| - | 9 : > | ||
| - | 10 | ||
| - | 11 IF BEGIN 1 +PR.PTR | ||
| - | 12 0= UNTIL \ line in bkup buf. | ||
| - | 13 | ||
| - | 14 | ||
| - | 15 IF PR.PTR OFF THEN ; \ If so point to bottom. | ||
| - | |||
| - | |||
| - | Screen 23 not modified | ||
| - | 0 \ RECALL-LINE | ||
| - | 1 \ Move previous line to the editing buffer. | ||
| - | 2 : RECALL-LINE ( -- -- ) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 9 \ Back up one line and move it to editing buffer. | ||
| - | 10 : -RECALL-LINE ( -- -- ) | ||
| - | 11 RLFLAG? IF <LINE THEN | ||
| - | 12 \ Move forward one line then move it to the editing buffer. | ||
| - | 13 : +RECALL-LINE ( -- -- ) | ||
| - | 14 RLFLAG? IF >LINE THEN RECALL-LINE ; | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 24 not modified | ||
| - | 0 \ Read screen location. | ||
| - | 1 ALSO | ||
| - | 2 CODE SC@ ( -- char ) | ||
| - | | ||
| - | | ||
| - | | ||
| - | 6 U>= IF 32 # AL MOV THEN | ||
| - | | ||
| - | 8 U< IF 32 # AL MOV THEN | ||
| - | | ||
| - | 10 : +MARK ( n -- ) | ||
| - | 11 CUR@ 0 ROT AT ATRIB @ SC@ | ||
| - | 12 112 ATRIB ! VEMIT ATRIB ! CUR! ; | ||
| - | 13 : -MARK ( n -- ) | ||
| - | 14 CUR@ 0 ROT AT SC@ VEMIT CUR! ; | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 25 not modified | ||
| - | 0 \ READ-SCREEN | ||
| - | | ||
| - | 2 : SINC SLINE @ 1+ 25 MOD SLINE ! ; | ||
| - | 3 : SDEC SLINE @ 24 + 25 MOD SLINE ! ; | ||
| - | | ||
| - | | ||
| - | | ||
| - | 7 \ Copy line n of screen into SLINE-BUF . | ||
| - | 8 : READ-SCREEN | ||
| - | | ||
| - | 10 80 0 DO I OVER AT SC@ | ||
| - | 11 SLINE-BUF I + C! | ||
| - | 12 LOOP DROP | ||
| - | 13 R> CUR! ; | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 26 not modified | ||
| - | 0 \ 09: | ||
| - | 1 \ Recall next line from screen. | ||
| - | 2 : +RECALL-SLINE | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 9 \ Recall previous line from screen. | ||
| - | 10 : -RECALL-SLINE ( -- -- ) | ||
| - | 11 NO-CURSOR | ||
| - | 12 SLINE @ -MARK SDEC SLINE @ DUP +MARK READ-SCREEN | ||
| - | 13 %BUF @ %MLEN @ BL FILL | ||
| - | 14 SLINE-BUF 79 -TRAILING %MLEN @ MIN %BUF @ SWAP CMOVE | ||
| - | 15 .LIN MEOL LITTLE-CURSOR ; | ||
| - | |||
| - | |||
| - | Screen 27 not modified | ||
| - | 0 \ F-WORD B-WORD | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 10 | ||
| - | 11 | ||
| - | 12 | ||
| - | 13 | ||
| - | 14 1 +.POS ; | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 28 not modified | ||
| - | 0 \ D-WORD | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 10 : PCKEY ( -- n flag ) | ||
| - | 11 | ||
| - | 12 ?DUP IF TRUE ELSE {KEY} FALSE THEN ; | ||
| - | 13 | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 29 not modified | ||
| - | 0 \ 14: | ||
| - | 1 \ Clear backup buffer. | ||
| - | 2 : CLR.BK.BUF ( -- -- ) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 10 DO I %BUF @ + C@ OVER = | ||
| - | 11 IF I !POS LEAVE THEN | ||
| - | 12 | ||
| - | 13 THEN DROP ; | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 30 not modified | ||
| - | 0 \ RET PCKEY 14: | ||
| - | 1 : DBOL ( -- -- ) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 8 : RET ( -- -- ) \ Finished, move to eol, set %DONE ON | ||
| - | | ||
| - | 10 | ||
| - | 11 | ||
| - | 12 | ||
| - | 13 | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 31 not modified | ||
| - | 0 \ CTRL.KEY | ||
| - | 1 : CTRL.KEY | ||
| - | | ||
| - | 3 CONTROL M OF RET | ||
| - | 4 CONTROL H OF RUB | ||
| - | 5 CONTROL L OF CLR | ||
| - | 6 CONTROL Q OF F-CHAR | ||
| - | 7 CONTROL S OF L-ARROW | ||
| - | 8 CONTROL T OF D-WORD | ||
| - | 9 CONTROL D OF R-ARROW | ||
| - | 10 CONTROL I OF 5 +.POS OVER-STRIKE | ||
| - | 11 CONTROL U OF DEALL | ||
| - | 12 27 OF DEALL | ||
| - | 13 CONTROL X OF DEOL ENDOF | ||
| - | 14 ( OTHERS ) ( BEEP ) | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 32 not modified | ||
| - | 0 \ FUNC.KEY | ||
| - | | ||
| - | 2 : FUNC.KEY | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 10 117 OF DEOL | ||
| - | 11 115 OF B-WORD | ||
| - | 12 132 OF CLR.BK.BUF | ||
| - | 13 ( OTHERS ) ( BEEP ) | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 33 not modified | ||
| - | 0 \ (LEDIT) | ||
| - | 1 \ Edit line of length len at address adr. If flag is true move | ||
| - | 2 \ to beginning of line, if false move to end of line. | ||
| - | 3 : (LEDIT) | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | 10 ELSE %MOD @ IF ICHAR ELSE ECHO THEN THEN | ||
| - | 11 ELSE FUNC.KEY | ||
| - | 12 %DONE @ UNTIL SAVE-LINE | ||
| - | 13 | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 34 not modified | ||
| - | 0 \ LEDIT < | ||
| - | 1 ALSO FORTH DEFINITIONS | ||
| - | | ||
| - | 3 \ Edit line of length n at adr. Begin by displaying string at | ||
| - | 4 \ adr and then sit cursor at end of string. | ||
| - | 5 : LEDIT ( adr n -- ) | ||
| - | | ||
| - | 7 \ As above, but put cursor at beginning of line. | ||
| - | 8 : <LEDIT ( adr n -- ) | ||
| - | | ||
| - | 10 | ||
| - | 11 : < | ||
| - | 12 2DUP BL FILL 2DUP <LEDIT -TRAILING | ||
| - | 13 | ||
| - | 14 DUP SPAN ! #OUT ! DROP SPACE ; | ||
| - | 15 | ||
| - | |||
| - | |||
| - | Screen 35 not modified | ||
| - | 0 \ NEW-EXP | ||
| - | 1 : NEW-EXP | ||
| - | | ||
| - | | ||
| - | 4 : OLD-EXP | ||
| - | | ||
| - | | ||
| - | 7 ONLY FORTH ALSO | ||
| - | | ||
| - | | ||
| - | 10 | ||
| - | 11 | ||
| - | 12 | ||
| - | 13 | ||
| - | 14 | ||
| - | 15 | ||
| - | |||
| - | </ | ||
papierkorb/ledit.blk.1755359401.txt.gz · Zuletzt geändert: 2025-08-16 17:50 von mka