| |
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.... |
| |
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 |
| |
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... |
| |
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 ;) |
| |
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! |
| |
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 :) |
| |
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 |
| |
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 |
| |
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... |
| |
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. |
| |
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 |