mirror of
https://github.com/ksherlock/morse-gs.git
synced 2025-01-16 15:29:43 +00:00
desktop version.
This commit is contained in:
parent
9c6e9fb850
commit
ad096c5654
416
morse.rez
Normal file
416
morse.rez
Normal file
@ -0,0 +1,416 @@
|
||||
|
||||
#include "Types.rez"
|
||||
|
||||
#define WIN_HEIGHT 100
|
||||
#define WIN_WIDTH 400
|
||||
#define MENU_HEIGHT 12
|
||||
#define BUTTON_HEIGHT 13
|
||||
#define BUTTON_WIDTH 90
|
||||
#define kPlayID 1
|
||||
#define kStopID 2
|
||||
|
||||
resource rWindParam1 (0x1000) {
|
||||
0x8020,
|
||||
0x1000E,
|
||||
0x0,
|
||||
{0, 0, 0, 0},
|
||||
0x1000,
|
||||
{0, 0},
|
||||
{0, 0},
|
||||
{0, 0},
|
||||
{0, 0},
|
||||
{0, 0},
|
||||
0x0,
|
||||
0,
|
||||
{62, 120, 162, 520},
|
||||
infront,
|
||||
0x1000,
|
||||
0xA09
|
||||
};
|
||||
|
||||
resource rWindColor (0x1000) {
|
||||
0x0, // frame
|
||||
0xF0F, // title/close/zoom
|
||||
0x0, // tbar
|
||||
0xF0FF, // grow
|
||||
0xF0 // info
|
||||
};
|
||||
|
||||
|
||||
resource rControlList (0x1000) {
|
||||
{
|
||||
0x1,
|
||||
0x2,
|
||||
0x3,
|
||||
}
|
||||
};
|
||||
|
||||
resource rControlTemplate (0x1) {
|
||||
0x2,
|
||||
{4, 4, WIN_HEIGHT - 21, WIN_WIDTH - 4},
|
||||
editTextControl {
|
||||
{ /* optional Fields */
|
||||
0x0,
|
||||
0x7400,
|
||||
0x3,
|
||||
0x23A80000,
|
||||
{-1, -1, -1, -1},
|
||||
0x0,
|
||||
0,
|
||||
0x0,
|
||||
0,
|
||||
0x0,
|
||||
0x15,
|
||||
0x4,
|
||||
0,
|
||||
255, /* max chars */
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0x0,
|
||||
0x0,
|
||||
0x0
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
resource rControlTemplate (0x2) {
|
||||
0x4,
|
||||
{WIN_HEIGHT - 4 - BUTTON_HEIGHT, 4, WIN_HEIGHT - 4, 4 + BUTTON_WIDTH},
|
||||
SimpleButtonControl {
|
||||
{ /* optional Fields */
|
||||
0x3,
|
||||
0x3002,
|
||||
kPlayID,
|
||||
0x1000F,
|
||||
0x0,
|
||||
{
|
||||
"\n",
|
||||
"\n",
|
||||
0x100,
|
||||
0x100
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
resource rControlTemplate (0x3) {
|
||||
0x5,
|
||||
{WIN_HEIGHT - 4 - BUTTON_HEIGHT, WIN_WIDTH - 4 - BUTTON_WIDTH, WIN_HEIGHT - 4, WIN_WIDTH - 4},
|
||||
SimpleButtonControl {
|
||||
{ /* optional Fields */
|
||||
0x2,
|
||||
0x3002,
|
||||
kStopID,
|
||||
0x10010,
|
||||
0x0,
|
||||
{
|
||||
".",
|
||||
".",
|
||||
0x100,
|
||||
0x100
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
resource rPString (0x1, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
"@"
|
||||
};
|
||||
|
||||
resource rPString (0x2, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
" File "
|
||||
};
|
||||
|
||||
resource rPString (0x3, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
" Edit "
|
||||
};
|
||||
|
||||
resource rPString (0xFA, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
"Undo"
|
||||
};
|
||||
|
||||
resource rPString (0xFB, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
"Cut"
|
||||
};
|
||||
|
||||
resource rPString (0xFC, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
"Copy"
|
||||
};
|
||||
|
||||
resource rPString (0xFD, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
"Paste"
|
||||
};
|
||||
|
||||
resource rPString (0xFE, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
"Clear"
|
||||
};
|
||||
|
||||
resource rPString (0xFF, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
"Close"
|
||||
};
|
||||
|
||||
resource rPString (0x100, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
"About..."
|
||||
};
|
||||
|
||||
resource rPString (0x101, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
"Quit"
|
||||
};
|
||||
|
||||
/*
|
||||
resource rPString (0x102, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
"New"
|
||||
};
|
||||
|
||||
resource rPString (0x103, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
"Open..."
|
||||
};
|
||||
|
||||
resource rPString (0x104, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
"Save"
|
||||
};
|
||||
|
||||
resource rPString (0x105, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
"Save as..."
|
||||
};
|
||||
|
||||
resource rPString (0x106, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
"Revert to saved"
|
||||
};
|
||||
|
||||
|
||||
*/
|
||||
|
||||
resource rPString (0x1000E) {
|
||||
" -- --- .-. ... . "
|
||||
};
|
||||
|
||||
resource rPString (0x1000F) {
|
||||
"Play"
|
||||
};
|
||||
|
||||
resource rPString (0x10010) {
|
||||
"Stop"
|
||||
};
|
||||
|
||||
resource rMenuBar (0x1, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
{
|
||||
0x1,
|
||||
0x2,
|
||||
0x3,
|
||||
}
|
||||
};
|
||||
|
||||
resource rMenu (0x1, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
0x1,
|
||||
0xA008,
|
||||
0x1,
|
||||
{
|
||||
0x100,
|
||||
}
|
||||
};
|
||||
|
||||
resource rMenu (0x2, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
0x2,
|
||||
0xA008,
|
||||
0x2,
|
||||
{
|
||||
0xFF,
|
||||
0x101,
|
||||
}
|
||||
};
|
||||
|
||||
resource rMenu (0x3, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
0x3,
|
||||
0xA008,
|
||||
0x3,
|
||||
{
|
||||
0xFA,
|
||||
0xFB,
|
||||
0xFC,
|
||||
0xFD,
|
||||
0xFE,
|
||||
}
|
||||
};
|
||||
|
||||
resource rMenuItem (0xFA, nocrossbank, nospecialmemory) {
|
||||
0xFA,
|
||||
"Z",
|
||||
"z",
|
||||
0x0,
|
||||
0x8040,
|
||||
0xFA
|
||||
};
|
||||
|
||||
resource rMenuItem (0xFB, nocrossbank, nospecialmemory) {
|
||||
0xFB,
|
||||
"X",
|
||||
"x",
|
||||
0x0,
|
||||
0x8000,
|
||||
0xFB
|
||||
};
|
||||
|
||||
resource rMenuItem (0xFC, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
0xFC,
|
||||
"C",
|
||||
"c",
|
||||
0x0,
|
||||
0x8000,
|
||||
0xFC
|
||||
};
|
||||
|
||||
resource rMenuItem (0xFD, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
0xFD,
|
||||
"V",
|
||||
"v",
|
||||
0x0,
|
||||
0x8000,
|
||||
0xFD
|
||||
};
|
||||
|
||||
resource rMenuItem (0xFE, nocrossbank, nospecialmemory) {
|
||||
0xFE,
|
||||
"",
|
||||
"",
|
||||
0x0,
|
||||
0x8000,
|
||||
0xFE
|
||||
};
|
||||
|
||||
resource rMenuItem (0xFF, nocrossbank, nospecialmemory) {
|
||||
0xFF,
|
||||
"W",
|
||||
"w",
|
||||
0x0,
|
||||
0x8000,
|
||||
0xFF
|
||||
};
|
||||
|
||||
resource rMenuItem (0x100, nocrossbank, nospecialmemory) {
|
||||
0x100,
|
||||
"",
|
||||
"",
|
||||
0x0,
|
||||
0x8040,
|
||||
0x100
|
||||
};
|
||||
|
||||
resource rMenuItem (0x101, nocrossbank, nospecialmemory) {
|
||||
0x101,
|
||||
"Q",
|
||||
"q",
|
||||
0x0,
|
||||
0x8000,
|
||||
0x101
|
||||
};
|
||||
|
||||
/*
|
||||
resource rMenuItem (0x102, nocrossbank, nospecialmemory) {
|
||||
0x102,
|
||||
"N",
|
||||
"n",
|
||||
0x0,
|
||||
0x8000,
|
||||
0x102
|
||||
};
|
||||
|
||||
resource rMenuItem (0x103, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
0x103,
|
||||
"O",
|
||||
"o",
|
||||
0x0,
|
||||
0x8040,
|
||||
0x103
|
||||
};
|
||||
|
||||
resource rMenuItem (0x104, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
0x104,
|
||||
"S",
|
||||
"s",
|
||||
0x0,
|
||||
0x8000,
|
||||
0x104
|
||||
};
|
||||
|
||||
resource rMenuItem (0x105, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
0x105,
|
||||
"",
|
||||
"",
|
||||
0x0,
|
||||
0x8000,
|
||||
0x105
|
||||
};
|
||||
|
||||
resource rMenuItem (0x106, locked, fixed, nocrossbank, nospecialmemory) {
|
||||
0x106,
|
||||
"",
|
||||
"",
|
||||
0x0,
|
||||
0x8040,
|
||||
0x106
|
||||
};
|
||||
*/
|
||||
|
||||
resource rToolStartup (0x1) {
|
||||
0xC080,
|
||||
{
|
||||
0x3, 0x300,
|
||||
0x4, 0x301,
|
||||
0x5, 0x302,
|
||||
0x6, 0x300,
|
||||
0xB, 0x200,
|
||||
0xE, 0x301,
|
||||
0xF, 0x301,
|
||||
0x10, 0x301,
|
||||
0x12, 0x301,
|
||||
0x13, 0x300,
|
||||
0x14, 0x301,
|
||||
0x15, 0x301,
|
||||
0x16, 0x300,
|
||||
0x17, 0x301,
|
||||
0x1B, 0x301,
|
||||
0x1C, 0x301,
|
||||
0x1E, 0x100,
|
||||
0x22, 0x101
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
resource rAlertString (0x1) {
|
||||
"40~"
|
||||
".... .- -.-. -.- ..-. . ... -"
|
||||
" ..--- ----- ..--- -----"
|
||||
"\n\n\n"
|
||||
"-.- . .-.. ...- .. -."
|
||||
" ... .... . .-. .-.. --- -.-. -.-"
|
||||
"~^Ok\0x00"
|
||||
};
|
||||
|
||||
resource rText (0x4) {
|
||||
"CDQ"
|
||||
};
|
||||
|
||||
resource rVersion (0x1) {
|
||||
{
|
||||
0x1,
|
||||
0x0,
|
||||
0x0,
|
||||
release,
|
||||
0x0
|
||||
},
|
||||
verUS,
|
||||
"-- --- .-. ... .",
|
||||
"-- --- .-. ... ."
|
||||
};
|
||||
|
||||
resource rComment (0x1) {
|
||||
".... .- -.-. -.- ..-. . ... -"
|
||||
" ..--- ----- ..--- -----"
|
||||
"\n\n\n"
|
||||
"-.- . .-.. ...- .. -."
|
||||
" ... .... . .-. .-.. --- -.-. -.-"
|
||||
};
|
||||
|
796
morse16.s
Normal file
796
morse16.s
Normal file
@ -0,0 +1,796 @@
|
||||
|
||||
lst off
|
||||
rel
|
||||
xc
|
||||
xc
|
||||
|
||||
use morse.equ
|
||||
use e16.window
|
||||
use e16.event
|
||||
use e16.types
|
||||
use e16.control
|
||||
|
||||
tbx on
|
||||
|
||||
|
||||
beep_left equ 0
|
||||
beep_right equ 1
|
||||
noise_left equ 2
|
||||
noise_right equ 3
|
||||
timer_1 equ 4
|
||||
timer_3 equ 5
|
||||
timer_7 equ 6
|
||||
|
||||
|
||||
bic mac
|
||||
if #=]1
|
||||
and ]1!$ffff
|
||||
else
|
||||
err 1 ; immediate only.
|
||||
fin
|
||||
<<<
|
||||
|
||||
docwait mac
|
||||
if MX<2
|
||||
err 1 ; 8-bit m only
|
||||
fin
|
||||
wait lda >SoundCtrl
|
||||
bmi wait
|
||||
<<<
|
||||
|
||||
docmode mac
|
||||
docwait
|
||||
* lda >SoundAddr
|
||||
bic #%01000000 ; DOC mode
|
||||
ora #%00100000 ; auto-incr
|
||||
sta >SoundCtrl
|
||||
<<<
|
||||
|
||||
|
||||
main
|
||||
mx %00
|
||||
phk
|
||||
plb
|
||||
|
||||
sta MyID
|
||||
jsr init
|
||||
|
||||
jsr mainloop
|
||||
|
||||
jsr shutdown
|
||||
_GSOS:Quit :QuitDCB
|
||||
brk $ea
|
||||
|
||||
:QuitDCB dw 2
|
||||
adrl 0
|
||||
dw 0
|
||||
|
||||
mainloop
|
||||
|
||||
|
||||
psl #0 ; result
|
||||
psl #0
|
||||
psl #0
|
||||
psl #draw_window
|
||||
psl #0
|
||||
psl #refIsResource
|
||||
psl #kWindowID
|
||||
psw #rWindParam1
|
||||
_NewWindow2
|
||||
pll window
|
||||
|
||||
psl window
|
||||
_ShowWindow
|
||||
|
||||
_InitCursor
|
||||
stz quit
|
||||
|
||||
lda #$0001ffff
|
||||
sta event+owmTaskMask
|
||||
lda #^$0001ffff
|
||||
sta event+owmTaskMask+2
|
||||
|
||||
:loop
|
||||
pha
|
||||
psw #-1
|
||||
psl event
|
||||
_TaskMaster
|
||||
pla
|
||||
cmp #table_size+1
|
||||
bcs :loop
|
||||
|
||||
asl a
|
||||
jsr (:table,x)
|
||||
lda quit
|
||||
beq :loop
|
||||
|
||||
:rts
|
||||
rts
|
||||
|
||||
:table
|
||||
dw :idle ; null
|
||||
dw :rts ; mouse down
|
||||
dw :rts ; mouse up
|
||||
dw :rts ; key down
|
||||
dw :rts ; auto key down
|
||||
dw :rts
|
||||
dw :rts ; update
|
||||
dw :rts
|
||||
dw :rts ; activate
|
||||
dw :rts ; switch
|
||||
dw :rts ; desk acc.
|
||||
dw :rts ; driver
|
||||
dw :rts ; app 1
|
||||
dw :rts ; app 2
|
||||
dw :rts ; app 3
|
||||
dw :rts ; app 4
|
||||
dw :rts ; wInDesk
|
||||
dw :menu ; wInMenuBar
|
||||
dw :rts ; wClickCalled
|
||||
dw :rts ; wInContent
|
||||
dw :rts ; wInDrag
|
||||
dw :rts ; wInGrow
|
||||
dw bye ; wInGoAway
|
||||
dw :rts ; wInZoom
|
||||
dw :rts ; wInInfo
|
||||
dw :menu ; wInSpecial menu 250-255
|
||||
dw :rts ; wInDeskItem menu 1-249
|
||||
dw :rts ; wInFrame
|
||||
dw :rts ; wInactMenu
|
||||
dw :rts ; wClosedNDA
|
||||
dw :rts ; wCalledSysEdit
|
||||
dw :rts ; wTrackZoom
|
||||
dw :rts ; wHitFrame
|
||||
dw :control ; wInControl
|
||||
dw :rts ; wInControlMenu
|
||||
:table_size = {*-:table}/2
|
||||
|
||||
:idle
|
||||
lda _finished
|
||||
beq :rts
|
||||
stz _finished
|
||||
bra stopped
|
||||
|
||||
bye
|
||||
lda #1
|
||||
sta quit
|
||||
rts
|
||||
|
||||
|
||||
menu
|
||||
lda event+owmTaskData
|
||||
sec
|
||||
sbc #250
|
||||
cmp #:table_size+1
|
||||
bcs :xmenu
|
||||
|
||||
asl a
|
||||
tax
|
||||
jsr (:table,x)
|
||||
:xmenu
|
||||
psw #0
|
||||
psw :event+owmTaskData+2
|
||||
_HiliteMenu
|
||||
:rts rts
|
||||
|
||||
:table
|
||||
dw :rts ; 250 undo
|
||||
dw :rts ; 251 cut
|
||||
dw :rts ; 252 copy
|
||||
dw :rts ; 253 paste
|
||||
dw :rts ; 254 clear
|
||||
dw :rts ; 255 close
|
||||
dw bye ; 256 - quit
|
||||
dw about
|
||||
:table_size = {*-:table}/2
|
||||
|
||||
|
||||
|
||||
control
|
||||
lda event+owmTaskData4 ; id of control selected.
|
||||
cmp #:table_size+1
|
||||
bcs :rts
|
||||
asl
|
||||
tax
|
||||
jmp (:table,x)
|
||||
:rts rts
|
||||
|
||||
:table
|
||||
dw :rts ; 0 - none
|
||||
dw play
|
||||
dw stop
|
||||
:table_size = {*-:table}/2
|
||||
|
||||
|
||||
play
|
||||
* copy text to the buffer and start audio.
|
||||
|
||||
pha
|
||||
pha
|
||||
psw #%00000000000_00_001 ; c-string, ptr
|
||||
psl #_buffer
|
||||
psl #256
|
||||
psw #0 ; style
|
||||
psl #0 ; style ref
|
||||
psl #0 ; teHandle.
|
||||
_TEGetText
|
||||
pla
|
||||
pla
|
||||
sta :len
|
||||
bcs :err
|
||||
beq :err
|
||||
|
||||
jsr buffer_to_buffer
|
||||
|
||||
* can use key filter to block invalid characters....
|
||||
* copy/convert :buffer to _buffer -still needed for space elimination,
|
||||
* disable text edit?
|
||||
* disable play button
|
||||
* enable stop button
|
||||
* queue up playing
|
||||
|
||||
psw #inactiveHilite
|
||||
psl window ; window
|
||||
psl #kPlayID
|
||||
_HiliteCtlByID
|
||||
|
||||
psw #noHilite
|
||||
psl window ; window
|
||||
psl #kStopID
|
||||
_HiliteCtlByID
|
||||
|
||||
jsr start_audio
|
||||
|
||||
:err rts
|
||||
|
||||
:len ds 2
|
||||
|
||||
buffer_to_buffer
|
||||
:c equ 0
|
||||
|
||||
lda #0
|
||||
ldx #0
|
||||
ldy #0
|
||||
stz :c
|
||||
|
||||
sep $20
|
||||
|
||||
:loop lda _buffer,x
|
||||
beq :eof
|
||||
bmi :space
|
||||
cmp #' '+1
|
||||
bcc :space
|
||||
phx
|
||||
tax
|
||||
bit valid,x
|
||||
plx
|
||||
bvc :space
|
||||
sta _buffer,y
|
||||
inx
|
||||
iny
|
||||
stz :c
|
||||
bra :loop
|
||||
|
||||
:space inx
|
||||
lda :c
|
||||
bne ]loop
|
||||
inc :c
|
||||
lda #' '
|
||||
sta _buffer,y
|
||||
iny
|
||||
bra :loop
|
||||
|
||||
:eof sta _buffer,y
|
||||
rep $20
|
||||
rts
|
||||
|
||||
|
||||
stop
|
||||
jsr stop_audio
|
||||
|
||||
stopped
|
||||
* enable controls
|
||||
psw #noHilite
|
||||
psl window ; window
|
||||
psl #kPlayID
|
||||
_HiliteCtlByID
|
||||
|
||||
psw #inactiveHilite
|
||||
psl window ; window
|
||||
psl #kStopID
|
||||
_HiliteCtlByID
|
||||
|
||||
|
||||
rts
|
||||
|
||||
|
||||
|
||||
jsr init
|
||||
jsr start
|
||||
|
||||
sep $30
|
||||
]wait lda _active
|
||||
beq :done
|
||||
|
||||
lda >$e0c000 ; keydown - exit.
|
||||
bpl ]wait
|
||||
sta >$e0c010
|
||||
|
||||
:done
|
||||
rep $30
|
||||
jsr shutdown
|
||||
|
||||
|
||||
lda #0
|
||||
rtl
|
||||
|
||||
|
||||
start_audio
|
||||
mx %00
|
||||
|
||||
stz _index
|
||||
stz _template
|
||||
stz _template+2
|
||||
stz _on
|
||||
stz _active
|
||||
stz _finished
|
||||
|
||||
sep $30
|
||||
|
||||
docmode
|
||||
|
||||
* start osc 0-3 w/ volume 0.
|
||||
|
||||
lda #$40
|
||||
sta >SoundAddr
|
||||
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_00_1 ; free-run, disabled
|
||||
sta >SoundData
|
||||
lda #%0001_0_00_1 ; free-run, disabled
|
||||
sta >SoundData
|
||||
lda #%0000_0_00_0 ; free-run, enabled
|
||||
sta >SoundData
|
||||
lda #%0001_0_00_0 ; free-run, enabled
|
||||
sta >SoundData
|
||||
|
||||
* volume, again.
|
||||
lda #$40
|
||||
sta >SoundAddr
|
||||
lda #$ff
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
|
||||
|
||||
* trigger the timing oscillator.
|
||||
lda #$a0+timer_1
|
||||
sta >SoundAddr
|
||||
lda #%0000_1_01_0 ; one-shot, enabled, interrupt
|
||||
sta >SoundData
|
||||
rep $30
|
||||
|
||||
inc _active
|
||||
|
||||
rts
|
||||
|
||||
shutdown
|
||||
mx %00
|
||||
jsr stop_audio
|
||||
|
||||
psw #$b
|
||||
psl old_irq
|
||||
_SetVector
|
||||
|
||||
psw #refIsHandle
|
||||
psl tools
|
||||
_ShutDownTools
|
||||
psw MyID
|
||||
_MMShutDown
|
||||
_TLShutDown
|
||||
|
||||
rts
|
||||
|
||||
stop_audio
|
||||
mx %00
|
||||
stz _active
|
||||
|
||||
* shut off all oscillators.
|
||||
sep $30
|
||||
|
||||
docmode
|
||||
|
||||
lda #$a0
|
||||
sta >SoundAddr
|
||||
lda #%0000_0_01_1 ; one-shot, disabled, nointerrupt
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
|
||||
rep #$30
|
||||
stz _finished
|
||||
|
||||
rts
|
||||
|
||||
audio_irq
|
||||
mx %11
|
||||
|
||||
lda >_active
|
||||
bne :ok
|
||||
clc
|
||||
rtl
|
||||
|
||||
:ok
|
||||
phb
|
||||
phk
|
||||
plb
|
||||
|
||||
docmode
|
||||
|
||||
rep $30
|
||||
|
||||
lsr _template+2
|
||||
ror _template
|
||||
|
||||
sep $30
|
||||
bcc :off
|
||||
* lda _on
|
||||
* bne :trigger1
|
||||
* ldx #$ff
|
||||
* stx _on
|
||||
jsr beep_on
|
||||
* jsr setvolume
|
||||
|
||||
|
||||
:trigger1 ; osc 5 interrupt on
|
||||
lda #$a0+timer_1
|
||||
sta >SoundAddr
|
||||
lda #%0000_1_01_0 ; one-shot, enabled, interrupt
|
||||
sta >SoundData
|
||||
bra :exit
|
||||
|
||||
:off
|
||||
* turn off sound generators.
|
||||
* stz _on
|
||||
* ldx #0
|
||||
* jsr setvolume
|
||||
jsr beep_off
|
||||
|
||||
|
||||
* check for advance...
|
||||
lda _template
|
||||
bne :trigger1
|
||||
|
||||
rep $30
|
||||
ldx _index
|
||||
lda _buffer,x
|
||||
and #$7f
|
||||
beq :fini
|
||||
|
||||
inx
|
||||
stx _index
|
||||
cmp #' '+1
|
||||
blt :space
|
||||
|
||||
asl
|
||||
asl
|
||||
tax
|
||||
lda table,x
|
||||
sta _template
|
||||
lda table+2,x
|
||||
sta _template+2
|
||||
sep $30
|
||||
* bra :trigger3 ; inter-char delay.
|
||||
|
||||
:trigger3 ; osc 6 interrupt on
|
||||
lda #$a0+timer_3
|
||||
sta >SoundAddr
|
||||
lda #%0000_1_01_0 ; one-shot, enabled, interrupt
|
||||
sta >SoundData
|
||||
bra :exit
|
||||
|
||||
|
||||
|
||||
:fini mx %00
|
||||
* stz _index
|
||||
stz _active
|
||||
inc _finished
|
||||
bra :exit
|
||||
|
||||
:space mx %00
|
||||
stz _template ; should already be 0.
|
||||
stz _template+2
|
||||
sep $30
|
||||
* bra :trigger7 ; inter-word delay
|
||||
|
||||
:trigger7 ; osc 7 interrupt on
|
||||
lda #$a0+timer_7
|
||||
sta >SoundAddr
|
||||
lda #%0000_1_01_0 ; one-shot, enabled, interrupt
|
||||
sta >SoundData
|
||||
bra :exit
|
||||
|
||||
:exit
|
||||
plb
|
||||
clc
|
||||
rtl
|
||||
|
||||
beep_on
|
||||
mx %11
|
||||
lda _on
|
||||
bne :rts
|
||||
lda #$a0
|
||||
sta >SoundAddr
|
||||
lda #%0000_0_00_0 ; free-run, enabled
|
||||
sta >SoundData
|
||||
lda #%0001_0_00_0 ; free-run, enabled
|
||||
sta >SoundData
|
||||
inc _on
|
||||
|
||||
:rts rts
|
||||
|
||||
beep_off ; changes to one-shot mode so it will expire at the end of the sample
|
||||
mx %11
|
||||
lda _on
|
||||
beq :rts
|
||||
lda #$a0
|
||||
sta >SoundAddr
|
||||
lda #%0000_0_01_0 ; one-shot, enabled
|
||||
sta >SoundData
|
||||
lda #%0001_0_01_0 ; one-shot, enabled
|
||||
sta >SoundData
|
||||
stz _on
|
||||
:rts rts
|
||||
|
||||
setvolume
|
||||
mx %11
|
||||
lda #$40
|
||||
sta >SoundAddr
|
||||
txa
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
rts
|
||||
|
||||
|
||||
|
||||
init
|
||||
mx %00
|
||||
|
||||
_TLStartUp
|
||||
psl #0
|
||||
psw MyID
|
||||
psw #refIsResource
|
||||
psl #1
|
||||
_StartUpTools
|
||||
pll tools
|
||||
|
||||
psl #0
|
||||
psw #refIsResource
|
||||
psl #1
|
||||
psl #0
|
||||
_NewMenuBar2
|
||||
_SetSysBar
|
||||
|
||||
psl #0
|
||||
_SetMenuBar
|
||||
|
||||
psw #1
|
||||
_FixAppleMenu
|
||||
|
||||
pha
|
||||
_FixMenuBar
|
||||
_DrawMenuBar
|
||||
|
||||
jsr init_audio
|
||||
rts
|
||||
|
||||
init_audio
|
||||
pha
|
||||
pha
|
||||
psw #$b
|
||||
_GetVector
|
||||
pll old_irq
|
||||
|
||||
psw #$b
|
||||
psl #audio_irq
|
||||
_SetVector
|
||||
|
||||
sep $30
|
||||
|
||||
docmode
|
||||
|
||||
|
||||
* halt all oscillators.
|
||||
ldy #$20-7
|
||||
lda #$a0
|
||||
sta >SoundAddr
|
||||
|
||||
* osc 1-4 are free-run, halted, stereo pairs.
|
||||
lda #%0000_0_00_1 ; free-run, halted
|
||||
sta >SoundData
|
||||
lda #%0001_0_00_1 ; free-run, halted
|
||||
sta >SoundData
|
||||
lda #%0000_0_00_1 ; free-run, halted
|
||||
sta >SoundData
|
||||
lda #%0001_0_00_1 ; free-run, halted
|
||||
sta >SoundData
|
||||
|
||||
* 5-7 are one-shot, interrupt enabled, halted.
|
||||
lda #%0000_1_01_1 ; one-shot, halted, interrupt enabled.
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
|
||||
* all others - halted.
|
||||
lda #%0000_0_01_1 ; one-shot, halted
|
||||
]loop sta >SoundData
|
||||
dey
|
||||
bne ]loop
|
||||
|
||||
|
||||
* volume 0
|
||||
ldy #$20
|
||||
lda #$40
|
||||
sta >SoundAddr
|
||||
lda #0
|
||||
]loop sta >SoundData
|
||||
dey
|
||||
bne ]loop
|
||||
|
||||
|
||||
* 32 oscillators.
|
||||
|
||||
lda #$e1
|
||||
sta >SoundAddr
|
||||
lda #31*2
|
||||
sta >SoundData
|
||||
|
||||
* osc 1/2 are 256 bytes, running at the natural rate.
|
||||
|
||||
* osc 5/6/7 are 256 bytes, running at 1 / 3 / 6 time units
|
||||
|
||||
* frequency low registers
|
||||
lda #$00
|
||||
sta >SoundAddr
|
||||
lda #<$0200 ; low
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
* lda #>$0180
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
|
||||
lda #<5103
|
||||
sta >SoundData
|
||||
lda #<1701
|
||||
sta >SoundData
|
||||
lda #<729
|
||||
sta >SoundData
|
||||
|
||||
* freq high
|
||||
lda #$20
|
||||
sta >SoundAddr
|
||||
lda #>$0200
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
* lda #>$0180
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
|
||||
lda #>5103
|
||||
sta >SoundData
|
||||
lda #>1701
|
||||
sta >SoundData
|
||||
lda #>729
|
||||
sta >SoundData
|
||||
|
||||
|
||||
|
||||
* wave table pointer
|
||||
lda #$80
|
||||
sta >SoundAddr
|
||||
lda #$00 ; page 0
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
inc ; page 1
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
* inc ; page 2
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
|
||||
* wave table size registers
|
||||
lda #$c0
|
||||
sta >SoundAddr
|
||||
* 1-4 use 256 byte date, 9-bit shift.
|
||||
lda #%00000000
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
* 5-7 use 256 byte data, 16-bit shift
|
||||
lda #%00_000_111
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
sta >SoundData
|
||||
|
||||
|
||||
* now load data...
|
||||
|
||||
docwait
|
||||
|
||||
ora #%01100000 ; ram mode, incr
|
||||
sta >SoundCtrl
|
||||
|
||||
lda #0
|
||||
sta >SoundAddr
|
||||
sta >SoundAddr+1
|
||||
|
||||
ldx #0
|
||||
]loop lda beep_f5,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
|
||||
|
||||
|
||||
rep #$30
|
||||
|
||||
rts
|
||||
|
||||
|
||||
lst off
|
||||
put tables
|
||||
|
||||
old_irq ds 4
|
||||
quit ds 2
|
||||
|
||||
tools ds 4
|
||||
window ds 4
|
||||
MyID ds 2
|
||||
|
||||
|
||||
quit ds 2
|
||||
event ds wmTaskRecSize
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_active ds 2
|
||||
_finished ds 2
|
||||
_on ds 2
|
||||
|
||||
_template ds 4
|
||||
_index ds 2
|
||||
_buffer ds 256
|
||||
*_buffer asc 'Apple 2 forever',00
|
||||
|
||||
dat 8
|
||||
|
||||
sav morse16.l
|
||||
* lst on
|
||||
sym
|
||||
|
322
tables.s
Normal file
322
tables.s
Normal file
@ -0,0 +1,322 @@
|
||||
|
||||
* 26300 hz
|
||||
* want a 256-byte B5 sine wav
|
||||
* coeff = 2 * PI * 987.767 / 26300 = 0.23598186697022278
|
||||
* PI/2/coeff = 6.656428084760879
|
||||
* PI/2/6.4 = 0.2454369260617026
|
||||
* pcm = [128 + round(127 * sin(n*xx)) for n in range(0,256)]
|
||||
|
||||
|
||||
beep_b5
|
||||
hex 809fbcd5eaf8fefef5e6d1b6997a5b3f
|
||||
hex 26130601030d1e344f6d8cabc7def0fb
|
||||
hex fffbf0dec7ab8c6d4f341e0d03010613
|
||||
hex 263f5b7a99b6d1e6f5fefef8ead5bc9f
|
||||
hex 8061442b160802020b1a2f4a6786a5c1
|
||||
hex daedfafffdf3e2ccb193745539221005
|
||||
hex 0105102239557493b1cce2f3fdfffaed
|
||||
hex dac1a586674a2f1a0b020208162b4461
|
||||
hex 809fbcd5eaf8fefef5e6d1b6997a5b3f
|
||||
hex 26130601030d1e344f6d8cabc7def0fb
|
||||
hex fffbf0dec7ab8c6d4f341e0d03010613
|
||||
hex 263f5b7a99b6d1e6f5fefef8ead5bc9f
|
||||
hex 8061442b160802020b1a2f4a6786a5c1
|
||||
hex daedfafffdf3e2ccb193745539221005
|
||||
hex 0105102239557493b1cce2f3fdfffaed
|
||||
hex dac1a586674a2f1a0b020208162b4461
|
||||
|
||||
beep_f5
|
||||
hex 8096abbfd1e0edf6fdfffef9f0e4d5c4
|
||||
hex b19c86705b473424160c050102060d18
|
||||
hex 26374a5e74899fb3c7d8e6f1fafefffc
|
||||
hex f5ebdecebca8937d67523f2d1e110803
|
||||
hex 010308111e2d3f52677d93a8bccedeeb
|
||||
hex f5fcfffefaf1e6d8c7b39f89745e4a37
|
||||
hex 26180d060201050c162434475b70869c
|
||||
hex b1c4d5e4f0f9fefffdf6ede0d1bfab96
|
||||
hex 806a55412f20130a03010207101c2b3c
|
||||
hex 4f647a90a5b9ccdceaf4fbfffefaf3e8
|
||||
hex dac9b6a28c77614d39281a0f06020104
|
||||
hex 0b15223244586d8399aec1d3e2eff8fd
|
||||
hex fffdf8efe2d3c1ae99836d5844322215
|
||||
hex 0b040102060f1a28394d61778ca2b6c9
|
||||
hex dae8f3fafefffbf4eadcccb9a5907a64
|
||||
hex 4f3c2b1c10070201030a13202f41556a
|
||||
|
||||
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
|
||||
|
||||
valid
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $00
|
||||
db $40 ; ! ..--.
|
||||
db $40 ; " .-..-.
|
||||
db $40 ; # .-...
|
||||
db $40 ; $ ...-..-
|
||||
db $40 ; % -...-.-
|
||||
db $40 ; & ...-.-
|
||||
db $40 ; ' .----.
|
||||
db $40 ; ( -.--.
|
||||
db $40 ; ) -.--.-
|
||||
db $40 ; * ...-.
|
||||
db $40 ; + .-.-.
|
||||
db $40 ; , --..--
|
||||
db $40 ; - -....-
|
||||
db $40 ; . .-.-.-
|
||||
db $40 ; / -..-.
|
||||
db $40 ; 0 -----
|
||||
db $40 ; 1 .----
|
||||
db $40 ; 2 ..---
|
||||
db $40 ; 3 ...--
|
||||
db $40 ; 4 ....-
|
||||
db $40 ; 5 .....
|
||||
db $40 ; 6 -....
|
||||
db $40 ; 7 --...
|
||||
db $40 ; 8 ---..
|
||||
db $40 ; 9 ----.
|
||||