Jump to content



0

Mister Batari sir, if you wouldn't mind, two requests please.


8 replies to this topic

#1 jbs30000 OFFLINE  

jbs30000

    Moonsweeper

  • 459 posts

Posted Fri May 2, 2008 3:50 PM

I hope I'm not bugging you by asking for two things in the next Kernel, but, and I could be wrong, I don't think that they should be that hard to implement. But if they are, or you just don't feel like doing them, that's fine too.

Both requests have to do with making functions.
The first is allowing multibank functions, or in other words something like:

function My_Function
<code>
return temp1 otherbank
end

My_Var=My_Function(3) bank2

Or something like that.

The second is being able to use them in on goto statements: on My_Function(3) goto 1 2 3 4.

Thank you.

#2 Gorf OFFLINE  

Gorf

    River Patroller

  • 4,633 posts

Posted Sat May 3, 2008 4:22 AM

View Postjbs30000, on Fri May 2, 2008 5:50 PM, said:

I hope I'm not bugging you by asking for two things in the next Kernel, but, and I could be wrong, I don't think that they should be that hard to implement. But if they are, or you just don't feel like doing them, that's fine too.

Both requests have to do with making functions.
The first is allowing multibank functions, or in other words something like:

function My_Function
<code>
return temp1 otherbank
end

My_Var=My_Function(3) bank2

Or something like that.

The second is being able to use them in on goto statements: on My_Function(3) goto 1 2 3 4.

Thank you.


Im pretty sure Im already doing this in batari. In fact Im doing this with gosub for Tempest.
I think I am anyway......tell me if this is what you are talking about.....

#3 Gorf OFFLINE  

Gorf

    River Patroller

  • 4,633 posts

Posted Sat May 3, 2008 4:24 AM

Here you go JBS.....I think this is what you mean.....this seems to work fine...if it is what you are asking.


on conduit goto cr0 cr1 cr2 cr3 cr4 cr5 cr6 cr7 cr8 cr9 cr10 cr11 cr12 cr13 cr14 cr15
return

cr0 goto ovalpos bank2
cr1 goto rectpos bank2
cr2 goto pluspos bank2
cr3 goto bowtiepos bank2
cr4 goto crosspos bank2
cr5 goto trngpos bank2
cr6 goto cloverpos bank2
cr7 goto veepos bank2
cr8 goto stepspos bank2
cr9 goto youpos bank2
cr10 goto flatpos bank2
cr11 goto heartpos bank2
cr12 goto starpos bank2
cr13 goto dubbaupos bank2
cr14 goto fanpos bank2
cr15 goto infinpos bank2
return

#4 jbs30000 OFFLINE  

jbs30000

    Moonsweeper

  • 459 posts

Posted Sat May 3, 2008 1:58 PM

Say I do this:
 function Test_Function
 temp1=rand+temp2
 return temp1
end
 on Test_Function(3) goto T1 T2 T3
T1

T2

T3
This is the output I get when I try to compile the program:
---------- Capture Output ----------
> "C:\Program Files\Atari2600\bB\2600bas.bat" C:\PROGRA~1\ATARI2~1\bB\samples\Test.bas
(5): Error: Unknown keyword: on

Compilation failed.

> Terminated with exit code 0.

#5 Fort Apocalypse OFFLINE  

Fort Apocalypse

    Stargunner

  • 1,593 posts

Posted Sun May 4, 2008 5:24 AM

View Postjbs30000, on Sat May 3, 2008 3:58 PM, said:

Say I do this:
 function Test_Function
 temp1=rand+temp2
 return temp1
end
 on Test_Function(3) goto T1 T2 T3
T1

T2

T3
This is the output I get when I try to compile the program:
---------- Capture Output ----------
> "C:\Program Files\Atari2600\bB\2600bas.bat" C:\PROGRA~1\ATARI2~1\bB\samples\Test.bas
(5): Error: Unknown keyword: on

Compilation failed.

> Terminated with exit code 0.

Try assigning the output/return value of the function to a variable first and it will compile:

 function Test_Function
 temp1=rand+temp2
 return temp1
end
 a = Test_Function(3)
 on a goto T1 T2 T3
T1

T2

T3


#6 jbs30000 OFFLINE  

jbs30000

    Moonsweeper

  • 459 posts

Posted Sun May 4, 2008 12:01 PM

View PostFort Apocalypse, on Sun May 4, 2008 5:24 AM, said:

Try assigning the output/return value of the function to a variable first and it will compile:

 function Test_Function
 temp1=rand+temp2
 return temp1
end
 a = Test_Function(3)
 on a goto T1 T2 T3
T1

T2

T3
Well yeah, there's always that. It's how I do things now. But being able to use a function directly would mean writing less code and might also free up a variable since you wouldn't need one to capture the output of a function.

But anyway, like I said, it's not a big deal if that feature isn't added to the next version of bB.

#7 Fort Apocalypse OFFLINE  

Fort Apocalypse

    Stargunner

  • 1,593 posts

Posted Sun May 4, 2008 12:43 PM

View Postjbs30000, on Sun May 4, 2008 2:01 PM, said:

View PostFort Apocalypse, on Sun May 4, 2008 5:24 AM, said:

Try assigning the output/return value of the function to a variable first and it will compile:

 function Test_Function
 temp1=rand+temp2
 return temp1
end
 a = Test_Function(3)
 on a goto T1 T2 T3
T1

T2

T3
Well yeah, there's always that. It's how I do things now. But being able to use a function directly would mean writing less code and might also free up a variable since you wouldn't need one to capture the output of a function.

But anyway, like I said, it's not a big deal if that feature isn't added to the next version of bB.

If you want to free up a variable, you could use a temp variable for it. the on goto functionality has to look somewhere for the value returned by the function, so whether bB hides that fact by setting the temp variable for you only saves you a line of source and if you use temp variables, for other things it may make things more confusing.

so as the revised example:

 function Test_Function
 temp1=rand+temp2
 return temp1
end
 temp5 = Test_Function(3)
 on temp5 goto T1 T2 T3
T1

T2

T3


#8 jbs30000 OFFLINE  

jbs30000

    Moonsweeper

  • 459 posts

Posted Mon May 5, 2008 12:04 AM

Fine, whatever. I didn't post this to be an argument. If my requests are included in the next release, then they're included. If they aren't, then they aren't.

#9 Fort Apocalypse OFFLINE  

Fort Apocalypse

    Stargunner

  • 1,593 posts

Posted Tue May 6, 2008 5:38 PM

View Postjbs30000, on Mon May 5, 2008 2:04 AM, said:

Fine, whatever. I didn't post this to be an argument. If my requests are included in the next release, then they're included. If they aren't, then they aren't.

Not arguing, just trying to help. I'm all for this functionality to be included in bB if Fred has time. Sorry I couldn't help.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users