base:avoiding_the_d000-_dfff_issue_for_playing_music
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | base:avoiding_the_d000-_dfff_issue_for_playing_music [2015-04-17 04:30] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== The $D000-$DFFF issues of music code/data ====== | ||
+ | After reading the tutorial Richard Bayliss submitted on " | ||
+ | |||
+ | ====== Problem 1 ====== | ||
+ | There may be the case where you include a music file that can start at any address BEFORE $D000, and leads to using up memory BETWEEN $D000-$DFFF. | ||
+ | |||
+ | When you compile the source code, you will find that the compiled program completely fails to play the music (or even worse, not run at ALL!) Why is that then? | ||
+ | |||
+ | This is simply because $D000-$DFFF is a reserved bank for I/O registers (SID registers, VIC registers, CIA registers and registers to expanded hardware... e.g. second SID chip). | ||
+ | |||
+ | ====== Solution 1 ====== | ||
+ | Setting $01 to #$35 does not give you access to $D000-$DFFF RAM, as it is still hidden underneath. | ||
+ | |||
+ | ====== Problem 2 ====== | ||
+ | This, however, leads to another big problem. | ||
+ | |||
+ | ====== Solution 2 ====== | ||
+ | Luckily, some good coders out there thought up a way to bypass this. This is called " | ||
+ | |||
+ | < | ||
+ | lda #$30 ; Switch off I/O and ROM banks | ||
+ | sta $01 | ||
+ | |||
+ | jsr $d003 ; Play address of an example tune stored from $d000-$e000 | ||
+ | |||
+ | lda #$37 ; Switch the I/O bank back on | ||
+ | sta $01 | ||
+ | |||
+ | ldx #$18 ; Transfer data from ghost-registers to SID-registers | ||
+ | - lda $4000,x | ||
+ | sta $d400,x | ||
+ | dex | ||
+ | bpl - | ||
+ | </ | ||
+ | |||
+ | As far as I'm aware, the newest music editors, like SDI and Goat-Tracker, | ||
+ | |||
+ | ====== Conclusion ====== | ||
+ | It is actually a very stupid idea to compile a tune that has data stored within the address range of the I/O bank. If you really must have a tune stored within $A000-$FFFF for your production/ | ||
+ | |||
+ | Thanks for reading! | ||
+ | by Conrad/ | ||
+ | |||
+ | |||
+ | ====== Links of Interest ====== | ||
+ | http:// | ||
+ | On 13th September 2012, a computer science student from the University of Belgrade (Serbia), wrote a Serbo-Croatian translation of this article as an example to help people from Ex-Yugoslavia better understand some very useful information about computer science. |
base/avoiding_the_d000-_dfff_issue_for_playing_music.txt · Last modified: 2015-04-17 04:30 by 127.0.0.1