Jump to content
IGNORED

(Apple ][) It's on like Donkey Kong...


The Usotsuki

Recommended Posts

I could place the song pointers in a table and just have you LDA with the number of the song to play.

Not sure why I didn't think of that to begin with.

 

;**************************************************************
;* playsongina
;**************************************************************
;* This plays the song # in the A register from a table of song pointers
;**************************************************************
playsongina:
rol
tay
lda (songtable),y ; load the LSB of the song address
sta songstart ; save in the LSB of the pointer for the currently playing song
iny
lda (songtable),y ; load the MSB of the song address
sta songstart+1 ; save in the MSB of the pointer for the currently playing song

Edited by JamesD
Link to comment
Share on other sites

I think we have about 1792 bytes from A000. The code ends at B922, but I use BB00-BEFF for the file load buffer, and BF00-BFFF is reserved for ProDOS. That gives us about 477 bytes at the top of code for further patching (and it might be possible to make further tweaks).

 

That's a little over 2K in total.

Link to comment
Share on other sites

I think we have about 1792 bytes from A000. The code ends at B922, but I use BB00-BEFF for the file load buffer, and BF00-BFFF is reserved for ProDOS. That gives us about 477 bytes at the top of code for further patching (and it might be possible to make further tweaks).

 

That's a little over 2K in total.

I think we are safe so far. :)

The new intro screen might be a challenge depending on how much code and graphics can be reused.

Link to comment
Share on other sites

I was thinking the code for that could be put in the same memory as a level, i.e., not any of the space we're using for the new sound code.

 

At any rate, there's about 46K free space on my current disk image.

46K? Isn't that around 1/3 of the disk space? If we can't fit an intro screen in that there's something wrong.

Link to comment
Share on other sites

It shouldn't be a problem. 8K for an uncompressed image. With no compression at all a level takes 12K; I used Scrunch compression on the graphics, so most of the levels are 8K. And yeah, that's about 1/3 of the disk... there's enough room with the current version of Donkey Kong to fit it, the ProDOS kernel, BASIC.SYSTEM and Joust on one disk.

Link to comment
Share on other sites

Ok, I figured out the notes for the background music for level 1 last night. I may have to adjust the data I created for a different AY clock rate and one note may need to be sharp/flat but that's not difficult to fix. I'm trying to figure out the other AY settings now.

 

I also fixed a bug in the endless repeat code. I was forgetting to set up the next interrupt waitcount when restarting the song and it would just exit. It cost 4 additional bytes but repeat works now.

 

<edit> BTW, the Colecovision version seems to play the same background tune on other levels which we could also do at first.

Edited by JamesD
Link to comment
Share on other sites

Ok, the timing really needs work and I need to yank out stuff related to the original demo, but it's about to the point where we can start piecing things together in the game for a test.

Getting the timing right for the AY is just requiring some trial and error without a tracker. It would help if I could get a recording of the Colecovision version without someone running Mario around right away.

I haven't really messed with envelope or noise settings on the chip yet and the volume is set to 5 to try to keep from overpowering the rest of the sound.

 

BTW, it uses a table for song pointers now and you just pass the number for the song in A and it does the rest.

I'll make a few more changes and then we can piece things together.

All it does at the moment is endlessly play the background music... unless you modify the playing variable to zero at some point. Then it will exit.

ForestTest.zip

Link to comment
Share on other sites

Hm. I'm punching all sorts of values into A and I'm not hearing anything.

 

The Atari ST has an AY-8910...more or less...and there might be trackers for that, but then its cpu would crush the Apple's which might make converting sound over difficult.

That's probably because the table isn't complete in that version. :D

 

Here is what the table looks like in the version I'm working on.

;**************************************************************
;* songtable
;**************************************************************
;* table of pointers to songs
;* any unsupported song is set to enptysong
;* All gameplay screens initially play the girders song like the Colecovision version
;**************************************************************
songtable:
.word emptysong    ; intro screen
.word emptysong    ; how high can you get?
.word screen1	 ; girders
.word screen1	 ; conveyer
.word screen1	 ; springs
.word screen1	 ; rivets
.word emptysong    ; Complete Girder Level
.word emptysong    ; Complete Rivet 1
.word emptysong    ; Complete Rivet 2
.word emptysong    ; Kong Taunting
.word emptysong    ; Kong Fall/saved girl
.word emptysong    ; Hammertime
.word emptysong    ; Die
.word emptysong    ; Out of time
;**************************************************************

