Jump to content

Photo

19 Carrots of Gold

xb demo

52 replies to this topic

#26 --- Ω --- OFFLINE  

--- Ω ---

    Hexacorerunner

  • 13,924 posts
  • Location:82.102.25.76

Posted Thu Sep 1, 2016 3:11 PM

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.



#27 Sinphaltimus OFFLINE  

Sinphaltimus

    River Patroller

  • 2,521 posts
  • Distracted at the Keyboard
  • Location:Poconos, PA

Posted Thu Sep 1, 2016 3:58 PM

Really cool, sometimes99er!!! Hoping for a new Rabbit Trail... One that has a bit of replay value. :D


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. :D

 

 

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 by Sinphaltimus, Thu Sep 1, 2016 4:01 PM.


#28 mizapf OFFLINE  

mizapf

    River Patroller

  • 3,616 posts
  • Location:Germany

Posted Thu Sep 1, 2016 4:33 PM

The good thing about subprograms is that their variables have local scope - unlike subroutines (GOSUB) whose variables have global scope.



#29 Sinphaltimus OFFLINE  

Sinphaltimus

    River Patroller

  • 2,521 posts
  • Distracted at the Keyboard
  • Location:Poconos, PA

Posted Thu Sep 1, 2016 4:48 PM

Is it OK to call a subprogram from within another subprogram? 



#30 Opry99er OFFLINE  

Opry99er

    Quadrunner

  • 10,734 posts
  • Location:Hustisford, WI

Posted Thu Sep 1, 2016 4:48 PM

It can be that simple, yes... But I was hoping you would write a routine that cleared the screen without using CALL CLEAR. :D

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!!!

#31 Sinphaltimus OFFLINE  

Sinphaltimus

    River Patroller

  • 2,521 posts
  • Distracted at the Keyboard
  • Location:Poconos, PA

Posted Thu Sep 1, 2016 5:08 PM

It can be that simple, yes... But I was hoping you would write a routine that cleared the screen without using CALL CLEAR. :D

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.



#32 --- Ω --- OFFLINE  

--- Ω ---

    Hexacorerunner

  • 13,924 posts
  • Location:82.102.25.76

Posted Thu Sep 1, 2016 5:19 PM

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



#33 Opry99er OFFLINE  

Opry99er

    Quadrunner

  • 10,734 posts
  • Location:Hustisford, WI

Posted Thu Sep 1, 2016 5:25 PM

 
Actually I will. ;)
magician_pulling_a_rabbit_out_of_his_hat



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. :)

#34 Opry99er OFFLINE  

Opry99er

    Quadrunner

  • 10,734 posts
  • Location:Hustisford, WI

Posted Thu Sep 1, 2016 5:25 PM

 
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. :)

#35 mizapf OFFLINE  

mizapf

    River Patroller

  • 3,616 posts
  • Location:Germany

Posted Thu Sep 1, 2016 6:08 PM

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.



#36 --- Ω --- OFFLINE  

--- Ω ---

    Hexacorerunner

  • 13,924 posts
  • Location:82.102.25.76

Posted Thu Sep 1, 2016 7:26 PM

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


#37 marc.hull OFFLINE  

marc.hull

    Stargunner

  • 1,297 posts
  • Location:Oklahoma CIty.

Posted Thu Sep 1, 2016 7:27 PM

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 ?

#38 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • Topic Starter
  • 4,225 posts
  • Location:Denmark

Posted Thu Sep 1, 2016 9:45 PM

... 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:
 
8)

8)

8)

8)

Edited by sometimes99er, Wed Apr 4, 2018 10:14 PM.


#39 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • Topic Starter
  • 4,225 posts
  • Location:Denmark

Posted Fri Sep 2, 2016 12:56 AM

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.

:)

#40 Sinphaltimus OFFLINE  

Sinphaltimus

    River Patroller

  • 2,521 posts
  • Distracted at the Keyboard
  • Location:Poconos, PA

Posted Fri Sep 2, 2016 5:05 AM

Follow the rabbit.



#41 mizapf OFFLINE  

mizapf

    River Patroller

  • 3,616 posts
  • Location:Germany

Posted Fri Sep 2, 2016 6:21 AM

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.



#42 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • Topic Starter
  • 4,225 posts
  • Location:Denmark

Posted Sat Sep 3, 2016 6:30 AM

Neat, not bad for such tight code.  Could you add a bunny?

 
And here's your bunny ... ;)
 
8)

Edited by sometimes99er, Wed Apr 4, 2018 10:15 PM.


#43 Sinphaltimus OFFLINE  

Sinphaltimus

    River Patroller

  • 2,521 posts
  • Distracted at the Keyboard
  • Location:Poconos, PA

Posted Sat Sep 3, 2016 10:13 AM

I can't seem to paste into js99er from my cell. Grrr. I wanna bunny!

Ha ha, got it. Nice!

Edited by Sinphaltimus, Sat Sep 3, 2016 10:22 AM.


#44 --- Ω --- OFFLINE  

--- Ω ---

    Hexacorerunner

  • 13,924 posts
  • Location:82.102.25.76

Posted Sat Sep 3, 2016 5:02 PM

 

 
And here's your bunny ... ;)

 

I love it!  Thanks!

 

gallery_35324_1027_3725633.gif



#45 Opry99er OFFLINE  

Opry99er

    Quadrunner

  • 10,734 posts
  • Location:Hustisford, WI

Posted Sat Sep 3, 2016 11:31 PM

Slick... Very cool look you've got going there. :)

#46 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • Topic Starter
  • 4,225 posts
  • Location:Denmark

Posted Sun Sep 4, 2016 2:05 AM

Slick... Very cool look you've got going there. :)


Thanks. Bugs Bunny GBC/NES game graphics ripped there. :)

  

  

  



#47 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • Topic Starter
  • 4,225 posts
  • Location:Denmark

Posted Sun Sep 4, 2016 2:06 AM

I love it!  Thanks!


You're welcome. ;)



#48 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • Topic Starter
  • 4,225 posts
  • Location:Denmark

Posted Tue Sep 13, 2016 2:24 AM

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)  ;)

 

tinytoon.gif


Edited by sometimes99er, Tue Sep 13, 2016 2:26 AM.


#49 Sinphaltimus OFFLINE  

Sinphaltimus

    River Patroller

  • 2,521 posts
  • Distracted at the Keyboard
  • Location:Poconos, PA

Posted Tue Sep 13, 2016 3:43 AM

Wow, great stuff.

#50 Tursi OFFLINE  

Tursi

    Quadrunner

  • 5,638 posts
  • HarmlessLion
  • Location:BUR

Posted Tue Sep 13, 2016 7:21 AM

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. ;)







Also tagged with one or more of these keywords: xb, demo

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users