Jump to content
IGNORED

Porting the original classic Castlevania to the 2600


grafixbmp

Recommended Posts

Wow, this might be the most ambitious homebrew ever!

 

Let me know if you need help with the music. I wrote a program can somewhat reliably convert MIDI to TIA.

 

THat sounds nice. Would love to know more about it. All help is welcome.

 

 

SWEET!

Link to comment
Share on other sites

To stir the music pot a bit, here's a TIA version of the opening tune:

 

castlevania_openingtune_07.bascastlevania_openingtune_07.bas.bin

 

And just for laughs, here's a version with the harmony note crudely added:

 

castlevania_openingtune_08.bascastlevania_openingtune_08.bas.bin

 

All this is thanks to Random Terrain's extremely useful code, as seen here, which lets music writers break the 256-byte limitation.

Link to comment
Share on other sites

Thanks! And yeah, v.8 was just a goof to "supply" the missing steady tone from the original tune -- I think it's fine with just two voices.

 

Here's my latest version. This adds the two voices in octaves at the beginning, as in the original game, and also makes the bassline more staccato and punchier (again, as in the original):

 

castlevania_openingtune_11.bascastlevania_openingtune_11.bas.bin

Link to comment
Share on other sites

SUPERWOW!!! I must say that I am greatly impressed. Were these pulled from midi music or hand composed?

 

I think, now that we have heard some of the sounds, that music won't be a problem. But because music won't be the majority of the ROM, a streamlined music engine would probably be a good idea. If the engine were to be designed with the style of music in mind, then certain attributes could be avoided or eliminated. Also, a tracking system would be paramount in order to save tons of ROM space so that sections of the songs can be reutilized in the proper order to get the complete song or songs. :)

 

Any thoughts on tayloring the music engine for these aspects?

 

High praise for the excellent work to TheGoldenBand.

Edited by grafixbmp
Link to comment
Share on other sites

SUPERWOW!!! I must say that I am greatly impressed. Were these pulled from midi music or hand composed?

Done strictly by ear. I started with the .nsf file, and then -- after studying various frequency charts, to see what musical key would work best -- used Eckhard Stolberg's Frame Timed Sound Effects (see here) in Stella to create a rough mock-up without the drums (using savestates to try out different versions). I then copied the hex values as decimal into a bB template I use for tunes, before running into the 256-byte limit and converting it to use Random Terrain's excellent template instead.

 

I should add that the other songs in Castlevania are much more complicated, and will be a lot trickier! Still, this only took a few hours total, so it wasn't that bad.

 

I think, now that we have heard some of the sounds, that music won't be a problem. But because music won't be the majority of the ROM, a streamlined music engine would probably be a good idea. If the engine were to be designed with the style of music in mind, then certain attributes could be avoided or eliminated. Also, a tracking system would be paramount in order to save tons of ROM space so that sections of the songs can be reutilized in the proper order to get the complete song or songs. :)

Definitely agreed. On a few earlier tunes I wrote, the 256-byte limit helped encourage me to economize in various ways -- modifying pitches on the fly, that sort of thing. Having said that, I think doing mockups like these, with the frequency/channel/volume info available as raw data, is probably the best way to start -- then they can be optimized appropriately.

 

High praise for the excellent work to TheGoldenBand.

Thanks very much!

Edited by thegoldenband
Link to comment
Share on other sites

Thanks! And yeah, v.8 was just a goof to "supply" the missing steady tone from the original tune -- I think it's fine with just two voices.

 

Here's my latest version. This adds the two voices in octaves at the beginning, as in the original game, and also makes the bassline more staccato and punchier (again, as in the original):

 

castlevania_openingtune_11.bas

castlevania_openingtune_11.bas.bin

Since you posted the code, I'm going to play around with it if you don't mind. I'm in the mood to play with a tune.

Link to comment
Share on other sites

I have a few things that I have been using/collecting for music and sound and will post here if anyone finds any benefit from it. Granted, this is not directly atari related but I found them very helpful for music creation.

 

for anyone looking for the original music

 

http://www.zophar.net/music/nsf/castlevania-.html

 

I love using this for taking NES music to midi. Works rather well too.

 

http://www.zophar.net/utilities/converters/nsf2midi.html

 

There are also a few NSF player from zophar.net I like using so that I can eliminate some of the sound channels to isolate instruments a bit to see what each sounds like.

 

I think I will play with the intro theme a bit too. I am wondering what other tones might sound like.

