# HG changeset patch # User boisy # Date 1061137529 0 # Node ID 5bced1e03639ed8fd0f69caaaddea6a740226415 # Parent 50d6f82d16d9e693fb0163501e9fb5a135174c79 Changed to new naming convention diff -r 50d6f82d16d9 -r 5bced1e03639 level2/modules/keydrv.asm --- a/level2/modules/keydrv.asm Sun Aug 17 13:05:02 2003 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,333 +0,0 @@ -******************************************************************** -* KeyDrv - Keyboard Driver for CoCo 3 -* -* $Id$ -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* 4 L2 Upgrade distribution version -* Annotations by Robert Gault RG 98/10/10 - - nam KeyDrv - ttl Keyboard Driver for CoCo 3 - -* Disassembled 98/09/09 09:02:10 by Disasm v1.6 (C) 1988 by RML - - ifp1 - use defsfile - endc - -tylg set Systm+Objct -atrv set ReEnt+rev -rev set $01 -edition equ 4 - - mod eom,name,tylg,atrv,start,size -size equ . - -name fcs /KeyDrv/ - fcb edition - -start lbra Init init/term; CLRB RTS - lbra Term - lbra FuncKeys test for keys F1, F2 - -ReadKys ldu L01DC,pcr decode table - lda b,x - bmi L00F6 if regA = $81 - $84 -* several entries to this routine from any key press; regA is already ASCII -L00E0 ldb ,’} -* fcb ’/,’?,’\ -* fcb ENTER,ENTER,ENTER -* I think these are for ALT -* fcb $82,$83,$84 -* fcb ENQ,BREAK,ESC -* the next I think are for the F1 and F2 keys -* fcb ’1,’3,’5 -* fcb ’2,’4,’6 -L01DC fdb $4060,$000c,$1c13,$0a1a,$1208,$1810,$0919,$1120 - fdb $2020,$3030,$8131,$217c,$3222,$0033,$237e,$3424 - fdb $0035,$2500,$3626,$0037,$275e,$3828,$5b39,$295d - fdb $3a2a,$003b,$2b7f,$2c3c,$7b2d,$3d5f,$2e3e,$7d2f - fdb $3f5c,$0d0d,$0d82,$8384,$0503,$1b31,$3335,$3234 - fcb $36 - -Init -Term clrb - rts - -FuncKeys ldu L01DC,pcr decode table + lda b,x + bmi L00F6 if regA = $81 - $84 +* several entries to this routine from any key press; regA is already ASCII +L00E0 ldb ,’} +* fcb ’/,’?,’\ +* fcb ENTER,ENTER,ENTER +* I think these are for ALT +* fcb $82,$83,$84 +* fcb ENQ,BREAK,ESC +* the next I think are for the F1 and F2 keys +* fcb ’1,’3,’5 +* fcb ’2,’4,’6 +L01DC fdb $4060,$000c,$1c13,$0a1a,$1208,$1810,$0919,$1120 + fdb $2020,$3030,$8131,$217c,$3222,$0033,$237e,$3424 + fdb $0035,$2500,$3626,$0037,$275e,$3828,$5b39,$295d + fdb $3a2a,$003b,$2b7f,$2c3c,$7b2d,$3d5f,$2e3e,$7d2f + fdb $3f5c,$0d0d,$0d82,$8384,$0503,$1b31,$3335,$3234 + fcb $36 + +Init +Term clrb + rts + +FuncKeys ldu KKD 88/11/14 -* 6 Upgrade to edition 3 from Monk-o-Ware BGP 98/09/26 - - nam SndDrv - ttl Sound Driver for CoCo 3 - - ifp1 - use defsfile - endc - -* SYSTEM MAP GLOBALS: - -rev set 1 -edition set 3 - - mod sndlen,sndnam,systm+objct,reent+rev,entry,0 - -sndnam fcs "SndDrv" - fcb edition - -******************************************************* -entry lbra init init codriver - lbra getstt - lbra setstt ss.tone - lbra term terminate - -******************************************************* -* INIT: set bell vector for F$Alarm - -init leax Bell,pcr - stx >WGlobal+G.BelVec save bell vector -getstt -term -okend clrb - rts - -******************************************************* -* SETSTT: do SS.Tone ($98) calls -* SS.Tone 98 -* regs: X=vol,duration, Y=tone -* Y=path desc - -setstt ldx PD.RGS,y get user regs - ldd #$1000 check for 1-4095 range - subd R$Y,x on passed Y - lble BadArgs ..okay if less - cmpd #$1000 ..else err on $1000 - lbge BadArgs .. - tfr d,y set tone to D - - ldd R$X,x get vol, duration - stb >WGlobal+G.TnCnt save duration - ldb #1 fake cycles - anda #$3F make volume ok - bra BellTone ..do it - -BadArgs comb - ldb #E$IllArg - rts - -******************************************************* -* Bell ($07): -* can destroy D,Y - -Bell inc >WGlobal+G.BelTnF set bell flag -* lda #230/4 start value -* ldb #230/2-18 cycle repeats -* ldd #60*256+96 - ldd #$3E60 - ldy #$0060 bell freq - -* COMMON SS.TONE and BELL ROUTINE: -* A=volume byte (0-63) -* B=cycle repeats (1 means use G.TnCnt as countdown) -* Y=freq - -BellTone lsla set A for PIA D/A bits - lsla - lbeq okend okay end if just setting it - ora #2 add printer port bit - pshs a,b,x - ldx #PIA0Base save current PIA setting - lda 1,x - ldb 3,x - pshs a,b - - anda #$F7 set for sound - andb #$F7 - sta 1,x - stb 3,x - leax $20,x save PIA2 setting - lda 3,x - pshs A - ora #8 and set it too - sta 3,x - bra ToneLoop ..enter main play loop - -BellLoop lda 3,s only bell does this countdown - deca - deca - sta 3,s - anda #$F7 - ora #$02 - bra Loop2 -ToneLoop ldd 3,s get D/A byte, repeat cnt -Loop2 bsr SendByte send it (Y=tone delay) - lda #2 go back to zero - bsr SendByte send it - decb count-1 (SS.Tone always=0!) - bne BellLoop ..loop if bell cycles only << - - ldb >WGlobal+G.BelTnF is it bell? - bne ToneExit ..yes, end - ldb >WGlobal+G.TnCnt else get ticks left - bne ToneLoop and do again if any, else... - -* Note: G.TnCnt is counted down by cc3io at 60hz. - -ToneExit clr >WGlobal+G.BelTnF clear bell flag - puls A reset PIA's as before: - sta 3,x - leax -$20,x - puls a,b - sta 1,x - stb 3,x - clrb okay - puls a,b,x,pc end tone/bell. - -SendByte pshs y save delay - sta ,x store D/A byte -SendDely leay -1,y delay - bne SendDely for tone - puls y,pc retn. - - emod -sndlen equ * - end diff -r 50d6f82d16d9 -r 5bced1e03639 level2/modules/snddrv_cc3.asm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level2/modules/snddrv_cc3.asm Sun Aug 17 16:25:29 2003 +0000 @@ -0,0 +1,148 @@ +******************************************************************** +* SndDrv - Sound Driver for CoCo 3 +* +* $Id$ +* +* Should be fully compatible with old SS.Tone. +* (needs cleaning up for space) +* +* Ed. Comments Who YY/MM/DD +* ------------------------------------------------------------------ +* First working version KKD 88/08/24 +* Bell version for critics KKD 88/11/14 +* 6 Upgrade to edition 3 from Monk-o-Ware BGP 98/09/26 + + nam SndDrv + ttl Sound Driver for CoCo 3 + + ifp1 + use defsfile + endc + +* SYSTEM MAP GLOBALS: + +rev set 1 +edition set 3 + + mod sndlen,sndnam,systm+objct,reent+rev,entry,0 + +sndnam fcs "SndDrv" + fcb edition + +******************************************************* +entry lbra init init codriver + lbra getstt + lbra setstt ss.tone + lbra term terminate + +******************************************************* +* INIT: set bell vector for F$Alarm + +init leax Bell,pcr + stx >WGlobal+G.BelVec save bell vector +getstt +term +okend clrb + rts + +******************************************************* +* SETSTT: do SS.Tone ($98) calls +* SS.Tone 98 +* regs: X=vol,duration, Y=tone +* Y=path desc + +setstt ldx PD.RGS,y get user regs + ldd #$1000 check for 1-4095 range + subd R$Y,x on passed Y + lble BadArgs ..okay if less + cmpd #$1000 ..else err on $1000 + lbge BadArgs .. + tfr d,y set tone to D + + ldd R$X,x get vol, duration + stb >WGlobal+G.TnCnt save duration + ldb #1 fake cycles + anda #$3F make volume ok + bra BellTone ..do it + +BadArgs comb + ldb #E$IllArg + rts + +******************************************************* +* Bell ($07): +* can destroy D,Y + +Bell inc >WGlobal+G.BelTnF set bell flag +* lda #230/4 start value +* ldb #230/2-18 cycle repeats +* ldd #60*256+96 + ldd #$3E60 + ldy #$0060 bell freq + +* COMMON SS.TONE and BELL ROUTINE: +* A=volume byte (0-63) +* B=cycle repeats (1 means use G.TnCnt as countdown) +* Y=freq + +BellTone lsla set A for PIA D/A bits + lsla + lbeq okend okay end if just setting it + ora #2 add printer port bit + pshs a,b,x + ldx #PIA0Base save current PIA setting + lda 1,x + ldb 3,x + pshs a,b + + anda #$F7 set for sound + andb #$F7 + sta 1,x + stb 3,x + leax $20,x save PIA2 setting + lda 3,x + pshs A + ora #8 and set it too + sta 3,x + bra ToneLoop ..enter main play loop + +BellLoop lda 3,s only bell does this countdown + deca + deca + sta 3,s + anda #$F7 + ora #$02 + bra Loop2 +ToneLoop ldd 3,s get D/A byte, repeat cnt +Loop2 bsr SendByte send it (Y=tone delay) + lda #2 go back to zero + bsr SendByte send it + decb count-1 (SS.Tone always=0!) + bne BellLoop ..loop if bell cycles only << + + ldb >WGlobal+G.BelTnF is it bell? + bne ToneExit ..yes, end + ldb >WGlobal+G.TnCnt else get ticks left + bne ToneLoop and do again if any, else... + +* Note: G.TnCnt is counted down by cc3io at 60hz. + +ToneExit clr >WGlobal+G.BelTnF clear bell flag + puls A reset PIA's as before: + sta 3,x + leax -$20,x + puls a,b + sta 1,x + stb 3,x + clrb okay + puls a,b,x,pc end tone/bell. + +SendByte pshs y save delay + sta ,x store D/A byte +SendDely leay -1,y delay + bne SendDely for tone + puls y,pc retn. + + emod +sndlen equ * + end