Jump to content
IGNORED

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


The Usotsuki

Recommended Posts

Couldn't sleep so I looked through the lst file.

 

The test code + variables take almost 255 bytes. For the game, some of that would go away but would be replaced with stub routines to play different songs.

The interrupt handler that actually plays the song takes about 100 bytes of that.

The stub routines as well as start/stop routines could reside in one memory location and the interrupt in another if needed,

The demo song I have makes the demo take up over 5K. I didn't realize it was that big. Donkey Kong songs shouldn't be very large though.

 

If I add support for one shot sounds, the interrupt handler will probably grow by at least 50 bytes just due to having to manage timers for 3 channels and via control for the 2nd sound chip.

Link to comment
Share on other sites

Well, it took me over a half hour just to get Ciderpress to work.

Turns out it transfers the file just fine if you double click on it but if you select it and click the button it gives you an error. At least on the version I have.

 

The binary isn't loading at the proper address or something so I still have some work to do.

New platform... new tools... new issues.

Link to comment
Share on other sites

I'm using DOS 3.3 for the test so I put a fake DOS 3.3 header at the start of my file which tells DOS the load address and length.

<edit>

The ProDOS header is a bit more complex and I didn't want to deal with that yet.

 

The DOS 3.3 header is built automatically like this... at least if the docs I found are correct.

This before any CPU instructions or data.

 

.CODE
.org $8000-4		 ; 4 is the length of the DOS 3.3 header

;**************************************************************
;* dos 3.3 header
;**************************************************************
DOSHEADERSTART:
.addr _main    ; start address
.addr (PROGRAMEND -DOSHEADEREND)  ; length where PROGRAMEND is placed at the end of the program & code
DOSHEADEREND:

Edited by JamesD
Link to comment
Share on other sites

Well, the header code doesn't seem to work. Something Ciderpress does to a file with the extended name does. Ill figure that out another time.

 

The code runs but the interrupt wasn't triggering. The VIA timer code needs some changes and I might have to test a few different settings.

I'm trying to switch from the one shot timer to a free running timer for more accurate timing.

Link to comment
Share on other sites

  • 2 weeks later...

Ok, I have some time to work on this today.

 

Just an FYI, the Mockingboard demo disk includes an interrupt driven music demo. They just didn't include source to it.

I didn't work out the numbers but I think they are playing at 30Hz, which explains why earlier Mockingboard emulation interrupted at that rate no matter what.

 

The AY chip setup for the Mockingboard appears to be slightly different than for the Oric so I'll have to change a few things.

Link to comment
Share on other sites

The test player now works. I had to fix a couple defines that were wrong and it wasn't playing because I used the wrong branch test for the playing flag in the interrupt. It was always exiting the interrupt without playing. Once I figured out the debugger it was obvious what was going on.

One question... when the hell did I change that line of code? LOL

 

I have some cleanup to do on the code, I have to look up a couple Apple specific things, and I have to write some music data appropriate for Donkey Kong but progress has been made.

 

How do I attach a disk image to a message in this forum?

Link to comment
Share on other sites

I found a rough disassembly of the demo music player that came with the Mockingboard on this page.

I just borrowed some of the VIA settings from it rather than figure out the free running timer settings myself.

 

<edit>

Oops, it's a disassembly of the Music Construction Set player. I didn't read the title of the post until I checked the link.

Edited by JamesD
Link to comment
Share on other sites

Ok, each separate song will have a routine similar to this that has to be called at the start of a level or screen.

Since it's only called at the beginning of a level I figured it would be simpler this way.

Just insert a jsr to the song routine at the beginning of each level.

 

The variables could be initialized inline and you could jsr directly to the playsong routine if you prefer.

;**************************************************************
;* playtestsong
;**************************************************************
;*  This plays the sample song for testing the code
;**************************************************************
playtestsong:
lda #<testsong
sta songstart
lda #>testsong
sta songstart+1
jmp playsong

 

The first level music would be a good test case so that's what I'll work on first. I thought about the 'How High Can You Get' screen but it's existing "music" would have to be removed and would require more work.

 

I think screen 4 is going to have to be a unique case where the song is the spring bouncing and falling sounds.

The sound will get out of time with the animation if it's not played every time a spring starts so that could make patching difficult.

Maybe we can implement an intro screen before we do that.

 

I'll post more code when I get things cleaned up a bit.

Link to comment
Share on other sites