Edited by grafixbmp
Link to comment
Share on other sites

On a side note, some were wondering how I intended to get all the elements on the title screen. I figured I would show everyone a breakdown of play field graphics and sprite graphics of the general layout. there are a few parts that arent shown but they should work out fine. I am hoping to be doing all the parts on a black background and at 30 Hz at a time. Left side then right. The BG and sprites are shown separate for clarity but the BG and sprites for there respective side are done together.

 

First the left parts

post-10601-1238629284_thumb.png

post-10601-1238629318_thumb.png

 

Then the right

post-10601-1238629298_thumb.png

post-10601-1238629338_thumb.png

 

The bat and start text aren't shown

 

any thoughts? I also plan to use another sprite during the left side to help align the 2 parts together so there is no overlap and then it will look uniform.

 

So what do you guys think?

Link to comment
Share on other sites

Some more music, programmed last night while my Internet was out:

 

castlevania_level1_07.bascastlevania_level1_07.bas.bin

The drums haven't been added yet, but it's a reasonable approximation. I've deliberately coded it very inefficiently, to make the raw data as clear as possible. I'll have to think about how I'd like to add drums.

Link to comment
Share on other sites

Some more music, programmed last night while my Internet was out:

 

The drums haven't been added yet, but it's a reasonable approximation. I've deliberately coded it very inefficiently, to make the raw data as clear as possible. I'll have to think about how I'd like to add drums.

Pretty cool. Can't wait to play with your code when I get a chance. I like playing with code more than creating it, so this is going to be fun. Thanks for posting it.

Link to comment
Share on other sites

Some more music, programmed last night while my Internet was out:

 

castlevania_level1_07.bascastlevania_level1_07.bas.bin

The drums haven't been added yet, but it's a reasonable approximation. I've deliberately coded it very inefficiently, to make the raw data as clear as possible. I'll have to think about how I'd like to add drums.

 

I'm speechless... Wonderful! simply wonderful. My girlfriend even said she was greatly impressed, and she has studied music for some time now. Did you find any exploitable patterns in the music toward less storrage space necessary for later on? If so and considering pricussion, I wonder which channel would be best to pull for sound FX during game play as well. You show a talent I sure can't approach. I am now curious as to what kind of "play" Random Terrain has in mind. :ponder:

 

I also will have a short thing in a few days... wait and see.

Link to comment
Share on other sites

I am now curious as to what kind of "play" Random Terrain has in mind. :ponder:

Just trial and error playing around with the music code similar to this:

 

http://www.atariage.com/forums/index.php?s...t&p=1615377

 

It's fun to play with the volume and do little things here and there in an attempt to make an Atari 2600 tune sound a little better to my ears.

Link to comment
Share on other sites

Some more music, programmed last night while my Internet was out:

 

castlevania_level1_07.bascastlevania_level1_07.bas.bin

The drums haven't been added yet, but it's a reasonable approximation. I've deliberately coded it very inefficiently, to make the raw data as clear as possible. I'll have to think about how I'd like to add drums.

 

This is pretty great! Nice and faithful to the NES music, but with that great 2600 flavor! This is shaping up to be pretty awesome! Good work, everyone!

Link to comment
Share on other sites

Thanks so much for the kudos!

I'm speechless... Wonderful! simply wonderful. My girlfriend even said she was greatly impressed, and she has studied music for some time now.

Nice! I too am a music student (Ph.D), so I'm glad to hear I've impressed a fellow musician.

 

Did you find any exploitable patterns in the music toward less storrage space necessary for later on?

Oh, absolutely. It depends on how far you want to go, but there's unequivocally a great deal of repetition -- for instance, the first two phrases differ by only one note in the melody, so you could easily just have a routine that changes the number sent to AUDC0 on the second iteration.

 

If so and considering pricussion, I wonder which channel would be best to pull for sound FX during game play as well.

It's an interesting question. The bass channel (AUDC1 here) is usually the right choice to use for percussion, and here it definitely is, since it's very staccato most of the time, making it easy to sneak hi-hat and snare in there. Given that, I would probably use AUDC0 for sound effects, since that way you'll still have bass and percussion going.

 

My basic idea is that drums should be representable with maybe as few as two bits, where one bit controls the sound (hihat vs. snare) and the other controls the on/off state. Other songs in Castlevania may be more complicated, but this one seems to just use hi-hat and snare at basically the same volume level. Then you'd just need a routine that would poll every n frames -- in this case, every 4 frames -- to say "Should I steal one frame from AUDC1 to use for a percussion sound?" And you could get 16 frames worth of music out of each byte, which would of course be easily reusable as well -- there are probably a very finite number of patterns that could be repeated.

 

