Problems with moving VIC-20 sources

From: Ruud_at_Baltissen.org
Date: Sat, 29 Jun 2013 12:43:29 +0200
Message-ID: <51CEBA51.198.EFB82C@Ruud.Baltissen.org>
Hallo allemaal,


I ran into a weird problem. To be able to create a BASIC V7 version 
for the C65 and VIC-20, I first need a 'clean' source code. A clean 
source code is code without any hard coded pointers. My theory is 
that you can move clean code where ever you want without affecting 
the function. I more or less proofed that with 1541IDE: I needed 
room for my own code so I first removed all unneeded bytes, 
especially the 256 at the start(!), and the drive still worked 
fine. Compatibility is another thing: JiffyDOS and the FC3 
cartridge still ran fine but the KCS Power cartridge crashed.

I took the liberty of combing Lee Davison's well commented codes 
with my own ones. Lee gave all variables and labels names like 
LAB_xx and LAB_xxxx and I replaced them with more or less 
understandable names. In case of 'high bytes' I used code like 
'FileName+1' for example.

As said, if the code is clean, one can move it. I tried it for the 
C64 Kernal part by moving the last four unused bytes before the NMI 
vector to $E000. VICE started up fine. Did the same for the VIC-20, 
moved these bytes to $C000 and.... no cursor ???

To make a long story short: I found the problem spot but I have no 
idea how to go on further. The code can be found at $FE39:

;***************************************************************
;
; set 60Hz and enable timer

SetViaTimer:				;				[FE39]
	lda	#$C0			; enable T1 interrupt
 nop
 nop
	sta	VIA2_IER		; set VIA 2 IER
 nop
 nop

	lda	#$26			; set timer constant low byte [PAL]
;	LDA	#$89			; set timer constant low byte [NTSC]
	sta	VIA2_T1Cl		; set VIA 2 T1C_l

	lda	#$48			; set timer constant high byte [PAL]
;	LDA	#$42			; set timer constant high byte [NTSC]
	sta	VIA2_T1Ch		; set VIA 2 T1C_h

	rts

In this case there is no cursor. If I move one of the first two 
NOPs to the other two, thus getting this:

 nop
	sta	VIA2_IER		; set VIA 2 IER
 nop
 nop
 nop

then I have a cursor. And I have no idea at all why this strange 
behaviour.

In case you need the whole source:
http://www.baltissen.org/files/VIC20.asm
IMHO it is CA65 compatible. If not, please tell where I went wrong.

I hope somebody can solve this problem!


--
   
Kind regards / Met vriendelijke groet, Ruud Baltissen
www.Baltissen.org







       Message was sent through the cbm-hackers mailing list
Received on 2013-06-29 11:00:05

Archive generated by hypermail 2.2.0.