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 > cleaning up between demoparts
2005-08-06 15:58
H.O
Account closed

Registered: Oct 2002
Posts: 70
cleaning up between demoparts

One of favorite projects (or maybe not) -- I am currently trying to integrate some code made by others (basically, I am planning to do a release of some unreleased demo parts)

Problem is, one of the demo parts seems to be assuming a helluva lot of the c64. If I link the parts together, and do a soft reset I can start the last part with no problems.
But, if I have run some other demo part first, this part will just freeze up.

But, since I dont want anyone to have to use soft reset inside a demo, I want to clean up so that the final part works fine. Currently I am using the following calls:
	sei
	jsr $ff5b		; Initialize screen editor
	jsr $fda3		; Initialise I/O
	jsr $fd15		; Restore Kernal Vectors
	
	lda #$00
	ldx #$00
cleanme	
        sta $d800,x
	inx
	cpx #$28
	bne cleanme
	cli


Anything else that I can do? I am trying to avoid my worst case scenarios (which are releasing each part as they are as standalone applications, or rewriting most of the code that I didnt do; none af them are very appealing to me)

 
... 16 posts hidden. Click here to view all posts....
 
2005-08-07 21:08
tasche
Account closed

Registered: Apr 2004
Posts: 12
@honesty: do you have a non-moded rom? means, the posted routine is the same, as in your rom? coz if so, u must have the io-vectors in your ram, located from $fd30 to $fd50.
2005-08-07 21:16
Oswald

Registered: Apr 2002
Posts: 5076
taschentechno:

the rom at e000-ffff is called KERNAL. The name "kernal" has nothing to do with "kernel" it just sounds similar. Kernal can be looked at as the WHOLE OS of the c64.(or show me the core of the OS where it is ?) Then we got the basic rom at a000-c000.

"btw: this routine is 100% writing into the ram under the rom. regardless if c is set or not."

thats sure, but if C is not set then then it wont alter the information stored in the ram (lda (c3),y sta (c3),y). if c is set it will.
2005-08-07 21:52
tasche
Account closed

Registered: Apr 2004
Posts: 12
@oswald:

hmm... ok, but it seems, that i differ with you by the meaning of core-routines (:

back to the real problem:
i thought of using the routine by its jump-vector, as Tch posted. so there wouldn't be any requierment in thinking, if the io-vectors are set or not.
this routine just reminds me, when i used it years ago, i had this ram-writing problem and nearly got a headache, till i found this lousy bug. ^^
2005-08-08 00:17
Stryyker

Registered: Dec 2001
Posts: 466
If I have a really troubling piece of code I hand reset any needed vectors, fix the stack pointer, fix both CIAs and VIC II so the proper interrupts happen then test.
2005-08-08 05:06
midiland
Account closed

Registered: Nov 2004
Posts: 4
Just cheat....

Set the cartridge auto start at $8000 and then do a soft reset :D
2005-08-08 09:54
Graham
Account closed

Registered: Dec 2002
Posts: 990
@Oswald:

You're wrong, the LDA ($C3),Y STA ($C3),Y will read from ROM and write to RAM.
2005-08-08 16:03
Cruzer

Registered: Dec 2001
Posts: 1048
H.O: If you have access to the source code of the parts that won't work you could insert some "logging" to find out where it fails, e.g. by setting a byte somewhere in the memory to some different values at some different places in the code, and then look at which value it has when it crashes.
2005-08-08 18:01
Oswald

Registered: Apr 2002
Posts: 5076
graham: damn, I was blind :-/
2005-08-12 19:58
tlr

Registered: Sep 2003
Posts: 1762
How about the code below?
I pasted this together from my implemention in the Over5 code, so I haven't tested it and may have forgotten a line or two, but it should mostly work.
It will give you a fairly good idea of what gets initialized during startup.

; Do complete reset, load basic program, and then do RUN.
;
        sei
        cld
        ldx     #$ff
        txs
        jsr     $fda3   ;Init interrupts /d418=0

;*** $fd50 Init Memory Subst (to avoid the annoyingly slow memory test, and avoid trashing one byte at $a000) ***
        lda     #0
        tay
lp1:
        sta     $0002,y
        sta     $0200,y
        sta     $0300,y
        iny
        bne     lp1

        ldx     #$03
        lda     #$3c
        sta     $b2
        stx     $b3

        ldx     #$00
        ldy     #$a0
        jsr     $fd8c   ;Set MemBounds
;*** end $fd50 subst

;*** $fd15 Init Vectors subst (to avoid trashing of memory at $fd30) ***
        ldy     #$1f
lp2:
        lda     $fd30,y
        sta     $0314,y
        dey
        bpl     lp2
;*** end $fd15 subst
        jsr     $ff5b   ;Init video
        cli

;*** Init Basic! ***
        jsr     $e453   ;Init basicvectors
        jsr     $e3bf   ;Init basic zp + other stuff

; <---- HERE is probably enough initialization for most programs!

;* Set stack for basic *
        ldx     #$fb
        txs

;* Init I/O for basic
        jsr     $ffcc   ;CLRCH
        lda     #0
        sta     $13     ;Keyb input
        jsr     $ff90   ;Program mode

;* do "LOAD"
;* setup end address in $2d/$2e
        lda     #<end_of_prg
        ldx     #>end_of_prg
        sta     $2d
        stx     $2e
        jsr     $a68e   ;set pointers to program start
        jsr     $a533   ;relink basic program in memory

;* do "RUN"
        jsr     $a659   ;do run.
        jmp     $a7b1   ;Basic mainloop...
2005-08-14 09:21
MagerValp

Registered: Dec 2001
Posts: 1065
Good stuff, especially for us xfer system coders!
Previous - 1 | 2 | 3 - 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
REBEL 1/HF
cba
Harry/Alivers
WVL/Xenon
kbs/Pht/Lxt
Scrap/Genesis Project
Swallow/Censor Design
hedning/G★P
Acidchild/Padua
Guests online: 103
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 Performers  (9.3)
Top Original Suppliers
1 Derbyshire Ram  (9.7)
2 Fungus  (9.3)
3 Black Beard  (9.2)
4 Baracuda  (9.2)
5 hedning  (9.2)

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