Omega-TI Posted September 1, 2016 Share Posted September 1, 2016 PrescanIt! Yes! Now that you mention the name, that sound familiar. Now I just have to locate it. Sometimes, if you have not yet read it, I HIGHLY suggest you read "Watership Down" for some inspiration. One of my all time favorite books. Read about Hazel & Bigwig in that book in 7th grade. I bought it from the Scholastic Book Club. I remember it being a good read. Other than those two names mentioned, that is all I remember. Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted September 1, 2016 Share Posted September 1, 2016 (edited) Really cool, sometimes99er!!! Hoping for a new Rabbit Trail... One that has a bit of replay value. A challenge for you, Sinphaltimus... Write your own CALL CLEAR subprogram, and replace it in the following code chunk: 100 CALL CLEAR 110 PRINT "I CAN WRITE A NEW SUBPROGRAM!!" 120 END Replace CALL CLEAR with a SUB of your own design and call it CLR. Is it really this simple? 100 CALL CLR 110 PRINT "I CAN WRITE A NEW SUBPROGRAM!!" 120 END 130 SUB CLR::CALL CLEAR::SUBEND Also, sub/subend are excluded from the prescan. Gosub/return are not excluded from the prescan? In terms of subexit, there can be a condition set within a sub (if/then/else) that uses subexit to leave the sub without needing to hit the subend? For redundancy: This mock code is the same as the mock code that follows it? 10 blah blah blah 20 blah blah blah 30 gosub 100 40-90 blah blah blah 100 do this that and the other thing. 110 if the other thing=this then return else 120 120 if the the other thing = that then return 130 this=that 140 return ********************** 10 blah blah blah 20 blah blah blah 30 call mock 40-90 blah blah blah 100 sub mock 105 do this that and the other thing. 110 if the other thing=this then subexit else 120 120 if the the other thing = that then subexit 130 this=that 140 subend Edited September 1, 2016 by Sinphaltimus Quote Link to comment Share on other sites More sharing options...
+mizapf Posted September 1, 2016 Share Posted September 1, 2016 The good thing about subprograms is that their variables have local scope - unlike subroutines (GOSUB) whose variables have global scope. 1 Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted September 1, 2016 Share Posted September 1, 2016 Is it OK to call a subprogram from within another subprogram? Quote Link to comment Share on other sites More sharing options...
Opry99er Posted September 1, 2016 Share Posted September 1, 2016 It can be that simple, yes... But I was hoping you would write a routine that cleared the screen without using CALL CLEAR. Hint: You can do it in one multi-statement line using one loop and a graphics command. There are always more than one way to skin a cat, so try to find the fastest method!!! 1 Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted September 1, 2016 Share Posted September 1, 2016 It can be that simple, yes... But I was hoping you would write a routine that cleared the screen without using CALL CLEAR. Hint: You can do it in one multi-statement line using one loop and a graphics command. There are always more than one way to skin a cat, so try to find the fastest method!!! I know what you mean. Magelion has generated code that clears the screen in this way (using a call char). I guess I misunderstood the original challenge. Is my understanding correct (mock code examples) - I have so much rewriting to do but I have to stop because I do not know if it is OK to call one subprogram from within another. Quote Link to comment Share on other sites More sharing options...
Omega-TI Posted September 1, 2016 Share Posted September 1, 2016 You could go the simple route, use PRINT " " and keep executing the command on that line number up to 24, then exit the routine and reset the counter with something like COUNT=0 Quote Link to comment Share on other sites More sharing options...
Opry99er Posted September 1, 2016 Share Posted September 1, 2016 Actually I will. Epic book. When read as a child, it means one thing. When read as an adult, it takes on an entirely different meaning. You will never see rabbits the same way again, my friend. Quote Link to comment Share on other sites More sharing options...
Opry99er Posted September 1, 2016 Share Posted September 1, 2016 I know what you mean. Magelion has generated code that clears the screen in this way (using a call char). I guess I misunderstood the original challenge. Is my understanding correct (mock code examples) - I have so much rewriting to do but I have to stop because I do not know if it is OK to call one subprogram from within another. My fault for derailing the thread... Lets move this topic elsewhere. Quote Link to comment Share on other sites More sharing options...
+mizapf Posted September 2, 2016 Share Posted September 2, 2016 Is it OK to call a subprogram from within another subprogram? As far as I know, yes. This local scope feature is particularly interesting for MERGEing program parts because you need not care about variable names. That way I wrote a highscore list and glued it to some Extended Basic programs, for example, to Dive Bomber. Quote Link to comment Share on other sites More sharing options...
Omega-TI Posted September 2, 2016 Share Posted September 2, 2016 This is the easiest and most simple method that I've found, but I have to ask, why would a person NOT use call clear? 10 A=0 20 IF A>24 THEN 60 30 PRINT " " 40 A=A+1 50 GOTO 20 60 A=0 70 PRINT "SCREEN CLEARED" 80 END Quote Link to comment Share on other sites More sharing options...
marc.hull Posted September 2, 2016 Share Posted September 2, 2016 Is it OK to call a subprogram from within another subprogram? you can call subs from other subs no problem but you can do no recursion at all. sub a can call sub b which in turn can call sub c etc etc. But you cannot have sub a call sub b which then calls sub a nor can you have a sub call itself. It seems complicated but just remember before a sub can be called a second time, it's subend or subexit statement must have been executed. It's a neat programming concept but a lot limited in this fact. GOSUB allows recursion why not CALL SUBs ? 1 Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted September 2, 2016 Author Share Posted September 2, 2016 (edited) ... but I have to ask, why would a person NOT use call clear? As you demonstrate yourself, maybe one would like to have an effect while clearing and/or only clear part of the screen. Here are some swipe effect demos: Edited April 5, 2018 by sometimes99er Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted September 2, 2016 Author Share Posted September 2, 2016 GOSUB allows recursion why not CALL SUBs ? Yep, the error message is pretty specific: * RECURSIVE SUBPROGRAM CALL IN ... Some of the idea is that CALL SUBs can have local variables. Recursive calls could then have the need for an unspecified number of variables. And I think variables are allocated before running a program (prescan). I think this includes local variables too. Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted September 2, 2016 Share Posted September 2, 2016 Follow the rabbit. 1 Quote Link to comment Share on other sites More sharing options...
+mizapf Posted September 2, 2016 Share Posted September 2, 2016 OK, TIMT can now filter out the additional comments; it will only allow a BASIC line without line number when it starts with a ! or REM token and then discard it, hence it will be possible to paste listings with additional non-line comments. For the automatic uppercase translation I'd have to think a bit longer (or you simply stay with uppercase ). Works. You can now paste the program as you showed it at the start (without the "run", of course) into a file in a disk image. I found that all unquoted strings are uppercase... Well, not all. ... All except those in DATA lines ... grr. But this can be tested; my BASIC parser knows when a DATA line has started. 2 Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted September 3, 2016 Author Share Posted September 3, 2016 (edited) Neat, not bad for such tight code. Could you add a bunny? And here's your bunny ... Edited April 5, 2018 by sometimes99er 7 Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted September 3, 2016 Share Posted September 3, 2016 (edited) I can't seem to paste into js99er from my cell. Grrr. I wanna bunny! Ha ha, got it. Nice! Edited September 3, 2016 by Sinphaltimus 1 Quote Link to comment Share on other sites More sharing options...
Omega-TI Posted September 3, 2016 Share Posted September 3, 2016 And here's your bunny ... I love it! Thanks! 3 Quote Link to comment Share on other sites More sharing options...
Opry99er Posted September 4, 2016 Share Posted September 4, 2016 Slick... Very cool look you've got going there. 1 Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted September 4, 2016 Author Share Posted September 4, 2016 Slick... Very cool look you've got going there. Thanks. Bugs Bunny GBC/NES game graphics ripped there. Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted September 4, 2016 Author Share Posted September 4, 2016 I love it! Thanks! You're welcome. Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted September 13, 2016 Author Share Posted September 13, 2016 (edited) From the Tiny Toon Adventures. Here's a Sylvester demo, an old Daffy Duck demo and this 21 Carrots with Bugs Bunny (Classic99 seems to stay in CPU Overdrive when you include RUN in the paste) Edited September 13, 2016 by sometimes99er 5 Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted September 13, 2016 Share Posted September 13, 2016 Wow, great stuff. 1 Quote Link to comment Share on other sites More sharing options...
Tursi Posted September 13, 2016 Share Posted September 13, 2016 sometimes99er, on 13 Sept 2016 - 01:24 AM, said:(Classic99 seems to stay in CPU Overdrive when you include RUN in the paste) Hehe, that makes sense. Until the next call to KSCAN, it hasn't detected the end of the paste cycle (so the title bar should still say 'pasting'). I guess it's technically possible to detect being at the end, but I think I'll leave it like this since you've found a nice use case. 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.