But I'm not terribly proficient with binary math and operations, or for that matter with any aspect of programming (!), so it might take me some time to figure out the best way of doing that.

 

(Actually, if you put the on/off state first, you could represent all places with no percussion with just one bit, that expands to two if it encounters a 1: 0 equals silence, 10 equals hi-hat, 11 equals snare. But I don't know if that's practical.)

Edited by thegoldenband
Link to comment
Share on other sites

Thanks so much for the kudos!
I'm speechless... Wonderful! simply wonderful. My girlfriend even said she was greatly impressed, and she has studied music for some time now.

Nice! I too am a music student (Ph.D), so I'm glad to hear I've impressed a fellow musician.

 

Did you find any exploitable patterns in the music toward less storrage space necessary for later on?

Oh, absolutely. It depends on how far you want to go, but there's unequivocally a great deal of repetition -- for instance, the first two phrases differ by only one note in the melody, so you could easily just have a routine that changes the number sent to AUDC0 on the second iteration.

 

If so and considering pricussion, I wonder which channel would be best to pull for sound FX during game play as well.

It's an interesting question. The bass channel (AUDC1 here) is usually the right choice to use for percussion, and here it definitely is, since it's very staccato most of the time, making it easy to sneak hi-hat and snare in there. Given that, I would probably use AUDC0 for sound effects, since that way you'll still have bass and percussion going.

 

My basic idea is that drums should be representable with maybe as few as two bits, where one bit controls the sound (hihat vs. snare) and the other controls the on/off state. Other songs in Castlevania may be more complicated, but this one seems to just use hi-hat and snare at basically the same volume level. Then you'd just need a routine that would poll every n frames -- in this case, every 4 frames -- to say "Should I steal one frame from AUDC1 to use for a percussion sound?" And you could get 16 frames worth of music out of each byte, which would of course be easily reusable as well -- there are probably a very finite number of patterns that could be repeated.

 

But I'm not terribly proficient with binary math and operations, or for that matter with any aspect of programming (!), so it might take me some time to figure out the best way of doing that.

 

(Actually, if you put the on/off state first, you could represent all places with no percussion with just one bit, that expands to two if it encounters a 1: 0 equals silence, 10 equals hi-hat, 11 equals snare. But I don't know if that's practical.)

 

How about a single byte and that 4 bits represent which type of beat or even pattern of beats and the other 4 bits indicate duration of rest either half, quarter, eighth, sixteenth, etc. This way only thoes times hi hats or snare sounds are played is when there is data for them. The sound is played and the other 4 bits are in relation to a timming byte in ram that is counted down until it reaches 0 where the next byte is fetched for a new sound. The trick is that while the bass has its data ready to play it's normal sound, is does not render it untill it has checked if the timmer has reached 0 for the snare or hi hat. what do ya think? This is like the way I was thinking for sound FX. Actualy we could replicate sound FX and percussion the same way. Except the string of data for sound FX does not exist since it is based upon gaming conditions. Only data for rendering them vas well as percussion.

 

(edit)

In retrospect, possibly a combination of both thoughts might be prudent. Something more than just snares and hi-hats but less than a full byte. Perhaps something more well rounded as to say 4 bits that way there could be: the first one indicates weather percussion is needed or not and the following 3 bits would give 8 options for percussion for ALL songs that way ther would only be one sound track engine for all levels.

 

I guess several ideas should be tried and evaluated for efficiency.

Edited by grafixbmp
Link to comment
Share on other sites

  • 2 weeks later...

Hello world,

 

I registered to say how impressive this is, especially that you were able to design and draw those screens so quickly. It took me a few hours to implement my level editor and loader when I wrote a J2ME Pacman game, and that's probably 3 or 4 orders of magnitude easier than 6502 assembly. Cheers!

Link to comment
Share on other sites

Hello world,

 

I registered to say how impressive this is, especially that you were able to design and draw those screens so quickly. It took me a few hours to implement my level editor and loader when I wrote a J2ME Pacman game, and that's probably 3 or 4 orders of magnitude easier than 6502 assembly. Cheers!

 

