| |
Shadow Account closed
Registered: Apr 2002 Posts: 355 |
Can't the LOAD command be used in a basic program?
1 LOAD"ROUTINE",8,1
2 SYS 49152
RUN
Ends up in a endless loop, so I guess it doesn't do what I expect it to do...
(This may seem stupid, but it would be very handy for me when crossdeving for the DTV, as I need to load the files from 64HDD all the time, with this I could just do "run" to load the lastest routine from disk and execute) |
|
... 23 posts hidden. Click here to view all posts.... |
| |
insane
Registered: Nov 2006 Posts: 10 |
This works because loading a program "restarts" the basic-interpreter but not the variables. Anybody up for a more scientific explanation? |
| |
Devia
Registered: Oct 2004 Posts: 401 |
sounds about scientific enough..
on first run A=0, so BASIC will set A=1 and then load the proggy and restart the BASIC prog, but NOT reset the A var, so on second run A=1 and the THEN part will not be executed, thus jumping to line 2 to do the SYS
..now that just might sound even more confusing ,-)
|
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
Devia, you havent explained anything, just retold that was told already, and made yourself look really stupid. |
| |
WVL
Registered: Mar 2002 Posts: 902 |
oswald, you old grumpy bear you <3
|
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
:PPP right I am...
devia, I was ofcourse way too rude, just please dont explain one of the most simplest basic programs in the universe.
the key was that the program restarts, but there's no variable reset. An in depth ROM dissecting explanation on this would be welcome. |
| |
Devia
Registered: Oct 2004 Posts: 401 |
I was actually just trying to illustrate that no further "scientific" explanation was necessary. Thus the "confusion" note at the end of the post. - Still providing a more thorough explanation for the few people who might find it a bit illogical that a simple LOAD statement will actually "restart" the interpreter and maybe are having some problems grasping what that actually means for the provided example.
Guess I didn't account for the Oswald-factor, tho.
And no, you're not rude as I sort of called for it - Just grumpy and honest. :)
|
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
"with this I could just do "run" to load the lastest routine from disk and execute"
Does this imply that a new RUN actually resets all basic vars to 0?
I.e.
RUN => Reset vars and restart program
LOAD => Only restarts program
?
/Andreas |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
Jack, right. |
| |
WVL
Registered: Mar 2002 Posts: 902 |
Quote: "with this I could just do "run" to load the lastest routine from disk and execute"
Does this imply that a new RUN actually resets all basic vars to 0?
I.e.
RUN => Reset vars and restart program
LOAD => Only restarts program
?
/Andreas
yes. you can get around it with CONT i think.. (of maybe you had to use GOTO, can't remember) |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
I have coded a lot in basic, and I dont remember ever finding that cont does its job. It ended up always in "?cant continue". To go a bit off topic, you could do some nice tricks with basic. For example you could print new program lines on the screen, then fill the keyboard buffer with some 'returns'. Then put the cursor at the right place exit the program, and let the system and the 'returns' in the keybuffer add the new lines to your program, which were ended with a run 'linenumber'. ;) worked like a charm for generating DATA lines automagically. |
Previous - 1 | 2 | 3 | 4 - Next |