Updating sound engine source with minor changes

This commit is contained in:
Safiire 2015-03-27 16:33:53 -07:00
parent 97205a826c
commit 7e5cf3ca48
3 changed files with 7 additions and 5 deletions

View File

@ -74,7 +74,7 @@ An NES assembler for the 6502 microprocessor written in Ruby
on the NES. on the NES.
![Scrolling NES Demo](github_images/assembler_demo.png) ![Scrolling NES Demo](images/assembler_demo.png)
# Some new additions: # Some new additions:
- First version of Midi to NES music converter - First version of Midi to NES music converter

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,5 +1,5 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; An NES sound engine that understands the binary stream outputted from my ; An NES music engine that understands the binary stream outputted from my
; MIDI converter :) ; MIDI converter :)
;;;; ;;;;
; Create an iNES header ; Create an iNES header
@ -15,8 +15,11 @@
; Let's put a data structure to control the sound engine in the zero page ; Let's put a data structure to control the sound engine in the zero page
.org $0000 .org $0000
.scope sound_engine .scope sound_engine
; Where we are reading from ROM
.space stream_read_ptr_lo 1 .space stream_read_ptr_lo 1
.space stream_read_ptr_hi 1 .space stream_read_ptr_hi 1
; Where we are writing in the APU
.space stream_write_ptr_lo 1 .space stream_write_ptr_lo 1
.space stream_write_ptr_hi 1 .space stream_write_ptr_hi 1
.space delta 1 .space delta 1
@ -78,11 +81,10 @@
; Initialize sound engine structure ; Initialize sound engine structure
; To read from $D000, and to write to $40** ; To read from $D000, and to write to $40**
lda #$D0 lda #>music_buffer
sta sound_engine.stream_read_ptr_hi sta sound_engine.stream_read_ptr_hi
lda #$00 lda #<music_buffer
sta sound_engine.stream_read_ptr_lo sta sound_engine.stream_read_ptr_lo
sta sound_engine.stream_write_ptr_lo
; Make the first delta happen immediately ; Make the first delta happen immediately
lda #$01 lda #$01