DECLARE SUB ch ()\r
DECLARE SUB chkey (a$)\r
DECLARE SUB getkey (a$)\r
-DECLARE SUB conm (a$, c)\r
+DECLARE SUB conm (d$, c)\r
DECLARE SUB start ()\r
\r
DIM SHARED con$(1 TO 50)\r
IF ly < 20 THEN lyp = 1\r
IF ly > 180 THEN lyp = -1\r
IF lx < 30 THEN\r
-lxp = 1\r
-IF ly < y1 - 35 OR ly > y1 + 35 THEN SOUND 1000, 1\r
+ lxp = 1\r
+ IF ly < y1 - 35 OR ly > y1 + 35 THEN SOUND 1000, 1\r
+END IF\r
+IF lx > 290 THEN\r
+ lxp = -1\r
+ GOSUB 18\r
END IF\r
-IF lx > 290 THEN lxp = -1: GOSUB 18\r
-\r
\r
IF yp1 > 0 THEN y1 = y1 + 1: yp1 = yp1 - 1\r
IF yp1 < 0 THEN y1 = y1 - 1: yp1 = yp1 + 1\r
\r
SOUND 0, .1\r
GOTO 16\r
+\r
18\r
tlx = lx\r
tly = ly\r
tlyp = lyp\r
tlxp = lxp\r
\r
-\r
19\r
lx = lx + lxp\r
ly = ly + lyp\r
IF ly > 180 THEN lyp = -1\r
IF lx < 30 THEN lxp = 1\r
IF lx > 290 THEN\r
-yp2 = ly - y2\r
+ yp2 = ly - y2\r
ELSE\r
-GOTO 19\r
+ GOTO 19\r
END IF\r
\r
SWAP lx, tlx\r
b$ = ""\r
c$ = ""\r
FOR a = x1 TO x2\r
-b$ = b$ + " "\r
-c$ = c$ + "-"\r
+ b$ = b$ + " "\r
+ c$ = c$ + "-"\r
NEXT a\r
\r
b$ = "|" + b$ + "|"\r
LOCATE y2, x1\r
PRINT c$\r
FOR a = y1 + 1 TO y2 - 1\r
-LOCATE a, y1\r
-PRINT b$\r
+ LOCATE a, y1\r
+ PRINT b$\r
NEXT a\r
\r
-\r
END SUB\r
\r
SUB ch\r
SUB chkey (a$)\r
a$ = INKEY$\r
IF a$ <> "" THEN\r
-IF a$ = CHR$(0) + "M" THEN a$ = "pa"\r
-IF a$ = CHR$(0) + "K" THEN a$ = "va"\r
-IF a$ = CHR$(0) + "H" THEN a$ = "ul"\r
-IF a$ = CHR$(0) + "P" THEN a$ = "al"\r
-\r
-\r
+ IF a$ = CHR$(0) + "M" THEN a$ = "pa"\r
+ IF a$ = CHR$(0) + "K" THEN a$ = "va"\r
+ IF a$ = CHR$(0) + "H" THEN a$ = "ul"\r
+ IF a$ = CHR$(0) + "P" THEN a$ = "al"\r
END IF\r
+\r
END SUB\r
\r
SUB cmd (a$)\r
\r
SELECT CASE sona$(1)\r
CASE "help"\r
-title "help"\r
-conm "help - for help", 7\r
-conm "quit - quit program", 7\r
-conm "b - boss screen", 7\r
-conm "memstat- show info about memory blocks", 7\r
-conm "memput <addr> <data> - put data to specified memoy block", 7\r
-conm "memlist <addr> <amount> - show memory blocks, starting from <addr>", 7\r
-conm "runf <file.ext> - run script file", 7\r
-conm "lnstat - show info about memory lines", 7\r
-conm "lnput <line> <word> <data> <data> ... put data in <line> starting from <word>", 7\r
-conm "lnlist <addr> <amount> - show contenc of memory lines", 7\r
-conm "fstat - show info about memory files", 7\r
-conm "fput <file> <line> <word> <data> <data> ... put data in memory file", 7\r
-conm "fload <filename.ext> <file> <line> <word>- load data file into memory file", 7\r
-conm "cls - clear screen", 7\r
-conm "stclear <stack> - clear stack", 7\r
-conm "chklin <page> <from line> <to line> - determine used line numbers to STDOUT", 7\r
-conm "stacksize <stack> - determine stack size to STDOUT", 7\r
-conm "filtand <stack> <word> <mask> <word> <mask> ... filters out lines to STDOUT", 7\r
-conm "filtor <stack> <word> <mask> <word> <mask> ... filters out lines to STDOUT", 7\r
-conm "disp <stack> <word> <word> ... display formatted selected cells to STDOUT", 7\r
-conm "sort <stack> <word> - sort elements by <word> value, lower first", 7\r
-conm "swap <stack> - swap stack elements (backwards)", 7\r
-conm "ssort <stack> <word> - sort stack in alphabetical order", 7\r
-conm "memget <pointer> - allocates memory block, and puts there -", 7\r
-conm "liststack <stack> <from line> <to line> - show stack values to STDOUT", 7\r
-conm "ask <question> <file> <line> <word> - asks question, and stores result", 7\r
-conm "flnget <file> <pointer> - get unused line in file", 7\r
+ title "help"\r
+ conm "help - for help", 7\r
+ conm "quit - quit program", 7\r
+ conm "b - boss screen", 7\r
+ conm "memstat- show info about memory blocks", 7\r
+ conm "memput <addr> <data> - put data to specified memory block", 7\r
+ conm "memlist <addr> <amount> - show memory blocks, starting from <addr>", 7\r
+ conm "runf <file.ext> - run script file", 7\r
+ conm "lnstat - show info about memory lines", 7\r
+ conm "lnput <line> <word> <data> <data> ... put data in <line> starting from <word>", 7\r
+ conm "lnlist <addr> <amount> - show contenc of memory lines", 7\r
+ conm "fstat - show info about memory files", 7\r
+ conm "fput <file> <line> <word> <data> <data> ... put data in memory file", 7\r
+ conm "fload <filename.ext> <file> <line> <word>- load data file into memory file", 7\r
+ conm "cls - clear screen", 7\r
+ conm "stclear <stack> - clear stack", 7\r
+ conm "chklin <page> <from line> <to line> - determine used line numbers to STDOUT", 7\r
+ conm "stacksize <stack> - determine stack size to STDOUT", 7\r
+ conm "filtand <stack> <word> <mask> <word> <mask> ... filters out lines to STDOUT", 7\r
+ conm "filtor <stack> <word> <mask> <word> <mask> ... filters out lines to STDOUT", 7\r
+ conm "disp <stack> <word> <word> ... display formatted selected cells to STDOUT", 7\r
+ conm "sort <stack> <word> - sort elements by <word> value, lower first", 7\r
+ conm "swap <stack> - swap stack elements (backwards)", 7\r
+ conm "ssort <stack> <word> - sort stack in alphabetical order", 7\r
+ conm "memget <pointer> - allocates memory block, and puts there -", 7\r
+ conm "liststack <stack> <from line> <to line> - show stack values to STDOUT", 7\r
+ conm "ask <question> <file> <line> <word> - asks question, and stores result", 7\r
+ conm "flnget <file> <pointer> - get unused line in file", 7\r
GOTO 5\r
\r
CASE "quit"\r
c = 0\r
lng = 0\r
FOR b = 1 TO 5000\r
-IF bufu(b) > 0 THEN c = c + 1\r
-lng = lng + LEN(buf$(b))\r
+ IF bufu(b) > 0 THEN c = c + 1\r
+ lng = lng + LEN(buf$(b))\r
NEXT b\r
d$ = "memory blocks used:" + STR$(c) + " total 5000"\r
conm d$, 7\r
b = VAL(sona$(2))\r
strip sona$(3), c$\r
IF c$ = "" THEN\r
-bufu(b) = 0\r
-buf$(b) = ""\r
+ bufu(b) = 0\r
+ buf$(b) = ""\r
ELSE\r
-bufu(b) = 1\r
-buf$(b) = sona$(3)\r
+ bufu(b) = 1\r
+ buf$(b) = sona$(3)\r
END IF\r
GOTO 5\r
\r
IF c = 0 THEN c = 1\r
\r
FOR d = b TO 5000\r
-IF c = 0 THEN GOTO 5\r
-IF bufu(d) > 0 THEN\r
-e$ = cnum(d) + ":" + SPACE$(5 - LEN(cnum(d)))\r
-e$ = e$ + buf$(d)\r
-conm e$, 7\r
-c = c - 1\r
-END IF\r
+ IF c = 0 THEN GOTO 5\r
+ IF bufu(d) > 0 THEN\r
+ e$ = cnum(d) + ":" + SPACE$(5 - LEN(cnum(d)))\r
+ e$ = e$ + buf$(d)\r
+ conm e$, 7\r
+ c = c - 1\r
+ END IF\r
NEXT d\r
GOTO 5\r
\r
c = 0\r
d = 0\r
FOR b = 1 TO 1000\r
-IF buflu(b) > 0 THEN c = c + 1: d = d + buflu(b)\r
+ IF buflu(b) > 0 THEN c = c + 1: d = d + buflu(b)\r
NEXT b\r
d$ = "memory lines used:" + STR$(c) + " total 1000"\r
conm d$, 7\r
e = mitus\r
IF e < 4 THEN e = 4\r
FOR d = 4 TO e\r
-puts b, c + d - 4, sona$(d)\r
+ puts b, c + d - 4, sona$(d)\r
NEXT d\r
GOTO 5\r
\r
c = VAL(sona$(3))\r
\r
FOR d = b TO 1000\r
-IF c = 0 THEN GOTO 5\r
-IF buflu(d) > 0 THEN\r
-e$ = cnum(d) + ":"\r
-e$ = e$ + SPACE$(5 - LEN(e$))\r
-e$ = e$ + cnum(buflu(d))\r
-e$ = e$ + SPACE$(8 - LEN(e$))\r
-\r
-FOR g = 1 TO 10\r
-gets d, g, f$\r
-e$ = e$ + " >" + f$\r
-NEXT g\r
-conm e$, 7\r
-c = c - 1\r
-END IF\r
+ IF c = 0 THEN GOTO 5\r
+ IF buflu(d) > 0 THEN\r
+ e$ = cnum(d) + ":"\r
+ e$ = e$ + SPACE$(5 - LEN(e$))\r
+ e$ = e$ + cnum(buflu(d))\r
+ e$ = e$ + SPACE$(8 - LEN(e$))\r
+\r
+ FOR g = 1 TO 10\r
+ gets d, g, f$\r
+ e$ = e$ + " >" + f$\r
+ NEXT g\r
+ conm e$, 7\r
+ c = c - 1\r
+ END IF\r
NEXT d\r
GOTO 5\r
\r
CASE "fstat"\r
title "Memory files summary"\r
FOR b = 1 TO 30\r
- e = 0\r
- FOR c = 1 TO 1000\r
- IF buff(b, c) > -1 THEN\r
- IF e = 0 THEN\r
- d$ = "File number:" + STR$(b)\r
- conm d$, 7\r
- e = e + 1\r
- END IF\r
- d$ = "on line:" + STR$(c) + " allocated memory line: " + STR$(buff(b, c))\r
- conm d$, 7\r
- END IF\r
- NEXT c\r
+ e = 0\r
+ FOR c = 1 TO 1000\r
+ IF buff(b, c) > -1 THEN\r
+ IF e = 0 THEN\r
+ d$ = "File number:" + STR$(b)\r
+ conm d$, 7\r
+ e = e + 1\r
+ END IF\r
+ d$ = "on line:" + STR$(c) + " allocated memory line: " + STR$(buff(b, c))\r
+ conm d$, 7\r
+ END IF\r
+ NEXT c\r
NEXT b\r
GOTO 5\r
\r
f = mitus\r
IF f < 5 THEN f = 5\r
FOR e = 5 TO f\r
-putfs b, c, d + e - 5, sona$(e)\r
+ putfs b, c, d + e - 5, sona$(e)\r
NEXT e\r
GOTO 5\r
\r
CASE "cls"\r
FOR b = 1 TO 50\r
-conm " ", 7\r
+ conm " ", 7\r
NEXT b\r
GOTO 5\r
\r
IF d = 0 THEN d = 1000\r
\r
FOR e = c TO d\r
-IF buff(b, e) > 0 THEN std cnum(buff(b, e))\r
+ IF buff(b, e) > 0 THEN std cnum(buff(b, e))\r
NEXT e\r
GOTO 5\r
\r
CASE "filtor"\r
b = VAL(sona$(2))\r
FOR e = 1 TO stackl(b)\r
-FOR c = 3 TO mitus STEP 2\r
-gets stack(e, b), VAL(sona$(c)), f$\r
-cmp f$, sona$(c + 1), d\r
-IF d = 1 THEN\r
-std cnum(stack(e, b))\r
-GOTO 20\r
-END IF\r
-NEXT c\r
+ FOR c = 3 TO mitus STEP 2\r
+ gets stack(e, b), VAL(sona$(c)), f$\r
+ cmp f$, sona$(c + 1), d\r
+ IF d = 1 THEN\r
+ std cnum(stack(e, b))\r
+ GOTO 20\r
+ END IF\r
+ NEXT c\r
20\r
NEXT e\r
GOTO 5\r
DIM tmp2(1 TO 100)\r
\r
FOR d = 1 TO 100\r
-tmp2(d) = 0\r
+ tmp2(d) = 0\r
NEXT d\r
d = 0\r
\r
FOR e = 3 TO mitus\r
-d = d + 1\r
-tmp1(d) = VAL(sona$(e))\r
+ d = d + 1\r
+ tmp1(d) = VAL(sona$(e))\r
NEXT e\r
\r
FOR c = 1 TO stackl(b)\r
-FOR e = 1 TO d\r
-gets stack(c, b), tmp1(e), f$\r
-IF tmp2(e) < LEN(f$) THEN tmp2(e) = LEN(f$)\r
-NEXT e\r
+ FOR e = 1 TO d\r
+ gets stack(c, b), tmp1(e), f$\r
+ IF tmp2(e) < LEN(f$) THEN tmp2(e) = LEN(f$)\r
+ NEXT e\r
NEXT c\r
\r
FOR c = 1 TO stackl(b)\r
-g$ = ""\r
-FOR e = 1 TO d\r
-gets stack(c, b), tmp1(e), f$\r
-f$ = f$ + SPACE$(tmp2(e) - LEN(f$))\r
-g$ = g$ + f$ + " # "\r
-NEXT e\r
-conm g$, 10\r
+ g$ = ""\r
+ FOR e = 1 TO d\r
+ gets stack(c, b), tmp1(e), f$\r
+ f$ = f$ + SPACE$(tmp2(e) - LEN(f$))\r
+ g$ = g$ + f$ + " # "\r
+ NEXT e\r
+ conm g$, 10\r
NEXT c\r
\r
ERASE tmp2\r
CASE "filtand"\r
b = VAL(sona$(2))\r
FOR e = 1 TO stackl(b)\r
-FOR c = 3 TO mitus STEP 2\r
-gets stack(e, b), VAL(sona$(c)), f$\r
-cmp f$, sona$(c + 1), d\r
-IF d = 0 THEN GOTO 21\r
-NEXT c\r
-std cnum(stack(e, b))\r
+ FOR c = 3 TO mitus STEP 2\r
+ gets stack(e, b), VAL(sona$(c)), f$\r
+ cmp f$, sona$(c + 1), d\r
+ IF d = 0 THEN GOTO 21\r
+ NEXT c\r
+ std cnum(stack(e, b))\r
21\r
NEXT e\r
GOTO 5\r
b = VAL(sona$(2))\r
c = stackl(b)\r
FOR d = 1 TO c / 2\r
-SWAP stack(d, b), stack(c - d + 1, b)\r
+ SWAP stack(d, b), stack(c - d + 1, b)\r
NEXT d\r
GOTO 5\r
\r
IF c = 0 THEN c = 1\r
IF d = 0 THEN d = stackl(b)\r
FOR e = c TO d\r
-std cnum(stack(e, b))\r
+ std cnum(stack(e, b))\r
NEXT e\r
GOTO 5\r
\r
b = VAL(sona$(2))\r
c = VAL(sona$(3))\r
FOR d = 1 TO 1000\r
-IF buff(b, d) = -1 THEN\r
-stack(c, 10) = d\r
-IF stackl(10) < c THEN stackl(10) = c\r
-GOTO 24\r
-END IF\r
+ IF buff(b, d) = -1 THEN\r
+ stack(c, 10) = d\r
+ IF stackl(10) < c THEN stackl(10) = c\r
+ GOTO 24\r
+ END IF\r
NEXT d\r
24\r
GOTO 5\r
\r
END SELECT\r
\r
-\r
-\r
conm "Invalid command", 12\r
5\r
END SUB\r
\r
-SUB cmp (a$, b$, r)\r
-IF a$ = b$ THEN r = 1 ELSE r = 0\r
+SUB cmp (a$, b$, r%)\r
+IF a$ = b$ THEN r% = 1 ELSE r% = 0\r
END SUB\r
\r
FUNCTION cnum$ (a)\r
IF a$ = "va" THEN conx = conx - 1\r
IF a$ = "pa" THEN conx = conx + 1\r
IF a$ = "ul" THEN\r
-b$ = hist$(histk)\r
-histk = histk - 1\r
-IF histk < 1 THEN histk = 20\r
+ b$ = hist$(histk)\r
+ histk = histk - 1\r
+ IF histk < 1 THEN histk = 20\r
END IF\r
IF a$ = "al" THEN\r
-b$ = hist$(histk)\r
-histk = histk + 1\r
-IF histk > 20 THEN histk = 1\r
+ b$ = hist$(histk)\r
+ histk = histk + 1\r
+ IF histk > 20 THEN histk = 1\r
END IF\r
\r
-\r
-\r
IF LEN(a$) = 1 THEN\r
-IF a$ = CHR$(13) THEN\r
-strip b$, c$\r
-histp = histp + 1\r
-IF histp > 20 THEN histp = 1\r
-histk = histp\r
-hist$(histp) = c$\r
-cmd c$\r
-b$ = ""\r
-conx = 1\r
-GOTO 4\r
-END IF\r
+ IF a$ = CHR$(13) THEN\r
+ strip b$, c$\r
+ histp = histp + 1\r
+ IF histp > 20 THEN histp = 1\r
+ histk = histp\r
+ hist$(histp) = c$\r
+ cmd c$\r
+ b$ = ""\r
+ conx = 1\r
+ GOTO 4\r
+ END IF\r
\r
-IF a$ = CHR$(8) THEN\r
-IF conx > 1 THEN\r
-b$ = LEFT$(b$, conx - 2) + RIGHT$(b$, 81 - conx)\r
-conx = conx - 1\r
-END IF\r
-GOTO 4\r
-END IF\r
+ IF a$ = CHR$(8) THEN\r
+ IF conx > 1 THEN\r
+ b$ = LEFT$(b$, conx - 2) + RIGHT$(b$, 81 - conx)\r
+ conx = conx - 1\r
+ END IF\r
+ GOTO 4\r
+ END IF\r
\r
-b$ = LEFT$(b$, conx - 1) + a$ + RIGHT$(b$, 81 - conx)\r
-conx = conx + 1\r
+ b$ = LEFT$(b$, conx - 1) + a$ + RIGHT$(b$, 81 - conx)\r
+ conx = conx + 1\r
END IF\r
4\r
\r
-\r
IF conx < 1 THEN conx = 1\r
IF conx > 80 THEN conx = 80\r
\r
\r
14\r
IF LEN(a$) > 78 THEN\r
-b$ = LEFT$(a$, 78)\r
-conm b$, c\r
-a$ = " >> " + RIGHT$(a$, LEN(a$) - 78)\r
-GOTO 14\r
+ b$ = LEFT$(a$, 78)\r
+ conm b$, c\r
+ a$ = " >> " + RIGHT$(a$, LEN(a$) - 78)\r
+ GOTO 14\r
END IF\r
\r
-\r
b$ = a$ + SPACE$(80 - LEN(a$))\r
con$(50) = b$\r
conc(50) = c\r
\r
FOR a = 1 TO 49\r
-con$(a) = con$(a + 1)\r
-conc(a) = conc(a + 1)\r
+ con$(a) = con$(a + 1)\r
+ conc(a) = conc(a + 1)\r
NEXT a\r
\r
FOR a = 1 TO 49\r
-LOCATE a, 1\r
-COLOR conc(a), 0\r
-PRINT con$(a)\r
+ LOCATE a, 1\r
+ COLOR conc(a), 0\r
+ PRINT con$(a)\r
NEXT a\r
\r
END SUB\r
LINE INPUT #h, e$\r
\r
IF LEFT$(e$, 3) = "// " THEN\r
-conm e$, 10\r
-GOTO 12\r
+ conm e$, 10\r
+ GOTO 12\r
END IF\r
IF e$ = SPACE$(LEN(e$)) THEN GOTO 12\r
\r
h$ = ""\r
i = d\r
FOR f = 1 TO LEN(e$)\r
-g$ = RIGHT$(LEFT$(e$, f), 1)\r
-IF g$ = "|" THEN\r
- putfs b, j, i, h$\r
- h$ = ""\r
- g$ = ""\r
- i = i + 1\r
-END IF\r
-IF g$ = CHR$(9) THEN g$ = ""\r
-h$ = h$ + g$\r
+ g$ = RIGHT$(LEFT$(e$, f), 1)\r
+ IF g$ = "|" THEN\r
+ putfs b, j, i, h$\r
+ h$ = ""\r
+ g$ = ""\r
+ i = i + 1\r
+ END IF\r
+ IF g$ = CHR$(9) THEN g$ = ""\r
+ h$ = h$ + g$\r
NEXT f\r
\r
j = j + 1\r
13\r
CLOSE #h\r
\r
-\r
opf(h) = 0\r
\r
k$ = "file: " + a$ + " loaded." + STR$(l) + " lines in file"\r
\r
SUB getfil (a)\r
FOR b = 1 TO 30\r
-IF opf(b) = 0 THEN opf(b) = 1: a = b: GOTO 7\r
+ IF opf(b) = 0 THEN\r
+ opf(b) = 1\r
+ a = b\r
+ GOTO 7\r
+ END IF\r
NEXT b\r
7\r
END SUB\r
b = bufl(l, s)\r
\r
IF b = -1 THEN\r
-a$ = ""\r
+ a$ = ""\r
ELSE\r
-a$ = buf$(b)\r
+ a$ = buf$(b)\r
END IF\r
+\r
END SUB\r
\r
SUB mkson (a$)\r
\r
d = 1\r
FOR b = 1 TO LEN(a$)\r
-c$ = RIGHT$(LEFT$(a$, b), 1)\r
-IF c$ = " " THEN\r
-d = 1\r
-ELSE\r
-IF d = 1 THEN\r
-mitus = mitus + 1\r
-sona$(mitus) = ""\r
-d = 0\r
-END IF\r
-sona$(mitus) = sona$(mitus) + c$\r
-END IF\r
+ c$ = RIGHT$(LEFT$(a$, b), 1)\r
+ IF c$ = " " THEN\r
+ d = 1\r
+ ELSE\r
+ IF d = 1 THEN\r
+ mitus = mitus + 1\r
+ sona$(mitus) = ""\r
+ d = 0\r
+ END IF\r
+ sona$(mitus) = sona$(mitus) + c$\r
+ END IF\r
NEXT b\r
\r
'conm "sonad_______", 10\r
'NEXT b\r
\r
FOR a = 1 TO mitus\r
-IF LEFT$(sona$(a), 2) = "|>" THEN\r
-IF sona$(a + 1) = "c" THEN stdl = 1\r
-IF sona$(a + 1) = "s" THEN stdl = 10 + VAL(sona$(a + 2))\r
-mitus = a - 1\r
-GOTO 15\r
-END IF\r
-IF LEFT$(sona$(a), 2) = "|@" THEN\r
-sona$(a) = cnum(stack(VAL(RIGHT$(sona$(a), LEN(sona$(a)) - 2)), 10))\r
-END IF\r
+ IF LEFT$(sona$(a), 2) = "|>" THEN\r
+ IF sona$(a + 1) = "c" THEN stdl = 1\r
+ IF sona$(a + 1) = "s" THEN stdl = 10 + VAL(sona$(a + 2))\r
+ mitus = a - 1\r
+ GOTO 15\r
+ END IF\r
+ IF LEFT$(sona$(a), 2) = "|@" THEN\r
+ sona$(a) = cnum(stack(VAL(RIGHT$(sona$(a), LEN(sona$(a)) - 2)), 10))\r
+ END IF\r
NEXT a\r
\r
15\r
FOR a = mitus + 1 TO 20\r
-sona$(a) = ""\r
+ sona$(a) = ""\r
NEXT a\r
+\r
END SUB\r
\r
SUB putfs (f, l, s, c$)\r
la = buff(f, l)\r
\r
IF la = -1 THEN\r
-FOR a = 1 TO 1000\r
-IF buflu(a) = 0 THEN la = a: GOTO 10\r
-NEXT a\r
+ FOR a = 1 TO 1000\r
+ IF buflu(a) = 0 THEN\r
+ la = a\r
+ GOTO 10\r
+ END IF\r
+ NEXT a\r
10\r
END IF\r
\r
puts la, s, c$\r
-IF buflu(la) = 0 THEN buff(f, l) = -1 ELSE buff(f, l) = la\r
+IF buflu(la) = 0 THEN\r
+ buff(f, l) = -1\r
+ELSE\r
+ buff(f, l) = la\r
+END IF\r
END SUB\r
\r
SUB puts (l, s, a$)\r
b = bufl(l, s)\r
\r
IF b = -1 THEN\r
-'DIM SHARED buf$(1 TO 10000)\r
-'DIM SHARED bufu(1 TO 10000)\r
-FOR c = 1 TO 10000\r
-IF bufu(c) = 0 THEN GOTO 6\r
-NEXT c\r
+ FOR c = 1 TO 10000\r
+ IF bufu(c) = 0 THEN\r
+ GOTO 6\r
+ END IF\r
+ NEXT c\r
6\r
-b = c\r
-bufu(b) = 1\r
-buflu(l) = buflu(l) + 1\r
+ b = c\r
+ bufu(b) = 1\r
+ buflu(l) = buflu(l) + 1\r
END IF\r
\r
strip a$, c$\r
\r
IF c$ = "" THEN\r
-bufu(b) = 0\r
-buf$(b) = ""\r
-bufl(l, s) = -1\r
-buflu(l) = buflu(l) - 1\r
+ bufu(b) = 0\r
+ buf$(b) = ""\r
+ bufl(l, s) = -1\r
+ buflu(l) = buflu(l) - 1\r
ELSE\r
-buf$(b) = c$\r
-bufl(l, s) = b\r
+ buf$(b) = c$\r
+ bufl(l, s) = b\r
END IF\r
11\r
+\r
END SUB\r
\r
SUB runf (a$)\r
CLOSE #h\r
\r
opf(h) = 0\r
+\r
END SUB\r
\r
SUB sort (s, w)\r
b = stackl(s)\r
\r
FOR a = 1 TO b\r
-gets stack(a, s), w, c$\r
-tmp1(a) = VAL(c$)\r
-tmp2(a) = a\r
+ gets stack(a, s), w, c$\r
+ tmp1(a) = VAL(c$)\r
+ tmp2(a) = a\r
NEXT a\r
\r
d = 1\r
FOR a = 1 TO b\r
-e = 32000\r
-\r
-FOR c = d TO b\r
-IF tmp1(c) < e THEN e = tmp1(c): f = c\r
-NEXT c\r
-\r
-SWAP tmp1(a), tmp1(f)\r
-SWAP tmp2(a), tmp2(f)\r
-d = d + 1\r
+ e = 32000\r
+\r
+ FOR c = d TO b\r
+ IF tmp1(c) < e THEN\r
+ e = tmp1(c)\r
+ f = c\r
+ END IF\r
+ NEXT c\r
+ SWAP tmp1(a), tmp1(f)\r
+ SWAP tmp2(a), tmp2(f)\r
+ d = d + 1\r
NEXT a\r
\r
FOR a = 1 TO b\r
-stack(a, s) = tmp2(a)\r
+ stack(a, s) = tmp2(a)\r
NEXT a\r
\r
END SUB\r
DIM tbt$(1 TO 2000)\r
\r
FOR a = 1 TO stackl(s)\r
-gets stack(a, s), m, b$\r
-tbt$(a) = b$\r
-tbtp(a) = a\r
+ gets stack(a, s), m, b$\r
+ tbt$(a) = b$\r
+ tbtp(a) = a\r
NEXT a\r
\r
b = stackl(s)\r
22\r
NEXT c\r
\r
-tbti(a) = tbtp(e)\r
-tbt$(e) = tbt$(b)\r
-tbtp(e) = tbtp(b)\r
-b = b - 1\r
+ tbti(a) = tbtp(e)\r
+ tbt$(e) = tbt$(b)\r
+ tbtp(e) = tbtp(b)\r
+ b = b - 1\r
NEXT a\r
\r
FOR a = 1 TO stackl(s)\r
-stack(a, s) = tbti(a)\r
+ stack(a, s) = tbti(a)\r
NEXT a\r
\r
conm "done", 7\r
+\r
END SUB\r
\r
SUB start\r
conm "Copyright Svjatoslav Agejenko. All Rights Reserved.", 7\r
conm "starting...", 7\r
FOR a = 1 TO 5000\r
-bufu(a) = 0\r
-buf$(a) = ""\r
+ bufu(a) = 0\r
+ buf$(a) = ""\r
NEXT a\r
\r
FOR a = 1 TO 30\r
-FOR b = 1 TO 1000\r
-bufl(b, a) = -1\r
-buff(a, b) = -1\r
-NEXT b\r
-opf(a) = 0\r
+ FOR b = 1 TO 1000\r
+ bufl(b, a) = -1\r
+ buff(a, b) = -1\r
+ NEXT b\r
+ opf(a) = 0\r
NEXT a\r
\r
FOR a = 1 TO 1000\r
-buflu(a) = 0\r
+ buflu(a) = 0\r
NEXT a\r
\r
FOR a = 1 TO 10\r
-stackl(a) = 0\r
+ stackl(a) = 0\r
NEXT a\r
\r
-\r
a$ = "runf auto.scr"\r
FOR b = 1 TO LEN(a$)\r
-c$ = RIGHT$(LEFT$(a$, b), 1)\r
-conkey c$\r
+ c$ = RIGHT$(LEFT$(a$, b), 1)\r
+ conkey c$\r
NEXT b\r
conkey CHR$(13)\r
\r
\r
SELECT CASE stdl\r
CASE 1\r
-conm a$, 10\r
+ conm a$, 10\r
CASE 11 TO 20\r
-b = stdl - 10\r
-stackl(b) = stackl(b) + 1\r
-stack(stackl(b), b) = VAL(a$)\r
+ b = stdl - 10\r
+ stackl(b) = stackl(b) + 1\r
+ stack(stackl(b), b) = VAL(a$)\r
\r
-c$ = a$ + " > " + cnum(stackl(b)) + " ! " + cnum(b)\r
+ c$ = a$ + " > " + cnum(stackl(b)) + " ! " + cnum(b)\r
END SELECT\r
\r
-\r
-\r
-\r
END SUB\r
\r
SUB strip (a$, b$)\r
b$ = a$\r
2\r
-IF LEFT$(b$, 1) = " " THEN b$ = RIGHT$(b$, LEN(b$) - 1): GOTO 2\r
+IF LEFT$(b$, 1) = " " THEN\r
+ b$ = RIGHT$(b$, LEN(b$) - 1)\r
+ GOTO 2\r
+END IF\r
3\r
-IF RIGHT$(b$, 1) = " " THEN b$ = LEFT$(b$, LEN(b$) - 1): GOTO 3\r
+IF RIGHT$(b$, 1) = " " THEN\r
+ b$ = LEFT$(b$, LEN(b$) - 1)\r
+ GOTO 3\r
+END IF\r
+\r
END SUB\r
\r
SUB title (a$)\r
conm " ", 10\r
conm "================> " + a$ + " <===============", 7\r
\r
-\r
-\r
END SUB\r
+\r