Honestly, most if not all are just mockups with a ridgid conformity to TIA specs. Right now I am working on the game controls and display code (yes i am working on code) with kernel for simon only. I have around 2 to 3 schemes for controling the display mechanic and am going to try atleast 2 of them and will for sure be asking for advice on which way to go. As far as right now, I have been implementing horizontal positioning code at the moment and it seems to work fine for all sprites.

 

Guys, give me till the end of the month and I will try to have it done (or something functional ready) for you guys to test out. FYI, I know most all the basic and a bit more of the programing world of the 2600 but lack some experience so if the code can be streamlined, please feel free to help me streamline the code or if there are better ways to do the task, please share if you will. thank for the patience.

Link to comment
Share on other sites

Guys, give me till the end of the month and I will try to have it done (or something functional ready) for you guys to test out. FYI, I know most all the basic and a bit more of the programing world of the 2600 but lack some experience so if the code can be streamlined, please feel free to help me streamline the code or if there are better ways to do the task, please share if you will. thank for the patience.

 

You could just keep posting sprites and designs and I'd be excited :cool:

Link to comment
Share on other sites

Right now the release of a SIMPLE demo will consist of only one thing. Simon will walk left and right Thats it. Now the next one will do much more. Whip and possibly mace options. From here I really want to get as much fuctionality to simon as possible and then build enemies in and see how many cycles are left for terain afterwards. Here are a few illustrations so this will be the prediction or BEFORE. and then afterwards I will take snaps of the AFTER and then see how close they look. :D

 

post-10601-1240116859_thumb.png

 

OK I'm just going to post one of the programs I am trying to do and I more than likely will change alot of it by the time it gets to working but right now, I want to know if most of it looks right and or if things look in order and will work or not. Please be gentle :roll:

 

I know it is not near complete but just for sofar

	processor 6502

include vcs.h

include macro.h

;constants

CLEARSPRITE = $00
FRAMECOUNT = $03
FRAMEDUR = $08
FIRSTFRAME = #1
SECONDFRAME = #2


;clear mem

ldx #0
txa

clear
dex
txs
pha
bne clear

; preload starting position
lda #73
sta $81	


setvsync
           ;setvsync and vblank
lda #0
staVBLANK
lda #2
sta VSYNC

sta WSYNC
sta WSYNC
sta WSYNC

lda #0
sta VSYNC

;set Hposition of P0
ldx #0

lda $81


; set horizontal position

Hposition
     
EOR #$FF;0-159 is now 255-96

     clc

     sta WSYNC      ;begin line 1 

DivideLoop 

      ADC #15 

      BCC DivideLoop                 ;54 max

          SBC #7; 2

          ASL;2 

          ASL;2 

          ASL;2 

          ASL;2 -Shift left 4 places 

      sta HMP0,X     ;+4     68

      sta RESP0,X    ;+4     72

      sta WSYNC       

      sta HMOVE      ;
; Filler before kernel

ldx #34 ;34 scanlines as filler
countdown
dex
sta WSYNC
bne countdown

;scanline counter routine
ldx #140

slcountloop
dex		
sta WSYNC
bne slcountloop

; prep sprite loop

ldx #30

; Begin sprite render


;kernel run
; prep kernel variables



ORG $f400 ;start of sprites 	


; Simon standing

.byte $e7 ;|XXX..XXX|
.byte $c7 ;|XX...XXX|
.byte $c2 ;|XX....X.|
.byte $c6 ;|XX...XX.|
.byte $66 ;|.XX..XX.|
.byte $40 ;|.X......|
.byte $26 ;|..X..XX.|
.byte $66 ;|.XX..XX.|
.byte $76 ;|.XXX.XX.|
.byte $3c ;|..XXXX..|
.byte $2c ;|..X.XX..|
.byte $38 ;|..XXX...|
.byte $78 ;|.XXXX...|
.byte $68 ;|.XX.X...|
.byte $2c ;|..X.XX..|
.byte $5a ;|.X.XX.X.|
.byte $25 ;|..X..X.X|
.byte $77 ;|.XXX.XXX|
.byte $69 ;|.XX.X..X|
.byte $Ac ;|X...XX..|
.byte $ac ;|X.X.XX..|
.byte $b0 ;|X.XX....|
.byte $7a ;|.XXXX.X.|
.byte $76 ;|.XXX.XX.|
.byte $06 ;|.....XX.|
.byte $16 ;|...X.XX.|
.byte $00 ;|....X.X.|
.byte $04 ;|....X...|
.byte $06 ;|.....XX.|
.byte $00 ;|........|


