Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Can't the LOAD command be used in a basic program?
2007-04-18 20:22
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)
2007-04-18 20:25
tlr

Registered: Sep 2003
Posts: 1762
Quote: 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)


Load will restart the program after loading. Do this:
1 IF A=0 THEN A=1:LOAD"ROUTINE",8,1
2 SYS 49152
RUN

2007-04-18 20:29
Shadow
Account closed

Registered: Apr 2002
Posts: 355
Works like a charm, thanks!
2007-04-18 21:04
Turtle
Account closed

Registered: Jan 2002
Posts: 70
I never understood why this works, but it does. Or at least I forgot it just like so many other things...
2007-04-18 21:53
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?
2007-04-19 07:03
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 ,-)
2007-04-19 07:29
Oswald

Registered: Apr 2002
Posts: 5076
Devia, you havent explained anything, just retold that was told already, and made yourself look really stupid.
2007-04-19 07:56
WVL

Registered: Mar 2002
Posts: 889
oswald, you old grumpy bear you <3

2007-04-19 08:01
Oswald

Registered: Apr 2002
Posts: 5076
: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.
2007-04-19 09:05
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. :)
2007-04-19 09:07
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
 
... 23 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 | 3 | 4 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Rock/Finnish Gold
A3/AFL
kbs/Pht/Lxt
chesser/Nigaz
instant
Guests online: 120
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Mojo  (9.6)
6 Uncensored  (9.6)
7 Wonderland XIV  (9.6)
8 Comaland 100%  (9.6)
9 No Bounds  (9.6)
10 Unboxed  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Party Elk 2  (9.6)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.6)
5 Rainbow Connection  (9.5)
6 It's More Fun to Com..  (9.5)
7 Morph  (9.5)
8 Dawnfall V1.1  (9.5)
9 Onscreen 5k  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Booze Design  (9.3)
2 Oxyron  (9.3)
3 Nostalgia  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.2)
Top Webmasters
1 Slaygon  (9.6)
2 Perff  (9.6)
3 Morpheus  (9.5)
4 Sabbi  (9.5)
5 CreaMD  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.042 sec.