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 > Starting BASIC programs from decompression routine
2004-09-10 09:39
Kabuto
Account closed

Registered: Sep 2004
Posts: 58
Starting BASIC programs from decompression routine

I've made just another packer for C64 :) it works fine with most machine code programs but not with BASIC programs.

In some other packer I've seen a sequence of 2*JSR and 1*JMP to the BASIC interpreter to set up some things but these don't work because my routine overwrites $0001-$0120 and $0300-$07FF so the BASIC interpreter reads unexpected values there and hangs.

Is there a simple way to restore information there without losing the BASIC program or control?
2004-09-10 10:53
Oswald

Registered: Apr 2002
Posts: 5094
check the kernal listings, find the basic reset subroutine..., also you must set some ptrs which point to the start end of the basic prg or smth like that.
2004-09-10 12:41
Graham
Account closed

Registered: Dec 2002
Posts: 990
you definitely need to initialize the zeropage and the vector tables. not only basic programs need them, also a lot of machine code programs use rom routines and they can heavily crash if some zeropage value is wrong. for example, clearing the screen with JSR $E544 etc.
2004-09-10 21:09
White Flame

Registered: Sep 2002
Posts: 136
Just copy $0000-$03ff out to $fb00 or something, and copy it back after the depack. I presume this is the code that you were looking at? It's what exomizer adds to the beginning of a compressed BASIC file, so that a jmp $0801 will run the BASIC program from ml.

0801: Entry00 lda#$1B
0803: sta $zTXTTAB (002B)
0805: lda#$08
0807: sta $002C
0809: lda#$F7
080B: sta $zVARTAB (002D)
080D: lda#$92
080F: sta $002E
0811: jsr $SA659 (A659)
0814: jsr $bLINKPRG (A533)
0817: jmp $bNEWSTT (A7AE)

081A: 00 43 50 01 00 43 50 B2 31 3A 57 41 B2 34 3A 46
082A: B2 34 3A 4D B2 34 30 3A 99 22 93 22 3B 00 8D 36
083A: 02 00 8D 36 35 37 3A 4F 42 24 28 38 33 29 B2 22
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
goerp/F4CG/HF
lA-sTYLe/Quantum
ΛΛdZ
Francesco Sblendorio
crayon/Hokuto Force
radius75
algorithm
Lord Crucifier/SCS*TRC
ciccior2003/HF
Guests online: 124
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 The Demo Coder  (9.6)
6 Edge of Disgrace  (9.6)
7 What Is The Matrix 2  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 X-Mas Demo 2024  (9.5)
7 Dawnfall V1.1  (9.5)
8 Rainbow Connection  (9.5)
9 Onscreen 5k  (9.5)
10 Morph  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Musicians
1 Rob Hubbard  (9.7)
2 Mutetus  (9.7)
3 Jeroen Tel  (9.7)
4 Linus  (9.6)
5 Stinsen  (9.6)

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