Author Topic: Need help with my abcd program  (Read 7107 times)

0 Members and 1 Guest are viewing this topic.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Need help with my abcd program
« Reply #15 on: October 03, 2019, 08:03:43 am »
Hi TempodiBasic.

You are right. I analyzed the abcd file according to the policy described in the program, and concluded that the program with which the abcd file was created is faulty or the policy described in the program is invalid:

Filename: hello world-6.abcd

Code: [Select]

In start are values increased, star swap it to decrease and back


|$ee+++++++e++>                                          one "e" = * 1, two "ee" = * 10:  10 * 7(seven plus) + 1* 2 = 72. CHR$(72) = "H"
*+++>                                                   * star = decrease, so next character is CHR$(72) - 3 = 69 = "E"
*+++++++>>                                              * star = increase, so next character is 69 + 7 = 76 = "L", because is here ">>" so output is "LL"
+++>^JJJJJJsssssSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS/  next character is 76 + 3 = 79 = "O"



+++>*++++++>*++++++>*++++++++>+++++>$\                  next character is 79 + 3 = "R", 79 - 6 = 73 = "L", 73 + 6 = 79 = "R", 79 - 8 = 71 = "J", 71 - 5 = 66 = "E"

+++++++++>*++++++++>*+++>*++++++>++++++++>^  '66 - 9 = 55,  55 + 8 = 63, 63 - 3 = 60, 60 + 6 = 66, 66 + 8 = 74
                                                   (7),          (?),         (<),        (B),         (J)
jjjssssssssssssssssssssssssssssssssssssss/

Offline Larryrl

  • Newbie
  • Posts: 26
    • View Profile
Re: Need help with my abcd program
« Reply #16 on: October 03, 2019, 12:30:04 pm »
Hi TempodiBasic

Here is a new version of the interpretor and the hello world-1.abcd and the hello world-2.abcd. Both abcd's are needed to run. The first runs the 2nd one. Also, make sure to study the top of th source code as some commands have been changed. I decided to make a couple of the toggles into 2 seperate characters as it was too confusing even for me.    

Larry
« Last Edit: October 03, 2019, 12:32:58 pm by Larryrl »

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Need help with my abcd program
« Reply #17 on: October 03, 2019, 12:38:12 pm »
Hello World  abcd file for your previous version :)

* my.abcd (Filesize: 0.09 KB, Downloads: 175)

Offline Larryrl

  • Newbie
  • Posts: 26
    • View Profile
Re: Need help with my abcd program
« Reply #18 on: October 03, 2019, 01:58:47 pm »
I am also adding hello world-1 here as for Petr. You can use it with the newer version of the abcd.exe. Also for TempodiBasic the new version of hello world-4 which is the one with the jumps that actually works right and does not mis print the ascii code as it did before.
  

Happy Coding

Larry

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Need help with my abcd program
« Reply #19 on: October 03, 2019, 05:18:16 pm »
Hi Larryrl

in this evening I have spent some time to make a mod of your interpreter...
I have used my manner to program so you find a FUNCTION that counts the metacomands of moving the cursor of the interpreter

give a try to this mod version in which the original jJsS work well...

