-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathspeakjet.inc
87 lines (58 loc) · 1.65 KB
/
speakjet.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
;
; speakjet.inc
;
;
; AtariVox Speech Synth Driver
;
; By Alex Herbert, 2004
;
; Constants
SERIAL_OUTMASK equ $01
SERIAL_RDYMASK equ $02
; Macros
mac SPKOUT
; check buffer-full status
lda SWCHA
and #SERIAL_RDYMASK
beq .speech_done
; get next speech byte
ldy #$00
lda (speech_addr),y
; invert data and check for end of string
eor #$ff
beq .speech_done
sta {1}
; increment speech pointer
inc speech_addr
bne .incaddr_skip
inc speech_addr+1
.incaddr_skip
; output byte as serial data
sec ; start bit
.byteout_loop
; put carry flag into bit 0 of SWACNT, perserving other bits
lda SWACNT ; 4
and #$fe ; 2 6
adc #$00 ; 2 8
sta SWACNT ; 4 12
; 10 bits sent? (1 start bit, 8 data bits, 1 stop bit)
cpy #$09 ; 2 14
beq .speech_done ; 2 16
iny ; 2 18
; waste some cycles
ldx #$07
.delay_loop
dex
bne .delay_loop ; 36 54
; shift next data bit into carry
lsr {1} ; 5 59
; and loop (branch always taken)
bpl .byteout_loop ; 3 62 cycles for loop
.speech_done
endm
mac SPEAK
lda #<{1}
sta speech_addr
lda #>{1}
sta speech_addr+1
endm