home *** CD-ROM | disk | FTP | other *** search
- [SCR.REC]
- [6.9.89]
- [G. Cisneros, 10.86, 8.89]
-
- [A screen editor under MS-DOS]
-
- {
-
- [*** Screen control subroutines using interrupt 16 ***]
-
- (0''CLpL'1'$r&S;) 0 [address of subr. 1 to PDL [CS:EP]]
-
- [mov di,(PX) push di mov 4[di],cx
- mov ax,[di] int 10H mov 6[di],dx
- mov bx,2[di] pop di ret
- mov cx,4[di] mov [di],ax
- mov dx,6[di] mov 2[di],bx ]
- (@0'C3065589044D89025D8905895F10CD5706558B044D8B025D8B058B0000BF'Hv
- pL'2'$r&S'C3'HvL) 1
-
- (@1;) 2 [initialize INT 10H subroutine]
-
- (pL@0uLS@1) 3 [do interrupt 10H given register block]
-
- (@3L;) 4 [interrupt and lift block]
-
- [only ah (top) & al (next) on the PDL]
- (pGm% [save function number (ah), make a byte]
- m%n [make a byte out of (al)]
- |0|0|0| [other registers have 0s]
- @3 [int 10h]
- pLn
- 15=um^^gmLLnn; [fn=15, return current display page & mode (top)]
- 8=gmLLn; [fn=8, return character at cursor]
- 3=4+,0&S; [fn=3, return block with cursor position]
- LLL;) 5
-
- [*** Chars to next tab stop ***]
- (pG8/L8&-;) 8
-
- [*** Home cursor ***]
- (0,2@5;) h
-
- [*** Scrolling primitives ***]
- {
- (%6,0m;) u [scroll up full screen, (top = # of lines)]
-
- (%7,0m;) d [scroll down full screen, (top = # of lines)]
-
- (256*m%7;) o [open lines (top: row; next: # of lines)]
-
- (256*m%6;) c [close lines (top: row; next: # of lines)]
-
- (256*mm [erase to eol: top = row #]
- 1792pG| [blank (fn 7, 0 lines) to attribute 7]
- 80n-lyG+| [upper left corner: next = # of blanks]
- n79+| [lower right corner: to last column]
- @4) b
-
- (256*m [top: starting row (& column 0)]
- pG256*lyG+79+ [next: # of lines -1 => ending row & column 79]
- m^%7%|1792|nn&||@4) e [clear a set of lines]
-
- (@@%|1792|n|'174F'H|@4;;)} s [scroll main]
-
- ((`);R3%=_;L;) * [panic exit]
-
- [*** Type on status line at column given by top ***]
- (@cm512,0|0|n%|24%|@4TLn@4;) S
-
- [*** Save current cursor position on PDL complement ***]
- (0,3@5pL512v^^0&Sm;) c
-
- [*** Move cursor to ([0],[1]) ***]
- (512,0|0|0$r(80=0pGpG0$S2$S1$r^1$S;;)%| [start block, get column]
- 1$rpG32767(N) [is row # negative?]
- ~'d'@s@h [yes, scroll down,]
- j2$rb<q2$SLj0@LJj0@l> [redraw,]
- 0pG1$S%|@t; [set cursor;]
- 24/0=%|@4; [no, position if <25]
- L^pG'u'@s24&-pG1$S%| [else scroll up,]
- pG@4Z<j0@LJj0@l>@t;q [redraw, position]
- ) C
-
- [*** Adjust block before setting cursor ***]
- (pL6+0$r%&S@4;) t
-
- [*** Bracket to end of line ***]
- [((80a;LZ;)q((d);10%EjL;A:)Y;) b]
-
- [*** Number of screen lines to end of current line ***]
- (j(10%U;Z;)qL0$r(9%Ez@8+:10%(E)A^:;)&Yj80/&L;) B
-
- [*** Adjust cursor and WS pointers when moving from line to line ***]
- (0$r=Jq2$SLz;9%EzpGm8/L8&-(lyG+pG0$rNnL;BjLnpG0$S;):10%(Ej)A^:pG0$S:) l
-
- [*** SP, CR, LF on short lines ***]
- (d' 'TLdL2573TL;;) +
-
- [*** Type a single line, expanding tabs ***]
- (80=0@+;9%Ez@8pG(d' 'TL:;)+:10%(Ej)ABQTLz^:80&-@+;) L
-
- [*** Redraw to the bottom of the screen ***]
- ((AB)L; [done if no more text]
- (d); [done if 24 lines out]
- j0@L [type out a single line]
- (10%Ez;;) [skip LF in WS]
- :;) R
-
- [*** Fill screen from WS start ***]
- (0'd'@s@h [clear window, home cursor]
- J(AB24@R;' 'TL8%TL;) [redraw 24 lines]
- Jj@h0pGpG0$S1$S2$S;) D [reset cursor and pointers]
-
- [*** To end of workspace ***]
- (@*(A); [no advance: we're there]
- BZ<q&L1920(N;>0) [more than a screenful to the end?]
- 0,0$r(80=^(AB0);10%EzL^0:9%Ez@8+:A^:L;) [no, count lines]
- Jj>pG20N(d@\:;)@d: [move cursor if less than 20 lines]
- LZz0,960m(B10%E^12=znL;ndm:L;)Z<@D>L1:) E
-
- [*** Find a string ***]
- ((4$r^^y0(=)G;L'Search string? '4@q''=)jV@v;;) V
-
- [*** Redraw after finding ***]
- (qLJ<Y0@E> [fake end of workspace]
- 0=1$rpG22NL; [stop if no lines left to draw and not on last row]
- LqLZ<j0$r@L>(10%Ez;;)23,1$r-@R@CY;) v
-
- [*** Replace a string ***]
- ((6$r0=0,4$r^^S;L;)
- (4$r^^y0(=)G;
- {(;)I (L'Search string? '4@q''(=)' Replacement? '5@qL1,6$S;)};)
- jU@v'Replace? (Yes/No/Rest/Cancel) '0@q
- ((pG\122NpG\97&N\32-%;;)
- 'Y'=@B4$r^^ypGmGED5$r^^ypGmGI(nnN@r;@e;)5$r^^r(d@>:;);
- 'N'=4$r^^r(d@>:;);
- 'C'=0,6$S;
- 'R'(=)LR:(@B4$r^^ypGmGED5$r^^ypGmGI(nnN@r;@e;)5$r^^r(d@>:;)4$r^^yGjU@v:;);)
- ;@I;) X
-
- [*** Query for a string or a character ***]
- (@cm
- " "
- 1@S512,0|0|'1801'H|@4TLn(0=n@4R;m(@j8%=:24%=:;)pGn$rPn@4;)@I;) q
-
- [*** Read a string ***]
- (R24%=24%;8%=8%;13%="";(pG\127&N;pG\31N;)9%(=9%)L:
- T@cnpL6+1G&L\76="";L
- @j8%=L8%T' 'TLTL: 24%=L8%T' 'TLTL24%;
- |;) j
-
- [*** Advance cursor one byte ***]
- (2$r
- (9%Ez0$r@8+0$S^; [tab]
- (10%E;(AB)L;0$r^80=;0$S^) [other]
- AL1$r^1$S0,0$S0;A;)
- 2$S @C;) >
-
- [*** Advance cursor one line ***]
- (qL0$r2$rpGbjZ<79,0$Sj0@l> [to end of line]
- (@>;2$S0$SYj) [try advancing one]
- L0$SLZ<j0@l>@C;;) \
-
- [*** Find start of this line, bracket last portion ***]
- (qL((B);10%Ez;:)qL&YjY
- <qL0(80=LqL0:9%Ez@8+:A^:;)0$SYq2$SLz>;) F
-
- [*** Retract cursor one byte ***]
- (Bj2$r1-,2$S
- (9%Ej(0$rd0$S;@F1$r1-,1$S;) [tab?]
- (@C0,8@5' '(=)L0$r^0$S; [yes, skip back]
- 0$r(d);pG8/L7=L;L0$S:);
- (10%Ej;0$rd0$S) [no, simple backspace]
- @F1$r1-,1$S;;) [which may back into previous line]
- @C;;) <
-
- [*** Retract cursor one line ***]
- (j2$rb(B)z;
- Aj0pGpG2$S$pGrmS@<npG0$rN0$Sj2$r(b;'bsp'@PL;)<j0@l>@C;L;) ^
-
- [*** Cursor to start of line ***]
- (j2$rbj0pGpG$S2$S@C;) g
-
- [*** Cursor to end of line ***]
- (@gZ<0(80=79Bj;9%E(pG71N@8+z;jJ><z;):10%(Ej)A^:;)0$SJq2$SLz>@C;) d
-
- [*** Text addition ***]
- (13%= [CR or LF]
- ((A)10%I' 'TL@>' 'TL8%TL; [WS end: insert LF]
- B10%Ej10%I@>1,1$r'o'@s@C' 'TL@C;
- j80,0$r-,1$r'b'@s [clean to EOL]
- 1$r23=1'u'@s0pG$S10%IzqL@CZ<j0@L>Y@C; [on last screen line]
- ^1$S@B10%Iz0pGpG$S2$S@BpGm
- (-,0=1,1$r'o'@s;L;)n@Z [open a line if needed]
- pGmqLm1$r'e'@s@C@K@C;); [rewrite]
-
- 10%Ej m0$r(lyG9%=@8pG(d' 'TL:;)+;TL^;)nI@> [addition at LF]
- (80=1,1$r'o'@s@C;L;)' 'TL@C;
-
- 9%= [HT]
- ((A)9%I0$r@8^(d' 'TL:;)L@>;B
- 3$r0=(9%Ej;@B1aD9%I@e;); [replace with HT]
- L@B9%I@e;); [insert HT]
-
- 3$r0= [replace]
- (9%E(0$r@8,1(=L)LL@B&1aDI&@r;); [replace HT]
- ABfBTL@>; [replace non HT]
- TI' 'TL@>;); [add at end]
-
- L [insert]
- (9%Ej(0$r@8,2&NLTI@>;L); [insert at HT]
- AB@B&I@e; [insert other]
- TI' 'TL@>;); [add at end]
-
- ) T
-
- [*** Type as many blanks as given on the PDL ***]
- [((pG8N;8-' 'TL:)(d' 'TL:;);) k]
-
- [*** Text removal ***]
- (j(A);B@B(10%E^;;)1aD@r;;) z
-
- [** erase to end of line ***]
- (j(A);B10%E;@B(10%U;Z;)D@r;) w
-
- [** erase line ***]
- (@g(A);B@B(10%V^;Z;)D@r;) u
-
- [*** Redraw after addition ***]
- (@BpGm&-qLm(0=;@Z0=;1$r^'o'@s;)
- @C@K@>;) e
-
- [*** Limit bottom row ***]
- (pG1$r+23N;d:) Z
-
- [*** Redraw after removal ***]
- (@BpGm-(pG32767N;~^;)qLm(0=;@Z0=;pGpG1$r^'c'@s24,1$r-&-,0$rm
- @xpG24&-,256*m512,0|0|n|@4@R;)
- @ClyGY@K@C;) r
-
- [*** Redraw current line ***]
- {(0=' 'TL8%TL;0,3@5pd+gmLLn\'b'@s;) +
- (Z<j0$r@L>nn@Z(10%EL;@R;)Yj;)} K
-
- [*** Skip screen lines ***]
- (dn(80=;9%Ez@8+:10%EzL;A^:Lm)0m:nL;) x
-
- [*** Show free space ***]
- (''wpL6+ymrn-#'===='|'Free: '&|5@SL;) f
-
- [*** Show file name (from var 29) ***]
- (29$r0=;yw('\'Fz:;)ZQ&w56@S;) A
-
- [*** Type status line ***]
- ("===================REC Workspace Screen Editor===File: ======================"
- 1@S@f@A@i;) I
-
- [*** Show insert status ***]
- (3$r(0='======';L'INSERT';)70@S;) i
-
- [*** Pause with a prompt on the status line ***]
- ('==========='5@S5@SR@f;) P
-
- [*** MAIN PROGRAM ***]
-
- (9(dpG$pGpGmrm0&S:;) [initialize variables 0-8]
- 1,3$S [start in insert mode]
- 62c0&Sml4$S [find string buffer]
- 62c0&Sml5$S [replacement string buffer]
- ['xyz'p|l|''w]
- (@2) [initialize INT 10H routines]
- 0,15@5&\8$S [get mode, save active page #]
- \pG7$S(7=7;L3;)0@5 [get mode, set 80x25 mode]
- 0,5@5 [set page 0]
-
- J(13%FD:;) [remove CRs]
- @D@I@f [write first screenful]
- 0,28$(pGr0=;a@v;L;)S [cursor at [28], if not 0]
-
- (R ((10%=;13%=;)13%;9%=9%;)@T@f: [LF, CR, HT]
- (pG\126NpG\32&N@T;)@f: [text]
- 200% = @^: [up arrow]
- 203% = @<: [left arrow]
- 205% = (@>;;): [right arrow]
- 208% = @\: [down arrow]
- 201% = 24(@*d@^:;): [Pg Up]
- 209% = 24(@*d@\:;): [Pg Dn]
- 199% = @D: [Home]
- 207% = 0@EL: [End]
- 187% = @V: [F1: find]
- 232% = 0,4$r^^S: [Alt F1: cancel find string]
- 188% = @X: [F2: replace]
- 233% = 0,6$S: [Alt F2: cancel replacement]
- 189% = @g: [F3: left margin]
- 190% = @d: [F4: right margin]
- 210% = 1,3$r-,3$S@i: [ins toggle]
- 211% = @z@f: [Delete]
- 8% = ((B);A@<@z;)@f: [BS]
- 24% = @u@f: [^X: erase line]
- 26% = @w@f: [^Z: erase to eol]
- 5% = ; [^E: exit]
- 22% = R@T@f: [^V: next char literal]
- 17% = ('Quit? (y/n)'@P('y'=;'Y'=;)JZD;); [^Q: quit]
- L:)
- 8$r5@5,7$r0@5 [reset original active page and mode]
- J(10%Fj13%IAA:;)J [restore CR before LF]
- [{(2573TL;)+(!TL@+''w!TL@+!TL@+p|l|!TL@+R(3%=_;L;)!TL;)}]
- nLnL9(dnnS:;) [restore variables]
- ;)
- }
- [end]