Edited by JamesD
Link to comment
Share on other sites

Ok, cleaned up enough that I'm willing to release the code.

And yes, the initial background song needs work.

 

Merry Christmas BTW

 

<edit> Set tabs to 4 in your editor for the formatting to look right

 

Code archive sent via PM

Edited by JamesD
Link to comment
Share on other sites

A little code change for the test section. With this change you can hit a key to exit the test program.

 

.DEFINE KEYBOARD $C000 ; address of Apple II keyboard

 

; wait for a keypress or for the song to finish
@loop:
lda KEYBOARD ; get input status
bmi @quit ; exit if a keypress has taken place
bit Playing ; check to see if the song has finished
beq @quit ; quit if it has
bne @loop ; keep looking if neither condition has taken place.
@quit:

Edited by JamesD
Link to comment
Share on other sites

Music takes about 192 bytes so far but I can probably dump some of the AY related settings at the start of each song.

 

I think music will take at lest one page of memory by the time everything is implemented.

Worst case, we can place unique music for a screen at a fixed address and load it with the screen.

 

I think how high can you get and the hammer music will be next but will take a little longer.

Springs will not be easy due to the sounds and timing so that will probably be last.

Edited by JamesD
Link to comment
Share on other sites

My internet access is messed up so I'm sitting in a McDonalds. Grrrrr...

 

Now fit for public consumption.

Cleaned up, supports 2 sound chips (see the source code header), and includes 3 songs for DK.

Any other DK songs will require quite a bit of work since they are more complex.

 

The test program moves on to the next song when one ends or hit a key to continue on the ones that play indefinitely.

It has a keybounce issue but it will do the job for now.

You shouldn't have to alter anything but the build options just after the header.

If I remember right, the songs turn off the volume on all sound channels at the start.

I'll try to fix that for the next version.

I'm looking at implementing one-shot sounds. That will require a jump in code size.

 

<edit> for those of you joining this late, this is just the player and test code

DonkeyKongApple.zip

Edited by JamesD
Link to comment
Share on other sites

Ok, first time I've been online since that post.

There are a couple nasty bugs in the last version. I sort of rushed it out the door because I knew I wouldn't be online for a while.

Sorry about that.

 

Bugs fixed, documentation enhanced, and you can now call the routine to output sound data directly. It's not the interrupt driven sound output I'm planning on adding but it will let you dump sound data to the AY chip for playing sounds.

DonkeyKongApple.zip

Link to comment
Share on other sites

Well, the "standard level victory" code is at 697A. This shows the heart, a little Pauline animation, then Kong climbing, then advances the level.

 

But I can't exactly understand it to hack it. :<

If I get a little time this week I'll have a look at this and see if I can extract the code for Kong to build an intro screen. It will certainly need a lot of changes but it might be better than starting from scratch and I need a Kong image to start from anyway.

Link to comment
Share on other sites

Ok, I spent a little time looking at the donkey kong sprite stuff.

If you enter the debugger at the start of the first screen, type "JSR 697A" in the debugger, then continue execution.

Kong will exit at the top and you will be on the rivets screen.

Enter the debugger again and type "JSR 697A" again.

The kong graphics are messed up because the screen data must be different, but the code clearly has kong climb all the way up the screen on the left side.

 

After a quick look through the code...

6ACC-6AED looks it manipulates the screen. I don't think it's drawing Kong but it might erase him.

 

6B06-6B1B seems to draw on the screen.

$ED on page zero would point to the sprite data? $EE would be the MSB of the pointer.

It seems to copy 5 bytes at a shot, so probably one line of the kong sprite?

 

 

There is a delay between each frame of animation. The delay function is at $6965 and would be called at the end of the sprite loop.

That is called from the routine at 6961 which is called from 6B1D so the bottom of the sprite loop must be shortly after that.

There is a JMP to 6A49 at 6B30 so that might be the bottom and 6A49 might be the top of the kong drawing or climbing loop.

 

6A78-6A7F seems to set up the sprite pointer and 6A81-6ACA would do the screen address lookups/calculations?

 

8290 may have sprite info and 8260 may be tables for screen offsets?

 

Not being able to see the screen and debugger at the same time sucks.

 

I'll look at this more later.

Link to comment
Share on other sites

  • 2 weeks later...

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...