| |
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.... |
| |
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. |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
graham: damn, I was blind :-/ |
| |
tlr
Registered: Sep 2003 Posts: 1790 |
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...
|
| |
MagerValp
Registered: Dec 2001 Posts: 1078 |
Good stuff, especially for us xfer system coders!
|
| |
Kaizen
Registered: May 2009 Posts: 24 |
Hi,
if I want to init only the screen editor leaving unchanged VIC registers, could I use JSR $E51B instead of JSR $FF5B os there are contraindications (e.g. Kernal modified or so...)?
THX. ;-) |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
how about copying the kernal routine to the ram below, and patching the vic reg writings ? |
| |
Kaizen
Registered: May 2009 Posts: 24 |
If I call $FF5B, and this address then will call $E518.
The first subroutine which get called at the address $E518 is the one that starts at $E5A0 and it's the one that sets the values of the VIC, but I want to bypass it.
So the idea is to do a direct call to the routine that stars right after $E51B.
But I've a doubt about the compatibility.
I don't that if I call directly the routine at $E51B could create problems in case of modified kernals (ie: speed dos or similiar, which I assume using a kernal ROM modified, so it could possible a system crash, in this case).
Or not?
THX. |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
it may be incompatible, but a stock rommed c64 is considered and used as the standard anyway, so I dont see it as a show stopper. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
from my experience, you almost always want to implement your own version of the reset routine. especially from a demo point of view the kernal routines suck hard.
(wtf, i read "cleaning up between demoparties" ... /o\) |
| |
Stainless Steel
Registered: Mar 2003 Posts: 966 |
Cleaning up after a demoparty must be a worse job than jizzmopper in a stripjoint :-) |
Previous - 1 | 2 | 3 - Next |