base:simple_irq_music_player
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | base:simple_irq_music_player [2015-04-17 04:33] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Simple IRQ Music Player ===== | ||
+ | |||
+ | This routine plays music inside an IRQ raster interrupt. Just a basic step to interrupts. This routine is in ACME Cross assembler format. | ||
+ | < | ||
+ | ; | ||
+ | ;JCH, DMC, Whatever IRQ music plr | ||
+ | ; | ||
+ | |||
+ | !to " | ||
+ | * = $0810 ;Remember SYS 2064 to enable it | ||
+ | sei | ||
+ | lda #<irq | ||
+ | ldx #>irq | ||
+ | sta $314 | ||
+ | stx $315 | ||
+ | lda #$1b | ||
+ | ldx #$00 | ||
+ | ldy #$7f | ||
+ | sta $d011 | ||
+ | stx $d012 | ||
+ | sty $dc0d | ||
+ | lda #$01 | ||
+ | sta $d01a | ||
+ | sta $d019 ; ACK any raster IRQs | ||
+ | lda #$00 | ||
+ | jsr $1000 ;Initialize Richard' | ||
+ | cli | ||
+ | hold jmp hold ;We don't want to do anything else here. :) | ||
+ | ; we could also RTS here, when also changing $ea81 to $ea31 | ||
+ | irq | ||
+ | lda #$01 | ||
+ | sta $d019 ; ACK any raster IRQs | ||
+ | jsr $1003 ;Play the music | ||
+ | jmp $ea31 | ||
+ | | ||
+ | |||
+ | * = $1000-2 | ||
+ | | ||
+ | </ | ||
+ | |||
+ | Some additional notes by Frantic: | ||
+ | |||
+ | .sid files have a header of length $7c bytes. You must remove this header from the sid files before you can place them on $1000 in c64 memory (for sids that should indeed be placed on $1000, which is something like a standard, but not every tune follow this). | ||
+ | |||
+ | In some assemblers you can skip N number of bytes in the binary files directly, without having to do it with help of a hex editor or a tool such as " | ||
+ | |||
+ | < | ||
+ | | ||
+ | !bin " | ||
+ | </ | ||
+ | |||
+ | The " | ||
+ | |||
+ | Also note that in order to make the example code above executable (by executing " | ||
+ | |||
+ | < | ||
+ | * = $0801 | ||
+ | |||
+ | sysline: | ||
+ | !byte $0b, | ||
+ | |||
+ | * = $080d ;=2061 (Instead of $0810 as in Richards example | ||
+ | ; not to waste unnecessary bytes) | ||
+ | |||
+ | machine_code_entry: | ||
+ | sei | ||
+ | ...etc | ||
+ | </ | ||
base/simple_irq_music_player.txt · Last modified: 2015-04-17 04:33 by 127.0.0.1