PS I REMark again... in the Hello World6.abcd  you must correct the output adding a space after World! So it is fine.
Code: QB64: [Select]
  1. ' ABCD interpr etor
  2. ' Coded by Larry R. Lowe in QB64 for windows 10
  3.  
  4. ' Original ABC Esoteric Programming language created by orange, a user from the esolang wiki at https://esolangs.org/wiki/ABC
  5. ' This interpretor is the original ABC programming language with different 1 single character commands, and a few extra ones thrown in
  6. ' This version has among other things a second independant accumulator, and choice blocks.
  7.  
  8. ' ! - Toggle remark mode on or off. When on everything between the first ! and the second ! is a comment
  9. ' # - runs the file specified between the % signs
  10. ' $ - Toggle ASCII output mode.  When on, the c instruction prints the first accumulator as an ASCII character, if it is >0 and <256.
  11. ' % - toggle the next filename to run block on or off
  12. ' & - Toggle the direction of the multiplication or division of the first accumulator.
  13. ' * - Toggle direction of first accumulator. When on, a + command decreases the first accumulatorm and when off a + command increases the first accumulator
  14. ' ; - Debug.  Prints out first accumulator as a number and ascii character.
  15. ' ? - Set first accumulator to a random number between 0 and first accumulator
  16. ' ^ - prints a space
  17. ' | - clear the screen
  18. ' + - Increase or decrease the value of the first accumulator
  19. ' < - Invert first accumulator
  20. ' > - Output the first accumulator
  21. ' 0 - Begin/ end choice0 block containing a file name to begin interpreting if 0 is pressed
  22. ' 1 - Begin/ end choice1 block containing a file name to begin interpreting if 1 is pressed
  23. ' 2 - Begin/ end choice2 block containing a file name to begin interpreting if 2 is pressed
  24. ' 3 - Begin/ end choice3 block containing a file name to begin interpreting if 3 is pressed
  25. ' 4 - Begin/ end choice4 block containing a file name to begin interpreting if 4 is pressed
  26. ' 5 - Begin/ end choice5 block containing a file name to begin interpreting if 5 is pressed
  27. ' 6 - Begin/ end choice6 block containing a file name to begin interpreting if 6 is pressed
  28. ' 7 - Begin/ end choice7 block containing a file name to begin interpreting if 7 is pressed
  29. ' 8 - Begin/ end choice8 block containing a file name to begin interpreting if 8 is pressed
  30. ' 9 - Begin/ end choice9 block containing a file name to begin interpreting if 9 is pressed
  31. ' a - Increase or decrease the value of the second accumulator
  32. ' b - Increrment the background color number by 1
  33. ' c - decrerment the background color number by 1
  34. ' d - multiply the second accumulator by 1, 5 or 10
  35. ' e - toggle the amount to increase or decrease the first accumulator by 1, 5 orf 10
  36. ' f - Increrment the foreground color number by 1
  37. ' g - decrerment the foreground color number by 1
  38. ' h - Toggle ASCII output mode.  When on, the c instruction prints the second accumulator as an ASCII character, if it is >0 and <256.
  39. ' i - Set second accumulator to a random number between 0 and second accumulator
  40. ' k - resets the foreground color to 0
  41. ' l - Loop back to the beginning of the program.  first accumulator and ASCII mode does not reset.
  42. ' m - resets the background color to 0
  43. ' n - prints a newline
  44. ' o - changes the foreground and background to the colors specified by the k, m, f, g, b and c commands
  45. ' p - Toggle direction of second accumulator. When on, an a command decreases the second accumulatorm and when off an a command increases the second accumulator
  46. ' r - Set first accumulator to 0
  47. ' t - Output the second accumulator
  48. ' u - Invert second accumulator
  49. ' v - Toggle the direction of the multiplication or division of the second accumulator. When off the x command multiplies the first accumulator by 1, 5 or 10, when on it divides it by 1, 5 or 10
  50. ' w - toggle the amount to increase or decrease the second accumulator by 1, 5 orf 10
  51. ' x - multiply the first accumulator by 1, 5 or 10
  52. ' z - Set second accumulator to 0
  53. ' H - Print Hello World
  54. ' ) - starts a cat block for use in writing a cat pgogram
  55. ' K - waits until ther user presses 0 througgh 9. It works with the above listed choice blocks. At least 1 choice block must be in the source code to use the K command.
  56. ' j - move the source code pointer up 1 line
  57. ' J - move the source code pointer down 1 line
  58. ' s - move the source code pointer left 1 character
  59. ' S - move the source code pointer right 1 character
  60. ' A -
  61. ' B -
  62. ' C -
  63. ' D -
  64. ' E -
  65. ' F -
  66. ' G -
  67. ' H -
  68. ' I -
  69. ' L -
  70. ' M -
  71. ' B -
  72. ' O -
  73. ' P -
  74. ' Q -
  75. ' q -
  76. ' R -
  77. ' T -
  78. ' U -
  79. ' V -
  80. ' W -
  81. ' X -
  82. ' Y -
  83.  
  84.  
  85. begin:
  86.  
  87.  
  88. ' Here we mak it full screen. If it looks like it is going to be unstable, or if it screws up, just remove these 2 lines
  89. '_FULLSCREEN
  90.  
  91.  
  92. DIM prog$(50000), a$(50000)
  93.  
  94. row = 1: col = 1
  95. fc = 7 ' foreground color variable
  96. bc = 0 ' bsackground color variable
  97. x = 0 ' index for an array to load in the prgoram 1 line at a time
  98. ln = 1 ' starting line of code to begin interpreting
  99. acc = 0 ' first accumulator variable
  100. acc2 = 0 ' second accumulator variable
  101. aom = 0 ' variable to hold first accumulator output mode
  102. aom2 = 0 ' variable to hold second accumulator output mode
  103. p = 1 ' variable to hold the number representing which character in the line we are interpreting
  104. plus = 1 ' variable to hold the amount added to or subtracted from the first accumulator
  105. plus2 = 1 ' variable to hold the amount added to or subtracted from the second accumulator
  106.  
  107. ad = 0 ' sets the first accumulator direction mode 0 =add 1 = subtract
  108. ad2 = 0 ' sets the second accumulator direction mode 0 =add 1 = subtract
  109. mul = 0
  110. mul2 = 0
  111. fm = 0
  112. lem = 0
  113. lem2 = 0
  114. c0 = 0
  115. c1 = 0
  116. c2 = 0
  117. c3 = 0
  118. c4 = 0
  119. c5 = 0
  120. c6 = 0
  121. c7 = 0
  122. c8 = 0
  123. c9 = 0
  124. cat = 0
  125.  
  126. ptjt = 0
  127. ltjt = 0
  128.  
  129. cm = 0 ' variable to hold the comment mode 0 = not the beginning of a comment 1 = beginning of comment
  130. 'The "!" toggles this cm variable
  131.  
  132. COLOR fc, bc: CLS
  133.  
  134. ' This routine is where we get the command line to determine if the user gave the interpretor a file name to work with.
  135.  
  136. filename$ = COMMAND$
  137.  
  138. filename$ = "hello world-6.abcd"
  139.  
  140. load:
  141.  
  142. ' here we load a systems file coded in ABCD itself, to tell the user that a file name is required on the command line.
  143. ' it is for that reason, you can't just click on the ABCD icon and expect to get results.
  144.  
  145. IF filename$ = "" THEN LOCATE 24, 1: PRINT "Usage abcd filename.abcd": END
  146.  
  147. ' We will open the file in sequential access mode and read it in one line at a time
  148.  
  149. OPEN filename$ FOR INPUT AS #1
  150.     x = x + 1
  151.     LINE INPUT #1, prog$(x)
  152.  
  153. tlns = x
  154. x = 1
  155.  
  156. ' now that we have the source code read into the computer's memory,
  157. ' we start at line 1 and we go from the beginning of it to the end of it
  158. ' one character at a time because all commands are single characters in length.
  159. ' We now parse each character so it does not matter if our source code is all
  160. ' on one line, or if it is broken up into many lines.
  161.  
  162.  
  163. parse:
  164.  
  165. m$ = MID$(prog$(ln), p, 1)
  166.  
  167.  
  168. ' Here we do what is necessary if we find a block.
  169. ' The !, @, 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9 characters
  170. ' are block commands. A block must contain one of these
  171. ' commands followed by the required information, and then
  172. ' end with the same command. A comment block starts and
  173. ' ends with the ! character. Everything between the two
  174. ' exclamation points is ignored by the interpretor as it
  175. ' is a comment.
  176.  
  177. IF cm = 1 AND m$ <> "!" THEN GOTO advance
  178. IF cm = 1 AND m$ = "!" THEN cm = 0: GOTO advance
  179.  
  180. IF fm = 0 AND m$ = "%" THEN fm = 1: GOTO advance
  181. IF fm = 1 AND m$ <> "%" THEN nfn$ = nfn$ + m$: GOTO advance
  182. IF fm = 1 AND m$ = "%" THEN fm = 0: GOTO advance
  183.  
  184.  
  185. IF c0 = 0 AND m$ = "0" THEN c1 = 1: GOTO advance
  186. IF c0 = 1 AND m$ <> "0" THEN choice0$ = choice0$ + m$: GOTO advance
  187. IF c0 = 1 AND m$ = "0" THEN c0 = 0: GOTO advance
  188.  
  189. IF c1 = 0 AND m$ = "1" THEN c1 = 1: GOTO advance
  190. IF c1 = 1 AND m$ <> "1" THEN choice1$ = choice1$ + m$: GOTO advance
  191. IF c1 = 1 AND m$ = "1" THEN c0 = 0: GOTO advance
  192.  
  193. IF c2 = 0 AND m$ = "2" THEN c2 = 1: GOTO advance
  194. IF c2 = 1 AND m$ <> "2" THEN choice2$ = choice2$ + m$: GOTO advance
  195. IF c2 = 1 AND m$ = "2" THEN c2 = 0: GOTO advance
  196.  
  197. IF c3 = 0 AND m$ = "3" THEN c3 = 1: GOTO advance
  198. IF c3 = 1 AND m$ <> "3" THEN choice3$ = choice3$ + m$: GOTO advance
  199. IF c3 = 1 AND m$ = "3" THEN c3 = 0: GOTO advance
  200.  
  201. IF c4 = 0 AND m$ = "4" THEN c4 = 1: GOTO advance
  202. IF c4 = 1 AND m$ <> "4" THEN choice4$ = choice4$ + m$: GOTO advance
  203. IF c4 = 1 AND m$ = "4" THEN c4 = 0: GOTO advance
  204.  
  205. IF c5 = 0 AND m$ = "5" THEN c5 = 1: GOTO advance
  206. IF c5 = 1 AND m$ <> "5" THEN choice5$ = choice5$ + m$: GOTO advance
  207. IF c5 = 1 AND m$ = "5" THEN c5 = 0: GOTO advance
  208.  
  209. IF c6 = 0 AND m$ = "6" THEN c6 = 1: GOTO advance
  210. IF c6 = 1 AND m$ <> "6" THEN choice6$ = choice6$ + m$: GOTO advance
  211. IF c6 = 1 AND m$ = "6" THEN c6 = 0: GOTO advance
  212.  
  213. IF c7 = 0 AND m$ = "7" THEN c7 = 1: GOTO advance
  214. IF c7 = 1 AND m$ <> "7" THEN choice7$ = choice7$ + m$: GOTO advance
  215. IF c7 = 1 AND m$ = "7" THEN c7 = 0: GOTO advance
  216.  
  217. IF c8 = 0 AND m$ = "8" THEN c8 = 1: GOTO advance
  218. IF c8 = 1 AND m$ <> "8" THEN choice8$ = choice8$ + m$: GOTO advance
  219. IF c8 = 1 AND m$ = "8" THEN c8 = 0: GOTO advance
  220.  
  221. IF c9 = 0 AND m$ = "9" THEN c9 = 1: GOTO advance
  222. IF c9 = 1 AND m$ <> "9" THEN choice9$ = choice9$ + m$: GOTO advance
  223. IF c9 = 1 AND m$ = "9" THEN c9 = 0: GOTO advance
  224.  
  225. IF cat = 0 AND m$ = ")" THEN cat = 1: cat$ = cat$ + m$: GOTO advance
  226. IF cat = 1 AND m$ <> ")" THEN cat$ = cat$ + m$: GOTO advance
  227. IF cat = 1 AND m$ = ")" THEN c9 = 0: cat$ = cat$ + m$: PRINT cat$;: GOTO advance
  228.  
  229.  
  230.  
  231.  
  232.  
  233.     CASE "$": aom = aom XOR 1
  234.  
  235.     CASE "(": lem = lem XOR 1
  236.  
  237.     CASE "h": aom2 = aom2 XOR 1
  238.  
  239.     CASE "*": ad = ad XOR 1
  240.  
  241.     CASE "&": mul = mul XOR 1
  242.  
  243.     CASE "v": mul2 = mul2 XOR 1
  244.  
  245.     CASE "p": ad2 = ad2 XOR 1
  246.  
  247.     CASE ";": PRINT STR$(acc); " "; CHR$(acc)
  248.  
  249.     CASE "+"
  250.         IF ad = 0 THEN
  251.             acc = acc + plus
  252.         ELSEIF ad = 1 THEN
  253.             acc = acc - plus
  254.         END IF
  255.  
  256.     CASE "x"
  257.         IF mul = 0 THEN
  258.             acc = acc * plus
  259.         ELSEIF mul = 1 THEN
  260.             acc = acc / plus
  261.         END IF
  262.  
  263.     CASE "a"
  264.         IF ad2 = 0 THEN
  265.             acc2 = acc2 + plus
  266.         ELSEIF ad2 = 1 THEN
  267.             acc2 = acc2 - plus
  268.             GOTO advance
  269.         END IF
  270.  
  271.     CASE "d"
  272.         IF mul2 = 0 THEN
  273.             acc2 = acc2 * plus2
  274.         ELSEIF mul2 = 1 THEN
  275.             acc2 = acc2 / plus2
  276.         END IF
  277.  
  278.     CASE ">"
  279.         IF aom = 0 THEN PRINT LTRIM$(STR$(acc));
  280.         IF aom = 1 THEN
  281.             IF acc = 0 OR acc > 255 THEN
  282.                 PRINT LTRIM$(STR$(acc));
  283.             ELSE
  284.                 PRINT CHR$(acc);
  285.             END IF
  286.         END IF
  287.  
  288.     CASE "u"
  289.  
  290.         IF aom2 = 0 THEN PRINT LTRIM$(STR$(acc2));
  291.         IF aom2 = 1 THEN PRINT LTRIM$(CHR$(acc2));
  292.         IF acc2 = 0 OR acc2 > 255 THEN
  293.             PRINT LTRIM$(STR$(acc2));
  294.         ELSE
  295.             PRINT CHR$(acc2);
  296.         END IF
  297.  
  298.     CASE "t"
  299.         IF LEN(STR$(acc)) <> 1 THEN
  300.             acc$ = STR$(acc): accl = LEN(acc$)
  301.             FOR i = accl TO 1 STEP -1
  302.                 tmp$ = tmp$ + MID$(acc$, i, 1)
  303.             NEXT i
  304.             acc = VAL(tmp$)
  305.         END IF
  306.  
  307.     CASE "<"
  308.         IF LEN(STR$(acc)) <> 1 THEN
  309.             acc$ = STR$(acc): accl = LEN(acc$)
  310.             FOR i = accl TO 1 STEP -1
  311.                 tmp$ = tmp$ + MID$(acc$, i, 1)
  312.             NEXT i
  313.             acc = VAL(tmp$)
  314.         END IF
  315.  
  316.  
  317.  
  318.  
  319.     CASE "e"
  320.         IF plus = 1 THEN
  321.             plus = 5
  322.         ELSEIF plus = 5 THEN
  323.             plus = 10
  324.         ELSEIF plus = 10 THEN
  325.             plus = 1
  326.         END IF
  327.  
  328.     CASE "w"
  329.         IF plus2 = 1 THEN
  330.             plus2 = 5: 'GOTO advance
  331.         ELSEIF plus2 = 5 THEN
  332.             plus2 = 10: 'GOTO advance
  333.         ELSEIF plus2 = 10 THEN
  334.             plus2 = 1: 'GOTO advance
  335.         END IF
  336.  
  337.     CASE "f": fc = fc + 1
  338.  
  339.     CASE "g": fc = fc - 1
  340.  
  341.     CASE "b": bc = bc + 1
  342.  
  343.     CASE "c": bc = bc - 1
  344.  
  345.     CASE "|": CLS
  346.  
  347.     CASE "k": fc = 0
  348.  
  349.     CASE "m": bc = 0
  350.  
  351.     CASE "l": ln = 1
  352.  
  353.     CASE "r": acc = 0
  354.  
  355.     CASE "z": acc2 = 0
  356.  
  357.     CASE "o"
  358.         IF fc > 0 AND bc > 0 THEN COLOR fc, bc
  359.         IF fc = 0 AND bc <> 0 THEN COLOR 7, bc
  360.  
  361.     CASE "?"
  362.         getnum:
  363.         RANDOMIZE TIMER
  364.  
  365.         ntg = INT(RND * acc)
  366.         IF ntg > acc THEN GOTO getnum
  367.  
  368.         IF lem = 1 AND ntg < 10 THEN GOTO getnum
  369.         acc = ntg
  370.  
  371.     CASE "i"
  372.         getnum2:
  373.         RANDOMIZE TIMER
  374.  
  375.         ntg2 = INT(RND * acc2)
  376.         IF ntg2 > acc2 THEN GOTO getnum2
  377.         IF lem2 = 1 AND ntg2 < 10 THEN GOTO getnum2
  378.         acc2 = ntg2
  379.  
  380.     CASE "n": PRINT " " ' print a newline
  381.  
  382.     CASE "~"
  383.         getnum3:
  384.         RANDOMIZE TIMER
  385.  
  386.         ntg = INT(RND * 9)
  387.         IF ntg < 0 THEN GOTO getnum3
  388.         IF ntg > 9 THEN GOTO getnum3
  389.         acc = ntg
  390.  
  391.     CASE "^": PRINT " ";
  392.  
  393.     CASE "!": cm = cm XOR 1
  394.  
  395.     CASE "%": fm = fm XOR 1
  396.  
  397.     CASE ""
  398.  
  399.     CASE "0": c0 = c0 XOR 1
  400.  
  401.     CASE "1": c1 = c1 XOR 1
  402.  
  403.     CASE "2": c2 = c2 XOR 1
  404.  
  405.     CASE "3": c3 = c3 XOR 1
  406.  
  407.     CASE "4": c4 = c4 XOR 1
  408.  
  409.     CASE "5": c5 = c5 XOR 1
  410.  
  411.     CASE "6": c6 = c6 XOR 1
  412.  
  413.     CASE "7": c7 = c7 XOR 1
  414.  
  415.     CASE "8": c8 = c8 XOR 1
  416.  
  417.     CASE "9": c9 = c9 XOR 1
  418.  
  419.     CASE ")": cat = cat XOR 1
  420.  
  421.         ' This is the routine where we wait for the user to press only the keys 0-9, nad thehn we load a new source code based on what they chose.
  422.         ' There must be at least one choice block in your code, otherwise the interpretor does not have any source code file to interpret at that
  423.         ' point and will crash.
  424.  
  425.     CASE "K"
  426.         DO
  427.             z$ = INKEY$
  428.             _LIMIT 30 'play nice with your CPU and other apps while waiting on the user to press their key
  429.         LOOP UNTIL z$ >= "0" AND z$ <= "9"
  430.         IF z$ = "0" THEN filename$ = choice0$
  431.         IF z$ = "1" THEN filename$ = choice1$
  432.         IF z$ = "2" THEN filename$ = choice2$
  433.         IF z$ = "3" THEN filename$ = choice3$
  434.         IF z$ = "4" THEN filename$ = choice4$
  435.         IF z$ = "5" THEN filename$ = choice5$
  436.         IF z$ = "6" THEN filename$ = choice6$
  437.         IF z$ = "7" THEN filename$ = choice7$
  438.         IF z$ = "8" THEN filename$ = choice8$
  439.         IF z$ = "9" THEN filename$ = choice9$
  440.         GOTO load
  441.  
  442.     CASE "H": PRINT "hello world";
  443.  
  444.  
  445.         ' go up a line of code
  446.     CASE "j", "J", "s", "S"
  447.         '    this is a cursor command
  448.         IF NOT MovingCursor(ln, p, prog$(ln), tlns) THEN PRINT "Error in move commands' line" ELSE GOTO parse
  449.  
  450.         ' IF ln = 1 THEN
  451.         ' GOTO advance2
  452.         ' END IF
  453.  
  454.         ' IF ptmt = 0 AND ltmt = 0 THEN
  455.         ' ptmt = p
  456.         ' ltmt = ln
  457.         ' END IF
  458.  
  459.  
  460.         '  ltmt = ltmt - 1
  461.  
  462.         ' go down a line of code
  463.  
  464.         '    CASE "J"
  465.         ' this is a cursor command
  466.  
  467.  
  468.         '  IF ln = tlns THEN
  469.         '  GOTO advance2
  470.         '  END IF
  471.  
  472.         ' IF ln = 50000 THEN
  473.         ' GOTO advance2
  474.         ' END IF
  475.  
  476.         ' IF ptmt = 0 AND ltmt = 0 THEN
  477.         '  ptmt = p
  478.         '  ltmt = ln
  479.         '  END IF
  480.  
  481.         '       ltmt = ltmt + 1
  482.  
  483.         ' go left one character within the current line
  484.         '  CASE "s"
  485.         ' this is a cursor command
  486.  
  487.  
  488.         '  IF p = 1 THEN
  489.         '  GOTO advance
  490.         '   END IF
  491.  
  492.         '  IF ptmt = 0 AND ltmt = 0 THEN
  493.         '  ptmt = p
  494.         '  ltmt = ln
  495.         '   END IF
  496.  
  497.         '  ptmt = ptmt - 1
  498.  
  499.         ' go right one character within the current line
  500.  
  501.         ' CASE "S"
  502.         ' this is a cursor command
  503.  
  504.  
  505.         ' IF p = LEN(prog$(ln)) THEN
  506.         ' GOTO advance
  507.         ' END IF
  508.  
  509.         ' IF ptmt = 0 AND ltmt = 0 THEN
  510.         '  ptmt = p
  511.         ' ltmt = ln
  512.         ' END IF
  513.  
  514.         ' ptmt = ptmt + 1
  515.  
  516.  
  517.     CASE "/"
  518.         p = ptmt
  519.         ln = ltmt
  520.         GOTO parse
  521.  
  522.  
  523.     CASE "\": END
  524.  
  525.     CASE ELSE ' This routine ignores everytthing else that is not a command and just moves on.
  526.  
  527.  
  528. ' The routines advance is where we move to the next character in the string that is the current line of code
  529. ' When we reach the end of the line, the advance2 routine moves to the next line and reset the position to the
  530. ' first character and start from there.
  531.  
  532. advance:
  533.  
  534. p = p + 1
  535. IF p >= LEN(prog$(ln)) + 1 THEN GOTO advance2
  536. GOTO parse
  537.  
  538. advance2:
  539. ln = ln + 1: p = 1
  540. IF ln = tlns + 1 AND nfn$ = "" THEN
  541.     END
  542.  
  543. IF ln = 50001 AND nfn$ = "" THEN END
  544.  
  545. IF ln = tlns + 1 AND nfn$ <> "" THEN
  546.     filename$ = nfn$: nfn$ = "": x = 0: p = 1: ln = 1: GOTO load
  547.  
  548. IF ln = 50001 AND nfn$ <> "" THEN
  549.     filename$ = nfn$: nfn$ = "": x = 0: p = 1: ln = 1: GOTO load
  550. GOTO parse
  551.  
  552. END ' this is only a logic end because the previouse line of code never arrives here!
  553.  
  554. FUNCTION MovingCursor (ln, p, LC$, TLines)
  555.     ' parser of cursor metacommand
  556.     MovingCursor = 0 ' no moving commands
  557.  
  558.     ' we preserve the value of parameters
  559.     cursor = p
  560.     lines = ln
  561.     Codex$ = LC$
  562.     lCursor = 0 'local cursor of line of moving commands
  563.  
  564.     'parsing the line of code for command of move cursor
  565.     DO
  566.         lCursor = lCursor + 1
  567.         MoveCursor$ = MID$(Codex$, lCursor, 1)
  568.         ' these commands don't let go out of range as showed in the main
  569.         ' so if you have the cursor at point 30 and you go back for 32 times
  570.         ' you'll be at position 1 of the line and not to the previous line of code
  571.         ' in the same manner for going up or down the lines of code
  572.  
  573.         SELECT CASE MoveCursor$
  574.             CASE "j" ' up
  575.                 IF lines > 1 THEN lines = lines - 1
  576.             CASE "J" 'down
  577.                 IF lines < 50000 AND lines < TLines THEN lines = lines + 1
  578.             CASE "s" 'left
  579.                 IF cursor > 1 THEN cursor = cursor - 1
  580.             CASE "S" 'right
  581.                 cursor = cursor + 1
  582.         END SELECT
  583.     LOOP WHILE INSTR("jJsS", MoveCursor$) AND lCursor <= LEN(Codex$)
  584.  
  585.  
  586.     ' we put back the value of cursor to execut normal commands
  587.     p = cursor
  588.     ln = lines
  589.     MovingCursor = -1 ' function has worked without error
  590.  

and here your sorgent
Code: [Select]
!This program prints hello and then jumps to another part of the program to print world then jumps back to print again!

|$ee+++++++e++>
*+++>
*+++++++>>
+++>^
JJJJsssssSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS

+++>*++++++>*++++++>*++++++++>+++++>$\
                                     
                                      ++++++++>*++++++++>*+++>*++++++>++++++++>
jjjssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss

Now I can take a look at your news
Programming isn't difficult, only it's  consuming time and coffee

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Need help with my abcd program
« Reply #20 on: October 03, 2019, 05:26:58 pm »
New version no code!

Ok compiler is secret!

with the absolute path into the .exe who have another path gets only errors!

Thanks to share, please no more exe for me.
Programming isn't difficult, only it's  consuming time and coffee