Login
Back to forumReply to this topicGo to last reply

Posted By

SVS
on 2009-06-17
02:20:14
 Autorun

I use a loader to load & run a prg, but the 2nd program does not start and cursor disappears.
The 2nd prg is located from $0332 to $8c00 instead of $1001... Anyhow the locations $1000, $1001, $1002 and following are filled with correct data of program to be run.
Anybody can help me?

Posted By

Csabo
on 2009-06-17
10:12:56
 Re: Autorun

You'll have to post the program itself for us to look at. I'm sure it can be debugged, but using only your description it's pretty tough.

Posted By

SVS
on 2009-06-18
02:45:43
 Re: Autorun

What I'm asking for is if somebody knows more info regarding the autorun process, once the booter prg has loaded another Basic prg.
In other hand, is there somewhere in the low RAM any location interested in this process? (this could be a good info for next issue of SVS-Ultimate map too).
Thank you

Posted By

Rachy
on 2009-06-18
06:49:25
 Re: Autorun

In most cases programs are overwriting some of the function redirection vectors at $03xx, pointing to their own code. This is only working if the program was loaded sequentially into the memory, because when the next byte fetching happens then the autoload code must be in the memory already.

For example you might load your autostart code from $0218 and overwrite eventually $031D with $02, the next character fetch is going to jump to $0218.
I am not sure this would exactly work, but the theory behind the autoload is similar. Probably different starting addres and/or vector must be used. I too old to remember the details, though.

Posted By

Csabo
on 2009-06-18
10:30:51
 Re: Autorun

Right, I've done this as well before. The vector I overwrite is $0302/$0303, and I point it to $0333. When this little PRG finishes loading, it automatically jumps to where that vector points. It works.

I'm still not sure what you're asking, SVS. No example?

Posted By

SVS
on 2009-06-20
14:31:50
 Re: Autorun

Thank you for yr. replies.
Even if Rachy and Csabo technics are very interested, the case of my problem is less sophisticated.

I simply want to use one feature of LOAD routine.
As you well know, when running of a Basic program (1st) does execute a LOAD statement, system starts the program (2nd) just loaded (I assume it jumps to RUN).
In my project I have a program (compressed by KNM CRUNCHER) that begins with a Basic statement located at $1001...
Well: if that program is manually loaded it can be executed (RUN); if it is loaded by another (any Basic loader) program, it does not (system hangs).

P.S. - I solved by changing compressor to JB PACKER: it works aswell and autostarts. But I'm curious about the behavior of KNM CRUNCHER.

Posted By

TLC
on 2009-06-20
14:47:11
 Re: Autorun

It might make use of some zeropage, stack, or system variable that is set up differently if the program is loaded in command mode and executed, or if it's loaded and executed by a basic program.

Alternatively, the basic "program" (the single basic line) of the depacker might be at fault, if it's somewhat flawed, but is still loaded and executed correctly in command mode.

Inspecting the depacker could answer that.

Posted By

AaronGale
on 2009-06-21
16:42:50
 Re: Autorun

I used to write little programs to hook into some system vectors for poking games. Looking on the cheats here I think Paperboy and Finders Keepers cheats were mine.

1 FOR I = 320 TO 349:READ A
2 S=S+A:POKE I,A:NEXT
3 IF S <> 3098 THEN PRINT "DATA ERROR"
4 SYS320:LOAD ""
5 DATA 120,169,77,141,18,3,169,1,141,19,3,88,96,169,234,141
6 DATA 64,42,141,65,42,141,237,25,141,238,25,76,66,206

This was the Paperboy one which I think hooked into the tape loader, maybe this could have been changed someway to execute a RUN once the LOAD had completed...

Thinking about it I don't think it would have worked though.

Posted By

Csabo
on 2009-06-22
10:31:19
 Re: Autorun

SVS, if it hangs, that should be simple to debug, thanks to the advanced debuggers built into the modern emulators. If you still have the buggy version, you should upload it or send it to me, I'll take a look when I have a spare few minutes.

Posted By

SVS
on 2009-06-23
03:35:53
 Re: Autorun

@Csabo: many thanks for the offer.
I don't have kept the KNM CRUNCHER version (bugged) but I can rebuild it as soon as I can. Then I'll send it to you.



Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024