sometimes99er Posted July 17, 2015 Share Posted July 17, 2015 This experimental apparatus monitors various types of events in your body and brain. Get latest version of Classic99. Choose TurboForth 1.2.1 by Mark Wills. Type, or copy and paste program listing. Enjoy. VARIABLE COL CREATE COLS 30 CHARS ALLOT : >COLS ( value offset -- ) COLS + C! ; : <COLS ( offset -- n ) COLS + C@ ; : CHART 1 GMODE 14 SCREEN 4 4 0 COLOR 5 1 0 COLOR DATA 8 $0000 $0400 $0000 $0000 $0000 $0400 $0000 $1F1F 32 DCHAR DATA 8 $0000 $0400 $1F1F $0000 $0000 $1F1F $0000 $0000 34 DCHAR DATA 4 $1F1F $0400 $0000 $0000 36 DCHAR DATA 8 $040E $1F04 $0404 $0C04 $0404 $1C04 $0404 $0C04 40 DCHAR DATA 8 $0404 $1F04 $0400 $0000 $0000 $FF44 $0400 $0000 42 DCHAR DATA 4 $0406 $FF46 $0400 $0000 44 DCHAR 40 0 V! 1 0 41 22 VCHAR 42 736 V! 23 1 43 30 HCHAR 44 767 V! 30 0 DO 30 I >COLS LOOP BEGIN 30 RND COL ! 1 COL @ 1+ 32 22 VCHAR 19 COL @ <COLS 2 >> - COL @ 1+ COL @ <COLS 3 AND 33 + 1 HCHAR 2 RND 0 = IF -1 ELSE 1 THEN COL @ <COLS + 63 AND COL @ >COLS AGAIN ; CHART 3 Quote Link to comment Share on other sites More sharing options...
Keatah Posted July 17, 2015 Share Posted July 17, 2015 Can you fix it so all the columns are used? The last column has no indicator. Quote Link to comment Share on other sites More sharing options...
Willsy Posted July 17, 2015 Share Posted July 17, 2015 Love it! Glad to see someone using TurboForth! Quote Link to comment Share on other sites More sharing options...
Willsy Posted July 17, 2015 Share Posted July 17, 2015 2 RND 0 = IF -1 ELSE 1 THEN TF has a word called 0= which you can use to replace the 0 = 2 RND 0= IF -1 ELSE 1 THEN Does exactly the same thing, but 0= is (probably) more than twice as fast as your code, which pushes 0 to the stack, then pops it off again with = 0= just does a direct comparison to tos (top of stack). Here's a description. Quote Link to comment Share on other sites More sharing options...
+Ksarul Posted July 17, 2015 Share Posted July 17, 2015 Nice! Quote Link to comment Share on other sites More sharing options...
Willsy Posted July 17, 2015 Share Posted July 17, 2015 Conventions: In Forth speak, <cols would be more correctly written as cols> If the > is before the word (example: >R ) then it's "to". So, >R is "to return stack" If the > is after the word (example R> ) then it's "from". So, R> is "from return stack" However, in the case of >cols and <cols in your above, I would name >cols as !cols and <cols as @cols respectively, because they are fetching and storing. If another Forther were reading your code, !cols and @cols would give him an immediate clue as to what is happening. Just friendly advice - nothing wrong with your code! Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted July 17, 2015 Author Share Posted July 17, 2015 Thanks everyone. Updated version: VARIABLE COL CREATE COLS 31 CHARS ALLOT : !COLS ( value offset -- ) COLS + C! ; : @COLS ( offset -- n ) COLS + C@ ; : CHART 1 GMODE 14 SCREEN 4 4 0 COLOR 5 1 0 COLOR DATA 8 $0000 $0400 $0000 $0000 $0000 $0400 $0000 $1F1F 32 DCHAR DATA 8 $0000 $0400 $1F1F $0000 $0000 $1F1F $0000 $0000 34 DCHAR DATA 4 $1F1F $0400 $0000 $0000 36 DCHAR DATA 8 $040E $1F04 $0404 $0C04 $0404 $1C04 $0404 $0C04 40 DCHAR DATA 8 $0404 $1F04 $0400 $0000 $0000 $FF44 $0400 $0000 42 DCHAR DATA 4 $0406 $FF46 $0400 $0000 44 DCHAR 40 0 V! 1 0 41 22 VCHAR 42 736 V! 23 1 43 30 HCHAR 44 767 V! 31 0 DO 31 I !COLS LOOP BEGIN 31 RND COL ! 1 COL @ 1+ 32 22 VCHAR 19 COL @ @COLS 2 >> - COL @ 1+ COL @ @COLS 3 AND 33 + 1 HCHAR 2 RND 0= IF -1 ELSE 1 THEN COL @ @COLS + 63 AND COL @ !COLS AGAIN ; CHART 1 Quote Link to comment Share on other sites More sharing options...
Keatah Posted July 18, 2015 Share Posted July 18, 2015 I'm going to use this to calculate ebay prices when I sell shit. 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.