Here is the code that just calls everything else for the test case.

The init only needs called once before you play anything and the destruct only needs called if you want to clean up to exit.

You just call the routine you want to start a peticular song and when you want it to stop you call stopsong.

 

BTW, the demo song wasn't very complex and the player is actually capable of updating all the AY registers each interrupt which is at the same rate the screen is refreshed.

 

.CODE
.org $8000
START:  ; just so we have the start address in the list file

;**************************************************************
;* main
;**************************************************************
;* This is the main routine for the demo code.
;* It calls routines to initialize the hardware/software,
;*  plays the song, performs a busy loop until the song is done,
;*  and then calls the stopsong to disable playing.
;**************************************************************
_main:
php ;save registers
pha
tya
pha
txa
pha
jsr playerinit  ; initialize the player and sound hardware

jsr playtestsong  ; call the stub routine that plays the test song data
@loop:
bit Playing   ; wait for song to finish
bne @loop

jsr stopsong  ; clear the playing flag and stop the AY chip sound output
jsr playerdestruct  ; remove our interrupt and cleanup
pla ;restore registers
tax
pla
tay
pla
plp
rts ;return

Link to comment
Share on other sites

Here is what the test song looks like. Much longer than the songs for Donkey Kong.

 

testsong:
; rem  song
; rem wait, number of registers to change,
; register number, new value
; register number, new value
; etc.
; ends when number of registers to change is 0.
.byt 1,4,8,0,9,0,10,0,7,56
;-- snip
.byt 1,3,0,221,1,1,8,15
.byt 14,1,8,0
.byt 1,3,0,250,1,1,8,15
.byt 14,1,8,0
.byt 1,6,0,112,1,4,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,125,3,2,9,15
.byt  14,1,9,0
.byt 1,7,8,0,0,246,1,2,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,151,1,5,8,15,2,221,3,1,9,15
.byt 29,2,8,0,9,0
.byt 1,6,0,251,1,4,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,112,1,4,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,125,3,2,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,246,1,2,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,151,1,5,8,15,2,221,3,1,9,15
.byt 29,2,8,0,9,0
.byt 1,6,0,251,1,4,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,112,1,4,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,125,3,2,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,246,1,2,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,151,1,5,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 14,1,8,0
.byt 1,7,0,56,1,2,8,15,9,0,2,236,3,5,9,15
.byt 14,1,8,0
.byt 1,3,0,89,1,2,8,15
.byt 13,2,8,0,9,0
.byt 1,6,0,112,1,4,8,15,2,56,3,2,9,15
.byt 29,2,8,0,9,0
.byt 1,3,0,246,1,2,8,15
.byt 29,1,8,0
.byt 1,3,0,236,1,5,8,15
.byt 29,1,8,0
.byt 1,3,0,221,1,1,8,15
.byt 14,1,8,0
.byt 1,3,0,250,1,1,8,15
.byt 14,1,8,0
.byt 1,6,0,112,1,4,8,15,2,56,3,2,9,15
.byt 13,1,9,0
.byt 1,3,2,125,3,2,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,246,1,2,8,15,2,56,3,2,9,15
.byt 13,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,151,1,5,8,15,2,221,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,203,1,2,8,15,2,123,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,101,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,251,1,4,8,15,2,62,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,101,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,83,1,3,8,15,2,123,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,187,1,3,8,15,2,221,3,1,9,15
.byt 29,2,8,0,9,0
.byt 1,6,0,244,1,3,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 14,1,8,0
.byt 1,7,0,56,1,2,8,15,9,0,2,112,3,4,9,15
.byt 14,1,8,0
.byt 1,3,0,125,1,2,8,15
.byt 14,1,8,0
.byt 1,7,0,56,1,2,8,15,9,0,2,246,3,2,9,15
.byt 14,1,8,0
.byt 1,3,0,250,1,1,8,15
.byt 14,1,8,0
.byt 1,7,0,221,1,1,8,15,9,0,2,151,3,5,9,15
.byt 14,1,8,0
.byt 1,3,0,169,1,1,8,15
.byt 14,2,8,0,9,0
.byt 1,6,0,203,1,2,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,101,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,251,1,4,8,15,2,62,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,101,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,83,1,3,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,187,1,3,8,15,2,123,3,1,9,15
.byt 29,1,8,0
.byt 1,7,0,221,1,1,8,15,9,0,2,244,3,3,9,15
.byt 14,1,8,0
.byt 1,3,0,250,1,1,8,15
.byt 14,1,9,0
.byt 1,7,8,0,0,112,1,4,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,125,3,2,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,246,1,2,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,151,1,5,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,203,1,2,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,101,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,251,1,4,8,15,2,62,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,101,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,83,1,3,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,187,1,3,8,15,2,221,3,1,9,15
.byt 29,2,8,0,9,0
.byt 1,6,0,244,1,3,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 14,1,8,0
.byt 1,7,0,56,1,2,8,15,9,0,2,112,3,4,9,15
.byt 14,1,8,0
.byt 1,3,0,125,1,2,8,15
.byt 14,1,8,0
.byt 1,7,0,56,1,2,8,15,9,0,2,246,3,2,9,15
.byt 14,1,8,0
.byt 1,3,0,125,1,2,8,15
.byt 14,1,8,0
.byt 1,7,0,89,1,2,8,15,9,0,2,236,3,5,9,15
.byt 14,1,8,0
.byt 1,3,0,250,1,1,8,15
.byt 14,2,8,0,9,0
.byt 1,6,0,246,1,2,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,151,1,5,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 14,1,8,0
.byt 1,7,0,56,1,2,8,15,9,0,2,236,3,5,9,15
.byt 14,1,8,0
.byt 1,3,0,125,1,2,8,15
.byt 13,2,8,0,9,0
.byt 1,6,0,112,1,4,8,15,2,56,3,2,9,15
.byt 29,2,8,0,9,0
.byt 1,3,0,221,1,1,8,15
.byt 14,1,8,0
.byt 1,3,0,250,1,1,8,15
.byt 14,1,8,0
.byt 1,6,0,112,1,4,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,125,3,2,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,246,1,2,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,151,1,5,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,203,1,2,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,101,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,251,1,4,8,15,2,62,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,101,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,83,1,3,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,187,1,3,8,15,2,221,3,1,9,15
.byt 28,2,8,0,9,0
.byt 1,6,0,244,1,3,8,15,2,221,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,112,1,4,8,15,2,56,3,2,9,15
.byt 13,1,9,0
.byt 1,3,2,125,3,2,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,246,1,2,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,151,1,5,8,15,2,221,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,203,1,2,8,15,2,123,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,101,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,251,1,4,8,15,2,62,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,101,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,83,1,3,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,187,1,3,8,15,2,123,3,1,9,15
.byt 28,2,8,0,9,0
.byt 1,6,0,244,1,3,8,15,2,221,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,112,1,4,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,125,3,2,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,246,1,2,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,151,1,5,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,203,1,2,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,101,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,251,1,4,8,15,2,62,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,101,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,83,1,3,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,187,1,3,8,15,2,221,3,1,9,15
.byt 29,2,8,0,9,0
.byt 1,6,0,244,1,3,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,112,1,4,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,125,3,2,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,246,1,2,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,125,3,2,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,236,1,5,8,15,2,89,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,246,1,2,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,151,1,5,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 14,1,8,0
.byt 1,7,0,56,1,2,8,15,9,0,2,236,3,5,9,15
.byt 14,1,8,0
.byt 1,3,0,125,1,2,8,15
.byt 14,1,8,0
.byt 1,7,0,56,1,2,8,15,9,0,2,112,3,4,9,15
.byt 29,2,8,0,9,0
.byt 30,6,0,83,1,3,8,15,2,101,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,123,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,56,1,2,8,15,2,169,3,1,9,15
.byt 14,1,8,0
.byt 1,4,9,0,2,125,3,2,9,15
.byt 15,6,0,251,1,4,8,15,4,62,5,1,10,15
.byt 14,1,10,0
.byt 1,4,9,0,2,101,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,244,1,3,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,1,8,0
.byt 1,7,0,123,1,1,8,15,9,0,2,187,3,3,9,15
.byt 14,1,8,0
.byt 1,3,0,169,1,1,8,15
.byt 13,2,8,0,9,0
.byt 1,6,0,246,1,2,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,187,1,3,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,246,1,2,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,62,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,83,1,3,8,15,2,101,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,123,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,56,1,2,8,15,2,169,3,1,9,15
.byt 14,1,8,0
.byt 1,3,0,125,1,2,8,15
.byt 14,1,9,0
.byt 1,6,2,236,3,5,9,15,4,123,5,1,10,15
.byt 14,2,8,0,10,0
.byt 1,3,0,169,1,1,8,15
.byt 13,2,8,0,9,0
.byt 1,9,0,179,1,4,8,15,2,246,3,2,9,15,4,221,5,1
.byt 10,15
.byt 13,1,10,0
.byt 1,3,4,250,5,1,10,15
.byt 13,3,8,0,9,0,10,0
.byt 1,6,0,112,1,4,8,15,2,221,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,56,1,2,8,15,2,246,3,2,9,15
.byt 13,1,8,0
.byt 1,3,0,125,1,2,8,15
.byt 13,2,8,0,9,0
.byt 1,6,0,112,1,4,8,15,2,56,3,2,9,15
.byt 28,2,8,0,9,0
.byt 1,3,0,123,1,1,8,15
.byt 13,1,8,0
.byt 1,3,0,62,1,1,8,15
.byt 13,1,8,0
.byt 1,6,0,83,1,3,8,15,2,101,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,123,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,56,1,2,8,15,2,169,3,1,9,15
.byt 13,1,8,0
.byt 1,4,9,0,2,125,3,2,9,15
.byt 14,6,0,251,1,4,8,15,4,62,5,1,10,15
.byt 13,2,9,0,10,0
.byt 1,3,2,101,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,244,1,3,8,15,2,123,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,187,1,3,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,244,1,3,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,112,1,4,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,123,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,246,1,2,8,15,2,169,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,221,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,151,1,5,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,203,1,2,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,236,1,5,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,246,1,2,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,89,3,2,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,112,1,4,8,15,2,56,3,2,9,15
.byt 30,2,8,0,9,0
.byt 32,6,0,83,1,3,8,15,2,101,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,123,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,56,1,2,8,15,2,169,3,1,9,15
.byt 14,1,8,0
.byt 1,4,9,0,2,125,3,2,9,15
.byt 15,6,0,251,1,4,8,15,4,62,5,1,10,15
.byt 14,1,10,0
.byt 1,4,9,0,2,101,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,244,1,3,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,1,8,0
.byt 1,7,0,123,1,1,8,15,9,0,2,187,3,3,9,15
.byt 14,1,8,0
.byt 1,3,0,169,1,1,8,15
.byt 13,2,8,0,9,0
.byt 1,6,0,246,1,2,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,187,1,3,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,246,1,2,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,62,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,83,1,3,8,15,2,101,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,123,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,56,1,2,8,15,2,169,3,1,9,15
.byt 14,1,8,0
.byt 1,3,0,125,1,2,8,15
.byt 14,1,9,0
.byt 1,6,2,236,3,5,9,15,4,123,5,1,10,15
.byt 14,2,8,0,10,0
.byt 1,3,0,169,1,1,8,15
.byt 13,2,8,0,9,0
.byt 1,9,0,179,1,4,8,15,2,246,3,2,9,15,4,221,5,1
.byt 10,15
.byt 13,1,10,0
.byt 1,3,4,250,5,1,10,15
.byt 13,3,8,0,9,0,10,0
.byt 1,6,0,112,1,4,8,15,2,221,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,56,1,2,8,15,2,246,3,2,9,15
.byt 13,1,8,0
.byt 1,3,0,125,1,2,8,15
.byt 13,2,8,0,9,0
.byt 1,6,0,112,1,4,8,15,2,56,3,2,9,15
.byt 29,2,8,0,9,0
.byt 1,3,0,123,1,1,8,15
.byt 13,1,8,0
.byt 1,3,0,62,1,1,8,15
.byt 13,1,8,0
.byt 1,6,0,83,1,3,8,15,2,101,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,123,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,56,1,2,8,15,2,169,3,1,9,15
.byt 14,1,8,0
.byt 1,3,0,125,1,2,8,15
.byt 14,1,9,0
.byt 1,6,2,251,3,4,9,15,4,62,5,1,10,15
.byt 13,2,8,0,10,0
.byt 1,3,0,101,1,1,8,15
.byt 13,2,8,0,9,0
.byt 1,6,0,244,1,3,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,187,1,3,8,15,2,123,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,244,1,3,8,15,2,123,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,112,1,4,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,123,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,246,1,2,8,15,2,169,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,221,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,151,1,5,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,203,1,2,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,236,1,5,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,246,1,2,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,89,3,2,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,112,1,4,8,15,2,56,3,2,9,15
.byt 30,2,8,0,9,0
.byt 32,3,0,221,1,1,8,15
.byt 14,1,8,0
.byt 1,3,0,250,1,1,8,15
.byt 14,1,8,0
.byt 1,6,0,112,1,4,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,125,3,2,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,246,1,2,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,151,1,5,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,203,1,2,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,101,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,251,1,4,8,15,2,62,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,101,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,83,1,3,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,1,9,0
.byt 1,7,8,0,0,187,1,3,8,15,2,221,3,1,9,15
.byt 28,2,8,0,9,0
.byt 1,6,0,244,1,3,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 14,1,8,0
.byt 1,7,0,56,1,2,8,15,9,0,2,112,3,4,9,15
.byt 14,1,8,0
.byt 1,3,0,125,1,2,8,15
.byt 13,2,8,0,9,0
.byt 1,6,0,246,1,2,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,151,1,5,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,203,1,2,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,101,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,251,1,4,8,15,2,62,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,101,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,83,1,3,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,187,1,3,8,15,2,123,3,1,9,15
.byt 28,2,8,0,9,0
.byt 1,6,0,244,1,3,8,15,2,221,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,112,1,4,8,15,2,56,3,2,9,15
.byt 13,1,9,0
.byt 1,3,2,125,3,2,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,246,1,2,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,151,1,5,8,15,2,221,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 14,2,8,0,9,0
.byt 1,6,0,203,1,2,8,15,2,123,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,101,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,251,1,4,8,15,2,62,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,101,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,83,1,3,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,187,1,3,8,15,2,221,3,1,9,15
.byt 28,2,8,0,9,0
.byt 1,6,0,244,1,3,8,15,2,221,3,1,9,15
.byt 13,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,112,1,4,8,15,2,56,3,2,9,15
.byt 13,1,9,0
.byt 1,3,2,125,3,2,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,246,1,2,8,15,2,56,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,125,3,2,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,236,1,5,8,15,2,89,3,2,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,246,1,2,8,15,2,123,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,169,3,1,9,15
.byt 13,2,8,0,9,0
.byt 1,6,0,151,1,5,8,15,2,221,3,1,9,15
.byt 14,1,9,0
.byt 1,3,2,250,3,1,9,15
.byt 14,1,8,0
.byt 1,7,0,56,1,2,8,15,9,0,2,236,3,5,9,15
.byt 14,1,8,0
.byt 1,3,0,125,1,2,8,15
.byt 14,1,8,0
.byt 1,7,0,56,1,2,8,15,9,0,2,112,3,4,9,15
.byt 30,2,8,0,9,0
;-- unsnip
.byt 1,3,8,0,9,0,10,0
; .byt 0,0
.byt 128,128
;=== end of song
dataend:    ; so we have the end of the data in the list file

