but i updated my program from last time!
it can play different notes now, and each note is assigned a key !
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 ;Load and set register A
LDA #$/1
STA $/2
ENDM
DEFM SN ;Set note
LDA #$/1
STA $D400 ;low byte
LDA #$/2
STA $D401 ;high byte
ENDM
DEFM CKJ ;Check key and jump to label
CMP #/1
BEQ /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 / turn on
LSA 10, D404 ;control register / turn off
JMP LOOP
LOOP
LDA 203
; Key Note Key Note
CKJ 12, PC ;Z - C
CKJ 13, PCS ;S - C#
CKJ 23, PD ;X - D
CKJ 18, PDS ;D - D#
CKJ 20, PE ;C - E
CKJ 31, PF ;V - F
CKJ 28, PFS ;G - F#
CKJ 26, PG ;B - G
CKJ 29, PGS ;H - G#
CKJ 39, PA ;N - A
CKJ 34, PAS ;J - A#
CKJ 36, PB ;M - B
CKJ 64, NOF ;NaN - NaN
JMP LOOP
NON
LSA 11, D404 ;gate on
JMP LOOP
NOF
LSA 10, D404 ;gate off
JMP LOOP
;------------------------------------
PC
SN 08, 93
JMP NON
PCS
SN 09, 15
JMP NON
PD
SN 09, 9F
JMP NON
PDS
SN 0A, 32
JMP NON
PE
SN 0A, CD
JMP NON
;JumpExtentions
PF
JMP PF1
PFS
JMP PFS1
PG
JMP PG1
PGS
JMP PGS1
PA
JMP PA1
PAS
JMP PAS1
PB
JMP PB1
;-------------
PF1
SN 0B, 72
JMP NON
PFS1
SN 0C, 20
JMP NON
PG1
SN 0C, D8
JMP NON
PGS1
SN 0D, 9C
JMP NON
PA1
SN 0E, 6B
JMP NON
PAS1
SN 0F, 46
JMP NON
PB1
SN 10, 2F
JMP NON