| |
Endurion
Registered: Mar 2007 Posts: 73 |
Music Inclusion, Request?
Hi,
this is my first post here.
I've just started to play with C64 assembly a few weeks ago and am working on my first game. It's no very technical sophisticated game so far but i'd really like to include some nifty music.
I'm working with ACME on Windows right now and included a goat tracker song for testing purposes. A working alpha can be downloaded from http://www.georg-rottensteiner.de/webmisc/joegunn-alpha.zip
It's an egypt tomb exploring game with some adventure elements. I'm looking for some egypt incluenced music.
Any hints on where i can find some for inclusion or better, anyone who wants to work with me on that one?
Thanks for any feedback and critics!
|
|
| |
maestro
Registered: Mar 2004 Posts: 727 |
try the intro music to recollection 2 magazine im sure that was egyptian like and very good |
| |
Endurion
Registered: Mar 2007 Posts: 73 |
Thanks, i'm taking a look. It sounds really grand.
|
| |
iAN CooG
Registered: May 2002 Posts: 3187 |
Cheers! The game looks very promising. Keep the good work.
/me just found a pharao statue. weeeee :)
-=[]=-- iAN CooG/HF --=[]=- |
| |
Deev
Registered: Feb 2002 Posts: 206 |
I can't help with the tune, but the game is pretty nice for a first effort. |
| |
Laxity
Registered: Aug 2005 Posts: 459 |
Nice going, if you just started doing 6510 assembler.. Cool!
I just couldn't make the actor jump forwards so I couldn't get past the spikes in the trench.. What a bugger :)
I'd be happy to help with music if you like and if it's not a rush thing. I love doing oriental stuff :) |
| |
Endurion
Registered: Mar 2007 Posts: 73 |
@Laxity: That would be awesome! You've done some great songs. It's no hurry as well, i've still got quite a few things to do for the game itself.
To jump left/right you need to first press the button and then push left/right. Two jump a bigger gap you need to stand on the ledge.
To examine something press button and down. To use an item press button and up, keep the button pressed and select the item. |
| |
Platoon Account closed
Registered: Mar 2004 Posts: 40 |
game looks pretty good but ive experienced some odd things i changes screens when i press joystick ?!? maybe its becoz i tryed it out in an emulator ?!?
looking forward to the finished game with some great lax egypt tune :D
|
| |
Endurion
Registered: Mar 2007 Posts: 73 |
Did you use Joystick Port I? I've put a level jumper on some keys.
Due to lack of a real C64 i develop on WinVICE. |
| |
Endurion
Registered: Mar 2007 Posts: 73 |
If that's ok i'll simply post a link to a forum thread on another forum where i update my progress on the game.
There's usually also a new version of the game to be found there. You can also see how the whole thing started out as a simple character change test.
I'll keep it updated there because the painters for the sprites and background are members there.
The link to the thread:
http://www.retroremakes.com/forum2/showthread.php?t=8759 |
| |
Oswald
Registered: Apr 2002 Posts: 5086 |
Endurion, if you have any questions you'd better ask them here. I've checked the forum and saw that you fought ammazingly basic problems :). Here a lot of ppl knows the c64 inside out, and outside in so just ask.
( ($xx),y indexing does add Y correctly when adressing, and multicolor char mode does not restrict you to 64 chars, substraction works only you need to SEC before, there's no other 'word' adressing than (),y and (,x)... ) |
| |
Endurion
Registered: Mar 2007 Posts: 73 |
Yeah, i thought so about the programming. The coding stuff is sorted that far. Most problems i encountered stemmed from mistakes i made before.
For the 64 chars i was referring to that weird two-colors per char in single color mode which does have that limit AFAIK.
But since you mentioned it, here goes a question :)
Right now i'm not using any IRQ code. Might there be problems if i add a music routine when i do cpu intensive things (like completely redisplaying a screen)? I assume the music player will always be IRQ based. |
| |
CreaMD
Registered: Dec 2001 Posts: 3053 |
Very good atmosphere! I like the game. |
| |
Oswald
Registered: Apr 2002 Posts: 5086 |
right, that weird mode (ECM) has only 64 chars :) (I thought you were talking about multicolor)
busy waiting for d012 is usually not a good practice. If your routine is slower then 1 frame then you will miss the rasterline and your music will stop playing.
here's how to set up your raster interrupt:
sei
lda #$35 ; make sure that IO regs at $dxxx
sta $01 ;are visible
lda #$7f ;disable cia #1 generating timer irqs
sta $dc0d ;which are used by the system to flash cursor, etc
lda #$01 ;tell VIC we want him generate raster irqs
sta $d01a
lda #$40 ;nr of rasterline we want our irq occur at
sta $d012
lda #$1b ;MSB of d011 is the MSB of the requested rasterline
sta $d011 ;as rastercounter goes from 0-312
lda #<irq ;set irq vector to point to our routine
sta $fffe
lda #>irq
sta $ffff
lda $dc0d ;acknowledge any pending cia timer interrupts
lda $dd0d ;this is just so we're 100% safe
cli
jmp *
irq pha
txa
pha
tya
pha ;store all the registers to stack
lsr $d019 ;acknowledge VIC irq
inc $d020 ;do something visible
ldx #$40
dex
bne *-1
dec $d02
pla
tay
pla
tax
pla ;restore registers from stack
rti ;ReTurn from Interrupt
|
| |
Endurion
Registered: Mar 2007 Posts: 73 |
Ah, thank you! I'll try that with the goat player i included for testing. |
| |
Endurion
Registered: Mar 2007 Posts: 73 |
The music works fine but i've got a problem:
As far as i have understood the IRQ setup will just interrupt my current process, work through the interrupt routine and return to the interrupted process.
Inside the interrupt routine i simply call the music player routine to update.
The title screen works but as soon as i enter my main game loop everything hangs. Might the wait for a frame loop be the cause?
GLOOP LDA $D012
CMP #$F0
BNE GLOOP
If so, what is the usual approach to have a frame based timer? I expect that some of my game frames will be too long so a frame will be skipped (screen change, text display, level rebuild)
The player routine itself worked with my game when i didn't use the IRQ setup.
Edit: A few tests show it's not the music player, if i use the code with the border color change it hangs as well. I've put some sprites in the area $d800 to $exxx, but they're below the I/O. Can they interfere?
Edit again: It looks like my level setup routine is the cause. In what ways might i interfere the IRQ?
Last Edit: Looks kinda solved. I had a level jumper built in which used the GETIN routine. If i skip that call it doesn't hang up.
Is there a way to have both working? Should i simply put SEI/CLI around the GETIN call? |
| |
Mace
Registered: May 2002 Posts: 1799 |
You need to give $01 the right value.
In Oswald's routine, he sets it to #$35.
The normal value (which gives Kernal access) is #$37.
So, just add that to the IRQ init. |
| |
Endurion
Registered: Mar 2007 Posts: 73 |
Hmm, put me on the right track. However using #$37 hangs the thing right away.
I surrounded the GETIN call with
lda #$37
sta $01
JSR $FFE4 ;GETIN
lda #$35
sta $01
Now it doesn't crash but i also don't receive key input.
|
| |
Mace
Registered: May 2002 Posts: 1799 |
Perhaps this is why:
Normally, the vectors at $fffe/$ffff are set to $ff48.
At $ff48, the registers are saved after which a JMP($0314) takes place (under conditions).
The vectors at $0314/$0315 by default are sending the computer to $ea31.
In the following piece after $ea31, there's a JSR$ea87, which does a keyboard scan.
When you do the IRQ like Oswald does, you bypass the entire kernal routines that scans the keyboard.
All $ffe4 does, is look in the keyboard buffer, but there will never be a keystroke in that buffer!
Instead of using $fffe and $ffff for the IRQ vectors, you could use $0314 en $0315.
You can then skip the saving of the registers to stack (this is taken care of in the kernal then) and you should replace the RTI with a JMP $ea31 (or $ea7b if you want to minimize the kernal part).
[edit]
The ROM disassembled |
| |
Endurion
Registered: Mar 2007 Posts: 73 |
Awesome, that fixed it! :)
Thanks to both of you, this forum is great. Now i have both seamless music and my precious cheat keys :)
Preciousssss, i tells ya. |
| |
AüMTRöN
Registered: Sep 2003 Posts: 44 |
Yes, I was also about reply that the key scan routines will be bypassed with the manual return from interrupt method (pla, tya etc...)
You could also ignore the Kernal completely and write your own routine to scan the keyboard matrix, but this is probably more hassle than it's worth in this instance.
And I'll stop here to avoid giving out bad infos :) Damn, I really need to code something, I'm damn rusty... :) |
| |
Endurion
Registered: Mar 2007 Posts: 73 |
Hey, i'm glad for any answer, as i get something to play with :)
I doubt that i would've gotten so far without forums. |
| |
Mace
Registered: May 2002 Posts: 1799 |
Well... after thinking it over once more; you could of course just include the code of or the JSR to the keyboard-scan subroutine in your own IRQ, without all the other stuff.
But hey... I think you're smart enough to find all the options yourself ;-) |
| |
Endurion
Registered: Mar 2007 Posts: 73 |
Ok, i've found the next problem :)
Due to my code size i wish to relocate the sound player routine. Previously it sat at $9000, now i want it to be at $a000.
Since this area is overshadowed by the basic ROM which i do not use (i think) i turned it off with
lda $01
and #$f8
sta $01
But it looks when i start copying to $a000 (the music weighs in at $aa0 bytes right now) everything hangs.
I suspect the copy routine, but it worked before with the old values. If i skip it everything works (but the music, duh).
Am i missing something?
Edit: To be sure, here's the copy routine:
CURADD, CURADD2 and CURADD3 are addresses residing in the zero page:
CURADD = $FB
CURADD2 = $FD
CURADD3 = $2F
prepare_sound_player
;remove the lowest three bits to show all RAM
lda $01
and #$f8
sta $01
lda #$00
sta CURADD2
lda #$a0
sta CURADD2+1
;lobyte size (not really used)
lda #$a0
sta CURADD
;highbyte size
lda #$0a
sta CURADD+1
lda #<goat_player
sta CURADD3
lda #>goat_player
sta CURADD3+1
ldy #0
copy_sound_loop
lda (CURADD3),y
sta (CURADD2),y
iny
bne copy_sound_loop
;256 bytes done
inc CURADD2+1
inc CURADD3+1
dec CURADD+1
bne copy_sound_loop
;copy rest
copy_sound_loop_b
lda (CURADD3),y
sta (CURADD2),y
iny
;lobyte groesse
cpy #$a0
bne copy_sound_loop_b
copy_sound_done
|
| |
Mace
Registered: May 2002 Posts: 1799 |
Have you done a SEI before changing register $01? |
| |
yago
Registered: May 2002 Posts: 333 |
You cant just copy a music-player, located at $9000, to $a000.
For examples, the first few lines of the music-player might be:
$9000 jmp $9107
$9003 jmp $9235
now, if you copy that code to $a000, it will still jump to $9107!!
you need to relocate the music, or just ask the musician to save it to a different address.
Have Fun,
Zed
|
| |
Hein
Registered: Apr 2004 Posts: 946 |
at the end, before leaving your transfer routine:
lda $01
ora #$07
sta $01 |
| |
Oswald
Registered: Apr 2002 Posts: 5086 |
you might fall back to my irq routine, as some1 pointed out, all you have to do is put $37 into $01 and call SCNKEY from the irq, then put $35 back. keeping $01 at $35 for the "main" program will make it possible to use all the ram under the code roms. It is even possiblee to use $34 which turns off all roms, AND turns on ram at the $d000-$e000 area. In case of $34 make sure to store the value of 01, and restore it at the end of the irq, so your code outside the irq may set 01 for itself.
yago is right, every piece of 6510 code is tied to the memory place it is assembled to, due to the heavy use of absolute adressing.
either you have to ask the musician to assemble the music to a new location.
or you may try with these ones:
http://noname.c64.org/csdb/search/?content=all&search=relocator..
if nothing is working I suggest opening a new topic here with the problem, and asking wether someone can recognize the player the music uses, and relocate it. |
| |
Oswald
Registered: Apr 2002 Posts: 5086 |
http://cadaver.homeftp.net/
click on rants, there you have lots of extremely well written tutorials about game programming on the c64. |
| |
Endurion
Registered: Mar 2007 Posts: 73 |
Whoa, lots of hints :)
Looks like SEI/CLI did the trick. So i need to disallow interrupts while switching the ROM/RAM flags.
@yago: Thanks, i had the routine relocated already. I'm copying the routine to the player location since i think you can't have more than one org commands inside a source code? Therefore the copy loop simply copies the music to the target routine (so i know where it's located at). Maybe later i don't have to do that if its still completely in "free" RAM.
I'm using sample songs of goat tracker; so i can simply have it relocate the player to a different address by exporting it.
I also had the error that i simply turned off ALL roms so the music player could not access the SID.
Everything works now, thanks guys! You're awesome! |
| |
Oswald
Registered: Apr 2002 Posts: 5086 |
You dont need to sei, only make sure the d000 area is not ram, but the chip registers. All irqs needs to acess either VIC or the CIA to acknowledge the irq, if the IRQ pending state is not cleared then you'll get another irq right after exiting from your current one. Kernal assumes that d000 is always on, dont fool it :) |