;.end

Link to comment
Share on other sites

Total code + variable size for the demo (with my latest changes) is 269 bytes but clearly some of that isn't needed and it doesn't have to reside on one page.

28 bytes are for the test player and that code would be part of the patches somewhere else.

 

Keep in mind the following do not include any code required for patches to the existing Donkey Kong code. This is in addition to that.

 

Each routine for playing a specific song is 13 bytes in length. 4 levels + play "how high can you climb" + play "opening screen" + play "made it to the top tune"

So 7 songs at 13 bytes = 91 bytes. Ouch. Well, the 6502 isn't exactly known for code density.

If all the songs are small enough to fit on one memory page, we can set the MSB once and dump 5 bytes per play routine, dropping each to 8 bytes.

If one of those routines is set right in front of the playsong routine we can shave off 3 bytes by letting the code just fall through.

So 7 * 8 - 3 = 53 bytes required for routines to play individual songs.

 

The interrupt handler is 101 bytes and I can shorten that a few bytes if I yank out the "playing" flag and just disable the interrupt output from the timer.

You can't test for the end of a song but Donkey Kong doesn't seem to need that.

I believe it drops 16 bytes from the entire player code.

If songs don't cross a memory page I can drop 4 more bytes making the actual player interrupt around 93 bytes.

I am reordering some code so I can reuse a load here or there and save a few more bytes in various places but I think I've only saved 4 or so bytes that way so far.

The difference between my timer value and the disassembled code allows one more reuse of a load so that may be why they used that value.

 

<edit> Do we have enough memory for that?

Edited by JamesD
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...