; Simon walk 1


.byte $70 ;|.XXX....|
.byte $70 ;|.XXX....|
.byte $a0 ;|X.X.....|
.byte $a0 ;|X.X.....|
.byte $b0 ;|X.XX....|
.byte $c0 ;|XX......|
.byte $30 ;|..XX....|
.byte $68 ;|.XX.X...|
.byte $3c ;|..XXXX..|
.byte $2c ;|..X.XX..|
.byte $3c ;|..XXXX..|
.byte $28 ;|..X.X...|
.byte $78 ;|.XXXX...|
.byte $6c ;|.XX.XX..|
.byte $54 ;|.X.X.X..|
.byte $de ;|XX.XXXX.|
.byte $be ;|X.XXXXX.|
.byte $b4 ;|X.XX.X..|
.byte $e8 ;|XXX.X...|
.byte $ac ;|X.X.XX..|
.byte $76 ;|.XXX.XX.|
.byte $44 ;|.X...X..|
.byte $78 ;|.XXXX...|
.byte $34 ;|..XX.X..|
.byte $0e ;|....XXX.|
.byte $16 ;|...X.XX.|
.byte $16 ;|...X.XX.|
.byte $0a ;|....X.X.|
.byte $08 ;|....X...|
.byte $06 ;|.....XX.|

; Simon walk 2


.byte $00 ;|XXX..XXX|
.byte $00 ;|XX...XXX|
.byte $00 ;|XX...XX.|
.byte $00 ;|XXX..XX.|
.byte $66 ;|.XX..XX.|
.byte $46 ;|.X...XX.|
.byte $20 ;|..X.....|
.byte $36 ;|..XX.XX.|
.byte $36 ;|..XX.XX.|
.byte $2e ;|..X.XXX.|
.byte $1c ;|...XXX..|
.byte $38 ;|..XXX...|
.byte $d8 ;|XX.XX...|
.byte $d4 ;|XX.X.X..|
.byte $ae ;|X.X.XXX.|
.byte $dc ;|XX.XXX..|
.byte $fc ;|XXXXXX..|
.byte $58 ;|.X.XX...|
.byte $64 ;|.XX..X..|
.byte $56 ;|.X.X.XX.|
.byte $4c ;|.X..XX..|
.byte $3a ;|..XXX.X.|
.byte $35 ;|..XX.X.X|
.byte $07 ;|.....XXX|
.byte $1b ;|...XX.XX|
.byte $1b ;|...XX.XX|
.byte $0d ;|....XX.X|
.byte $0c ;|....XX..|
.byte $06 ;|.....XX.|
.byte $00 ;|........|

ORG $f300
colorcodes

; simon walk

.byte $00
.byte $00
.byte $28
.byte $00
.byte $28
.byte $00
.byte $28
.byte $00
.byte $1a
.byte $00
.byte $1a
.byte $00
.byte $1a
.byte $00 
.byte $26
.byte $00
.byte $26
.byte $00
.byte $24
.byte $00
.byte $24
.byte $00
.byte $24
.byte $00
.byte $28
.byte $00
.byte $fa
.byte $00
.byte $fa
.byte $00
.byte $26

 

This is supost to get right up to where it will begin doing the sprite drawing but I haven't actually added up ALL numbers and values to know for sure if everthing evens out yet but I hope I am on the right track for now. I was going for

*no control = constant standing graphic

 

* left control= move Hposition left every so many frames and 4 sprite frames each as 1 2 3 2 1 ...

 

* right control = move Hposition right every so many frames and 4 sprite frams each as 1 2 3 2 1... with p0 fliped

 

Simple yet complexed. Hope it works

 

(fingers crossed)

 

I also borrowed snippets of code from others. Thanks in advance and you know who you are.

Edited by grafixbmp
Link to comment
Share on other sites

I had some free time this afternoon, so here's the music to level 2, again without drums:

 

castlevania_level2_10.bascastlevania_level2_10.bas.bin

The coding -- that is, the way I've handled data repetition and such -- is still painfully inelegant/inefficient/uneconomical, but at least it's a bit easier now to identify the individual music loops at a glance.

Edited by thegoldenband
Link to comment
Share on other sites

So awesome. Sounds great. I have a friend who even liked it better than the first level. Thank you so much for your work.

 

New! Now have a simon sprite sheet. I think everything is here. If I missed one, feel free to add it. Rock on!post-10601-1240509171_thumb.png

Edited by grafixbmp
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...