Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!bloom-beacon!athena.mit.edu!hackeron From: hackeron@athena.mit.edu (Harris L Gilliam) Newsgroups: comp.sys.cbm Subject: Re: Loading machine language files. Message-ID: <5724@bloom-beacon.MIT.EDU> Date: 10 Jun 88 06:37:34 GMT References: <5449@ihlpg.ATT.COM> Sender: daemon@bloom-beacon.MIT.EDU Reply-To: hackeron@athena.mit.edu (Harris L Gilliam) Organization: Massachusetts Institute of Technology Lines: 53 In article <5449@ihlpg.ATT.COM> mnelson@ihlpg.ATT.COM (Nelson) writes: >I am writing a program that uses a ML routine at $C000. I know I have >seen programs that use LOAD statments to load other parts of the >program and then jumps off to them (boot programs, etc). However, >when I have the program try to load the ML routine it seems to loop on >that line, ei. it LED on the drive keeps going on and off. The >program is loaded because if I break and type in a RUN at the next >line the program will work fine. The code looks like this: > > 10 LOAD "ML PROG AT $C000",8,1 > 20 POKE THE CIA REGS > 30 OTHER BASIC STUFF > 40 END > >If I put a PRINT statement at line 20 it will never be hit. Even >putting multiple statements on line 10 doesn't work. The extra >statements never get hit. > >Does anyone out there know a trick to get this to work, or do I have >to load the ML through DATA statements? Is the $C000 location the >problem? > >Mike Nelson >ihnp4!ihlpg!mnelson > >AT&T Bell Labs Hi Mike, I think this will help. The problem is that the Commodore LOAD command when used from within a program causes the program to run again from the beginning without erasing the current variables. This was included so that basic progs could be chained. To solve the problem try this : 10 IF A=0 THEN A=1: LOAD "ML PROG AT $C000",8,1 20 POKE THE CIA REGS 30 OTHER BASIC STUFF 40 END This should work as A will equal 0 when first run then it will be set to 1 so that when the program re-executes the load will be skipped over. Harris | Harris L. Gilliam ()Internet : hackeron@athena.mit.edu | |4 Ames St. Cambridge MA 02139()UUCP {backbone..}!mit-eddie!athena!hackeron| +--------------------------------------------------------------------------+ * There are no bugs, only unrecognized features. *