annotate level1/modules/sspak.asm @ 1321:acc63d0452bd

SSPAK and SPP ported from OS-9 Level Two
author boisy
date Thu, 04 Sep 2003 20:46:30 +0000
parents
children 6cd590fc076f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1321
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
1 ********************************************************************
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
2 * SSPak - Speech-Sound Pak Text-To-Speech Driver
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
3 *
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
4 * $Id$
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
5 *
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
6 * by Bruce Isted (CIS 76625,2273)
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
7 * released to the Public Domain 87/05/03
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
8 *
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
9 * This driver supports only the Speech-Sound Pak's text-to-speech mode.
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
10 * Bit 7 is cleared and control codes are filtered to ensure that only carriage
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
11 * returns and characters in the range of $20-$7F (inclusive) are passed. A
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
12 * character count and automatic buffer flush is used, which should prevent
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
13 * buffer overflow in the Speech-Sound Pak.
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
14 *
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
15 * Due to way the COCO's sound select circuitry is tied in with other sound
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
16 * sources and the joysticks, only one will function at a time. This means
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
17 * that while the Speech-Sound Pak is active other sound sources and/or the
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
18 * joysticks cannot be used. Speech output is enabled only when a carriage
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
19 * return is received, or when the buffer is flushed. Speech output is
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
20 * disabled as soon as the Speech-Sound Pak is finished speaking the string
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
21 * received before the carriage return or buffer flush.
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
22 *
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
23 * Ed. Comments Who YY/MM/DD
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
24 * ------------------------------------------------------------------
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
25 * 1 Created BRI 87/05/03
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
26
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
27 nam SSPak
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
28 ttl Speech-Sound Pak Text-To-Speech Driver
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
29
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
30 ifp1
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
31 use defsfile
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
32 endc
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
33
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
34 BuffCnt equ 200 character count before flushing buffer (0-255)
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
35 BusyBit equ %10000000 SSPak busy status bit (active low)
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
36 CharMask equ %01111111 printable ASCII character mask
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
37 CRA equ $01 PIA CRA offset
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
38 CRB equ $03 PIA CRB offset
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
39 MUXBit equ %00001000 COCO sound MUX control/select bit position
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
40 SpeakBit equ %01000000 SSPak speech status bit (active low)
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
41 SSPData equ $01 SSPak data register offset
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
42 SSPReset equ $00 SSPak reset register offset
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
43 SSPStat equ $01 SSPak status register offset
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
44
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
45 rev equ $00
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
46 edition set 1
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
47
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
48 mod SEnd,SNam,Drivr+Objct,ReEnt+rev,SEntry,SMem
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
49
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
50 org V.SCF SCF manager data area
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
51 Count rmb 1 character counter
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
52 SMem equ .
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
53
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
54 fcb SHARE.+PWRIT.+WRITE. device capabilities
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
55
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
56 SNam fcs "SSPak"
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
57 fcb edition
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
58
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
59 SEntry lbra SInit
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
60 lbra SRead
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
61 lbra SWrite
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
62 lbra SGetStat
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
63 lbra SSetStat
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
64 lbra STerm
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
65
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
66 SInit equ *
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
67 STerm equ *
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
68 ldx V.PORT,u
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
69 ldb #$01
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
70 stb SSPReset,x reset SSPak
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
71 clrb
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
72 stb SSPReset,x end SSPak reset
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
73 rts
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
74
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
75 SRead comb
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
76 ldb #E$BMode
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
77 rts
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
78
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
79 SWrite anda #CharMask strip MSBit of character
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
80 cmpa #C$CR carriage return?
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
81 beq SpkOut yes, go enable SSPak speech output
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
82 inc Count,u increment character counter
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
83 cmpa #C$SPAC higher than space?
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
84 bhi WritChar yes, go write character to SSPak
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
85 lda #C$SPAC only space allowed through here
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
86 ldb Count,u get current character count
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
87 cmpb #BuffCnt time to flush buffer?
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
88 blo WritChar no, go write space to SSPak
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
89 SpkOut clr Count,u reset character count
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
90 ldy #PIA0Base
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
91 lda CRA,y get PIA0 CRA
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
92 ldb CRB,y get PIA0 CRB
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
93 pshs d save them
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
94 anda #^MUXBit clear PIA0 CA2 control LSBit
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
95 orb #MUXBit set PIA0 CB2 control LSBit
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
96 sta CRA,y * set COCO sound MUX to cartridge input
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
97 stb CRB,y *
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
98 ldy #PIA1Base
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
99 ldb CRB,y get PIA1 CRB
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
100 pshs b save it
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
101 orb #MUXBit set PIA1 CB2 control LSBit
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
102 stb CRB,y enable COCO sound MUX
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
103 lda #C$CR load execute speech character
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
104 bsr WritChar go write command character to SSPak
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
105 bsr SSWait go wait until SSPak has finished
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
106 puls b recover original PIA1 CRB
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
107 stb CRB,y disable COCO sound MUX
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
108 puls d recover original PIA0 CRA & CRB
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
109 ldy #PIA0Base
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
110 sta CRA,y *restore COCO sound MUX to previous setting
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
111 stb CRB,y *
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
112 clrb
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
113 rts
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
114 WritChar bsr BusyWait go check if SSPak is busy
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
115 sta SSPData,x write character to SSPak
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
116 clrb
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
117 rts
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
118
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
119 SGetStat equ *
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
120 SSetStat equ *
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
121 comb
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
122 ldb #E$UnkSvc
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
123 rts
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
124
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
125 BusyWait ldx V.PORT,u
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
126 ldb SSPStat,x get SSPak status
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
127 andb #BusyBit SSPak busy?
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
128 beq BusyWait yes, go check again
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
129 ldb SSPStat,x *allow for slow busy bit
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
130 andb #BusyBit *
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
131 beq BusyWait *
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
132 ldb SSPStat,x *allow for very slow busy bit
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
133 andb #BusyBit *
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
134 beq BusyWait *
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
135 rts
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
136
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
137 SSWait ldx V.PORT,u
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
138 ldb SSPStat,x get SSPak status
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
139 andb #SpeakBit SSPak speech active yet?
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
140 bne SSWait no, go check again
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
141 SSWait0 ldx #$0001 sleep remainder of tick
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
142 os9 F$Sleep
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
143 ldx V.PORT,u
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
144 ldb SSPStat,x get SSPak status
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
145 andb #SpeakBit SSPak speech still active?
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
146 beq SSWait0 yes, go sleep some more
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
147 rts
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
148
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
149 emod
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
150 SEnd equ *
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
151 end
acc63d0452bd SSPAK and SPP ported from OS-9 Level Two
boisy
parents:
diff changeset
152