Page 1 of 1

Play a note!

Posted: Sat Sep 05, 2020 5:00 am
by Sect0r
i made a program (with the help of a friend) that plays a note!
i spent 6 hours trying to figure out why it wasn't playing, just to find out that it was reading from zero page values and not an immediate value (Which i didn't know existed and or how they are used)
and eventually running into a brk opt code and restart it self.

Anyway, aside from that
here it is!

Code: Select all

; 10 SYS (49152)

*=$0801

        BYTE    $0E, $08, $0A, $00, $9E, $20, $28,  $34, $39, $31, $35, $32, $29, $00, $00, $00
;----------------------------------------------------------------------------------------------

*=$C000

defm lsa
        lda #$/1
        sta $/2
        endm

INIT
;           Val MemAddress
        lsa 44, D400    ;frequency voice1 low byte
        lsa 1D, D401    ;frequency voice1 high byte
        lsa 0F, D418    ;volume

        ;ADSR   
        lsa 11, D405    ;attack
        lsa F0, D406    ;sustain

        ;play note
        lsa 11, D404    ;control register

HALT
        jmp HALT

Re: Play a note!

Posted: Thu Sep 10, 2020 3:20 am
by akuyou
Great work! you've made progress pretty quick... it took me quite a while to get any sound out of the C64 too - it takes time to get started on these things!

that LSA macro is a good idea! I'm sure it'll save a lot of time.

Re: Play a note!

Posted: Thu Sep 10, 2020 1:06 pm
by Sect0r
I use a lot of macros!
I think they're neat, and make my code a bit cleaner