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 > Moving koala to different address (n00b)
2015-02-19 14:35
awsm

Registered: Feb 2015
Posts: 13
Moving koala to different address (n00b)

I'm having a hard time understanding why this doesn't work for me:

The code below loads a koala file to $2000. All fine.
But in combination with music (starting at $1000) I get the music messed up. I figured that the pic overwrites parts of the music (>4096 bytes). Any other starting address than $2000 fails however, showing just garbage (updated $d018 too, but it didn't do the trick).

PICTURE 		= $2000
VIDEO 			= PICTURE+$1f40 
COLOR 			= PICTURE+$2328 
BACKGROUND 		= PICTURE+$2710 

* = PICTURE
!binary "resources/mypic.kla",,2 

* = $c000

init_koala	 
			
			sei
			lda #$00 
			sta $d020 ; Border Color 
			lda BACKGROUND 
			sta $d021 ; Screen Color 

			; Transfer Video and Color 
			ldx #$00 

			; Transfers video data 
vloop	       	lda VIDEO,x 
			sta $0400,x 
			lda VIDEO+$100,x 
			sta $0500,x 
			lda VIDEO+$200,x 
			sta $0600,x 
			lda VIDEO+$2e8,x 
			sta $06e8,x 
			; Transfers color data 
			lda COLOR,x 
			sta $d800,x 
			lda COLOR+$100,x 
			sta $d900,x 
			lda COLOR+$200,x 
			sta $da00,x 
			lda COLOR+$2e8,x 
			sta $dae8,x 
			inx 
			bne vloop 
			; 
			; Bitmap Mode On 
			; 
			lda #$3b 
			sta $d011 
			; 
			; MultiColor On 
			; 
			lda #$d8 
			sta $d016 

			; When bitmap adress is $2000
			; Screen at $0400 
			; Value of $d018 is $18
			lda #$18
			sta $d018 

          	        jmp *
 
... 11 posts hidden. Click here to view all posts....
 
2015-02-19 15:16
Dr.j

Registered: Feb 2003
Posts: 277
i don't watch any problem with the view bitmap routine , so i believe something with the music clash your gfx. try to initialize the music player on the IRQ setup, and add irq to run(play) the music and take care for the $dd00 for choose banks, normally i do lda #$97 sta $dd00 to be on the safe side, so better also to make iniz. for vic/gfx registers at the start of your program. g'luck mate
2015-02-19 15:32
Bamse

Registered: Apr 2013
Posts: 7
@awsm: keep in mind that all bitmap-data needs to be within the 16kb memory block of the selected vic-bank. just use another bank (e.g. bitmap data under $d000) & don´t forget to change the "screen" from $0400 to somewhere within the newly selected vic-bank!
Check TNTs link for details...
2015-02-19 15:36
awsm

Registered: Feb 2015
Posts: 13
With the link and what Dr.j said I understand that the problem is that sound + graphic share the same bank and overlap. I can easily reproduce it: if I load music first, the image destroys parts of the music routine (music all weird), if I load the image first, the music overwrites the first chars on screen.
Music is played like Dr.j suggested btw.

So far so good.
Now the hard part of understanding what to do actually.
Do I load the image to one bank, display the pic, switch to another bank, load and play the music?

Thank you guys... this is literally day 3 after a 20 years 6502 asm coma ;)
2015-02-19 15:53
Dr.j

Registered: Feb 2003
Posts: 277
Im glad you are into it ;-) happy coding mate...
btw a little off topic: after you practice with code
and get back your skills , consider using KickAss with
a nice cross dev. editor (like Eclipse for instance) it could make your life easier and some strong capabilities
for coding asm6502. cheers!
2015-02-19 17:39
Count Zero

Registered: Jan 2003
Posts: 1932
You can play the music from $1000 without vic bank switching of course. So you may e.g. load the picture to $4000, align the values for vic display and play the music without problems at $1000. Or stick to your current settings and choose a shorter music :)
2015-02-19 18:39
SIDWAVE
Account closed

Registered: Apr 2002
Posts: 2238
just move the picture to another address, use your setup, and add the bytes as +$xxxx to the setup

if you move to 6000, standard koala place, then add $4000 to your setupcodes.

then change the vic bank and d018
2015-02-19 18:42
SIDWAVE
Account closed

Registered: Apr 2002
Posts: 2238
setup
;put this inside irq if used, else just do it
;KOALA PIC 2000
lda $dd00
and #%11111100
ora #%00000011 ;vic bank 3 (they go 3-2-1-0, so $6000 is #2)
sta $dd00
lda $d016
ora #$10
sta $d016
LDA #$19
STA $D018
lda #$3b
sta $d011
;------------------------------------


KOALASETUP

ldx #0
KOALARE
lda $3f40,x ;add +$4000 on these to setup for $6000
sta $0400,x
lda $4040,x
sta $0500,x
lda $4140,x
sta $0600,x
lda $4228,x
sta $06e8,x

lda $4328,x ;add +$4000 for these to setup at $6000
sta $d800,x
lda $4428,x
sta $d900,x
lda $4528,x
sta $da00,x
lda $4610,x
sta $dae8,x
dex
bne KOALARE

lda $4710
sta $d021
rts


;include koala pic from file
*=$2000
!BIN "graveyard.kla",, $02
2015-02-19 19:43
awsm

Registered: Feb 2015
Posts: 13
Great info and support from you guys! I'm impressed.
It might take me a while to understand (like, really understand) everything and try out the different approaches.
Until then, thank you!
I'll post again with the results...
2015-02-19 20:08
user

Registered: Mar 2011
Posts: 8
Another solution would be the relocating of the SID. There exists Sidreloc V1.0 which can move most SID's. But $1000 is perfect for SID's, because the VIC can only see the Charset ROM on this location.
The tool has other advantages too, you can see which Zero-Page adresses are used and other stuff.
2015-02-19 20:15
awsm

Registered: Feb 2015
Posts: 13
Oh yeah, I tried sidreloc, great tool. In the end it all comes down to me needing to understand the memory mapping better. Otherwise it's just trial and error.

I could easily have chosen a smaller tune, but I hate bailing out and problems like these are the perfect opportunity to learn.

I always thought coding is like playing adventures. In the beginning the puzzle pieces are overwhelming, but piece after piece you see the bigger picture - pure fun!
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
Alakran_64
MWR/Visdom
Durandal
Guests online: 98
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (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 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

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