This commit is contained in:
Kelvin Sherlock 2020-07-18 16:53:20 -04:00
parent 4864edcfbb
commit f8f7fd9a47

226
morse.s
View File

@ -35,6 +35,15 @@ wait lda >SoundCtrl
bmi wait
<<<
docmode mac
docwait
* lda >SoundAddr
bic #%01000000 ; DOC mode
ora #%00100000 ; auto-incr
sta >SoundCtrl
<<<
main
mx %00
phk
@ -70,9 +79,8 @@ start
stz _active
sep $30
*]wait lda >SoundCtrl
* bmi ]wait
docwait
docmode
* start osc 0-3 w/ volume 0.
@ -81,19 +89,22 @@ start
lda #0
sta >SoundData
sta >SoundData
lda #$01 ; silent channel to fix GS+ audio deficiencies.
sta >SoundData
sta >SoundData
lda #$a0
sta >SoundAddr
lda #%0000_0_01_0 ; free-run, enabled
lda #%0000_0_00_0 ; free-run, enabled
sta >SoundData
lda #%0001_0_00_0 ; free-run, enabled
sta >SoundData
lda #%0000_0_00_0 ; free-run, enabled
sta >SoundData
lda #%0001_0_00_0 ; free-run, enabled
sta >SoundData
* trigger the timing oscillator.
lda #$a0+timer_1
sta >SoundAddr
@ -120,9 +131,8 @@ stop
* shut off all oscillators.
sep $30
*]wait lda >SoundCtrl
* bmi ]wait
docwait
docmode
lda #$a0
sta >SoundAddr
@ -142,7 +152,7 @@ sound_irq
mx %11
lda >_active
beq :ok
bne :ok
clc
rtl
@ -150,6 +160,9 @@ sound_irq
phb
phk
plb
docmode
rep $30
lsr _template+2
@ -182,7 +195,7 @@ sound_irq
rep $30
ldx _index
lda _buffer,x
and #$ff
and #$7f
beq :fini
inx
@ -258,13 +271,7 @@ init
sep $30
*]wait lda >SoundCtrl
* bmi ]wait
docwait
ora #%00100000 ; auto increment (for later)
bic #%01000000 ; DOC mode
sta >SoundCtrl
docmode
* halt all oscillators.
@ -283,7 +290,7 @@ init
sta >SoundData
* 5-7 are one-shot, interrupt enabled, halted.
lda #%0000_1_00_1 ; one-shot, halted, interrupt enabled.
lda #%0000_1_01_1 ; one-shot, halted, interrupt enabled.
sta >SoundData
sta >SoundData
sta >SoundData
@ -319,9 +326,10 @@ init
* frequency low registers
lda #$00
sta >SoundAddr
lda #<$0100 ; low
lda #<$0200 ; low
sta >SoundData
sta >SoundData
* lda #>$0180
sta >SoundData
sta >SoundData
@ -335,9 +343,10 @@ init
* freq high
lda #$20
sta >SoundAddr
lda #>$0100
lda #>$0200
sta >SoundData
sta >SoundData
* lda #>$0180
sta >SoundData
sta >SoundData
@ -356,9 +365,10 @@ init
lda #$00 ; page 0
sta >SoundData
sta >SoundData
inc ; page 1
sta >SoundData
sta >SoundData
lda #$01 ; page 1
* inc ; page 2
sta >SoundData
sta >SoundData
sta >SoundData
@ -381,11 +391,9 @@ init
* now load data...
*]wait lda >SoundCtrl
* bmi ]wait
docwait
ora #%01000000 ; ram mode
ora #%01100000 ; ram mode, incr
sta >SoundCtrl
lda #0
@ -393,26 +401,24 @@ init
sta >SoundAddr+1
ldx #0
]loop lda b5,x
]loop lda beep,x
sta >SoundData
inx
bne ]loop
*]loop lda noise,x
* sta >SoundData
* inx
* bne ]loop
* 256 silent bytes for the timer.
lda #$80
]loop sta >SoundData
inx
bne ]loop
* swap back to register mode.
*]wait lda >SoundCtrl
* bmi ]wait
docwait
bic #%01000000 ; DOC mode
sta >SoundCtrl
rep #$30
rts
@ -428,7 +434,7 @@ init
* pcm = [128 + round(127 * sin(n*xx)) for n in range(0,256)]
b5
beep
hex 809fbcd5eaf8fefef5e6d1b6997a5b3f
hex 26130601030d1e344f6d8cabc7def0fb
hex fffbf0dec7ab8c6d4f341e0d03010613
@ -447,7 +453,154 @@ b5
hex dac1a586674a2f1a0b020208162b4461
noise
hex 6c917262a488987a82a7895966a7589e
hex 646a9b8887607b85a086925c678d7395
hex 7686949c61a69a9897a7a5979d668371
hex 91a05ca65972a48b857896906a6978a4
hex a891679b826a83658c9c8d6162926b8a
hex 8a6970589e8998986c87738b927c9f60
hex 8372959289748c606ca6658e74a89471
hex 966f8477799b606ca388a66b72847d5a
hex 8b678f6983619080a17f6e775f5f787c
hex 7a845a5890927a5ba66598a267746f79
hex 985f94808a839da191a162848a7c6ea6
hex 8376837d86689f7d9b94a57b6997688b
hex 67a86b8e8869a85ca28b9e729d8c799a
hex 629b8b678189728e9a8ba686a49f6a90
hex 5879588f91797b6c5d7080587a6a6995
hex 616da595987565a2a3a159a09a829974
table
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000001011101110101 ; ! ..--.
adrl %00000000000000000101110101011101 ; " .-..-.
adrl %00000000000000000000010101011101 ; # .-...
adrl %00000000000000011101010111010101 ; $ ...-..-
adrl %00000000000001110101110101010111 ; % -...-.-
adrl %00000000000000000111010111010101 ; & ...-.-
adrl %00000000000001011101110111011101 ; ' .----.
adrl %00000000000000000101110111010111 ; ( -.--.
adrl %00000000000001110101110111010111 ; ) -.--.-
adrl %00000000000000000000010111010101 ; * ...-.
adrl %00000000000000000001011101011101 ; + .-.-.
adrl %00000000000001110111010101110111 ; , --..--
adrl %00000000000000000111010101010111 ; - -....-
adrl %00000000000000011101011101011101 ; . .-.-.-
adrl %00000000000000000001011101010111 ; / -..-.
adrl %00000000000001110111011101110111 ; 0 -----
adrl %00000000000000011101110111011101 ; 1 .----
adrl %00000000000000000111011101110101 ; 2 ..---
adrl %00000000000000000001110111010101 ; 3 ...--
adrl %00000000000000000000011101010101 ; 4 ....-
adrl %00000000000000000000000101010101 ; 5 .....
adrl %00000000000000000000010101010111 ; 6 -....
adrl %00000000000000000001010101110111 ; 7 --...
adrl %00000000000000000101011101110111 ; 8 ---..
adrl %00000000000000010111011101110111 ; 9 ----.
adrl %00000000000000010101011101110111 ; : ---...
adrl %00000000000000010111010111010111 ; ; -.-.-.
adrl %00000000000000000000000000000000
adrl %00000000000000000001110101010111 ; = -...-
adrl %00000000000000000000000000000000
adrl %00000000000000000101011101110101 ; ? ..--..
adrl %00000000000000010111010111011101 ; @ .--.-.
adrl %00000000000000000000000000011101 ; A .-
adrl %00000000000000000000000101010111 ; B -...
adrl %00000000000000000000010111010111 ; C -.-.
adrl %00000000000000000000000001010111 ; D -..
adrl %00000000000000000000000000000001 ; E .
adrl %00000000000000000000000101110101 ; F ..-.
adrl %00000000000000000000000101110111 ; G --.
adrl %00000000000000000000000001010101 ; H ....
adrl %00000000000000000000000000000101 ; I ..
adrl %00000000000000000001110111011101 ; J .---
adrl %00000000000000000000000111010111 ; K -.-
adrl %00000000000000000000000101011101 ; L .-..
adrl %00000000000000000000000001110111 ; M --
adrl %00000000000000000000000000010111 ; N -.
adrl %00000000000000000000011101110111 ; O ---
adrl %00000000000000000000010111011101 ; P .--.
adrl %00000000000000000001110101110111 ; Q --.-
adrl %00000000000000000000000001011101 ; R .-.
adrl %00000000000000000000000000010101 ; S ...
adrl %00000000000000000000000000000111 ; T -
adrl %00000000000000000000000001110101 ; U ..-
adrl %00000000000000000000000111010101 ; V ...-
adrl %00000000000000000000000111011101 ; W .--
adrl %00000000000000000000011101010111 ; X -..-
adrl %00000000000000000001110111010111 ; Y -.--
adrl %00000000000000000000010101110111 ; Z --..
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000011101011101110101 ; _ ..--.-
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000011101 ; a .-
adrl %00000000000000000000000101010111 ; b -...
adrl %00000000000000000000010111010111 ; c -.-.
adrl %00000000000000000000000001010111 ; d -..
adrl %00000000000000000000000000000001 ; e .
adrl %00000000000000000000000101110101 ; f ..-.
adrl %00000000000000000000000101110111 ; g --.
adrl %00000000000000000000000001010101 ; h ....
adrl %00000000000000000000000000000101 ; i ..
adrl %00000000000000000001110111011101 ; j .---
adrl %00000000000000000000000111010111 ; k -.-
adrl %00000000000000000000000101011101 ; l .-..
adrl %00000000000000000000000001110111 ; m --
adrl %00000000000000000000000000010111 ; n -.
adrl %00000000000000000000011101110111 ; o ---
adrl %00000000000000000000010111011101 ; p .--.
adrl %00000000000000000001110101110111 ; q --.-
adrl %00000000000000000000000001011101 ; r .-.
adrl %00000000000000000000000000010101 ; s ...
adrl %00000000000000000000000000000111 ; t -
adrl %00000000000000000000000001110101 ; u ..-
adrl %00000000000000000000000111010101 ; v ...-
adrl %00000000000000000000000111011101 ; w .--
adrl %00000000000000000000011101010111 ; x -..-
adrl %00000000000000000001110111010111 ; y -.--
adrl %00000000000000000000010101110111 ; z --..
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
adrl %00000000000000000000000000000000
old_irq ds 4
quit ds 2
@ -455,7 +608,8 @@ _active ds 2
_template ds 4
_on ds 2
_index ds 2
_buffer ds 256
*_buffer ds 256
_buffer asc 'SOS SOS SOS',00
sav morse.l
lst on