*------------------------------------* * Atari ST Talkin' Typer * * (c) 1986 Antic Publishing * * Version 090886 Monday * * Written by Patrick Bass * *------------------------------------* GEMDOS equ 1 cr equ 13 lf equ 10 esc equ 27 *GEMDOS calls: Term equ 0 Conout equ 2 Pconout equ 5 Conin equ 7 Readline equ 10 Constat equ 11 Setblock equ 74 *------------------------------------* start move.l sp,a5 move.l #my_stack,sp move.l 4(a5),a5 move.l $c(a5),d0 add.l $14(a5),d0 add.l $1c(a5),d0 add.l #$100,d0 move.l d0,-(sp) move.l a5,-(sp) move d0,-(sp) move #Setblock,-(sp) trap #GEMDOS add.l #12,sp *------------------------------------* _main move.l #titlemess,a0 bsr message *- - - - - - - - - - - - - - - - - -* * Watch for any keystrokes. When * encountered, decode keypress. mainloop bsr scankey tst.l d0 beq mainloop bsr decodekey bra mainloop *- - - - - - - - - - - - - - - - - -* * Decide which key was pressed. decodekey * Was the Escape Key pressed? * Branch if it was... cmp.b #esc,d0 beq terminate * Was the Return key pressed? * Branch if it was... cmp.b #cr,d0 beq talk_default * Was the key between "a" & "z"? * If lower, try UpperCase. * If higher, split. cmp.b #"a",d0 blt try_uppercase cmp.b #"z",d0 bgt alp_over * Else adjust value for index. * ...and speak the letter. sub.w #$61,d0 bsr say_alphabet rts try_uppercase * Was the key between "A" & "Z"? * If lower, try Numbers. * If higher, split. cmp.b #"A",d0 blt try_numbers cmp.b #"Z",d0 bgt alp_over * Else adjust value for index. * ...and speak the letter. sub.w #$41,d0 bsr say_alphabet rts try_numbers * Was the key between "0" & "9"? * If not, split. cmp.b #"0",d0 blt alp_over cmp.b #"9",d0 bgt alp_over * Else adjust value for index. * ...and speak the number. sub.w #$30,d0 bsr say_numbers rts alp_over rts *------------------------------------* talk_default * Say the Default Phrase. movea.l #speech_table,a0 move.l #0,d0 bra talker *- - - - - - - - - - - - - - - - - -* say_alphabet movea.l #alphabet,a1 bra talk_out say_numbers movea.l #numbers,a1 * As we enter: * a1=address of table. * d0=character (to speak) number. * First multiply d0 by 4 to index * on long addresses. * Then move speech address pointed * to into register a0. talk_out asl.w #2,d0 movea.l 0(a1,d0.w),a0 move.l #0,d0 *---| |------------* talker * Examine next speech word. * Is it a zero? * Branch if not, must be speech. move.w 0(a0,d0.w),d2 tst.w d2 bne talk_more rts *- - - - - - - - - - - - - - - -* talk_more move.l a0,-(sp) move.l d0,-(sp) * Push speech word out printer port. move.w d2,-(sp) move.w #Pconout,-(sp) trap #GEMDOS add.l #4,sp move.l (sp)+,d0 move.l (sp)+,a0 add.l #2,d0 bra talker *- - - - - - - - - - - - - - - - - -* speech_table dc.w 27,7,45,15,53,4,4 dc.w 24,6,3 dc.w 26,16,3 dc.w 26,11,13,12,41,3 dc.w 16,26,34,15,43,19,11,43,3 dc.w 13,23,8,12,11,3 dc.w 13,6,9,51,3 dc.w 3,3,3,3,0 *------------------------------------* alphabet * A table of letter addresses * in letter order. dc.l alph_a, alph_b, alph_c dc.l alph_d, alph_e, alph_f dc.l alph_g, alph_h, alph_i dc.l alph_j, alph_k, alph_l dc.l alph_m, alph_n, alph_o dc.l alph_p, alph_q, alph_r dc.l alph_s, alph_t, alph_u dc.l alph_v, alph_w, alph_x dc.l alph_y, alph_z *- - - - - - - - - - - - - - - - - -* * A table of letter sound descriptions * in letter order. alph_a dc.w 20,1,0 alph_b dc.w 63,19,1,0 alph_c dc.w 55,55,19,1,0 alph_d dc.w 21,19,1,0 alph_e dc.w 19,1,0 alph_f dc.w 7,7,40,40,1,0 alph_g dc.w 10,19,1,0 alph_h dc.w 20,1,2,50,1,0 alph_i dc.w 24,6,1,0 alph_j dc.w 10,7,20,1,0 alph_k dc.w 42,7,20,1,0 alph_l dc.w 7,7,62,1,0 alph_m dc.w 7,7,16,1,0 alph_n dc.w 7,7,11,1,0 alph_o dc.w 53,1,0 alph_p dc.w 9,19,1,0 alph_q dc.w 42,49,22,1,0 alph_r dc.w 59,1,0 alph_s dc.w 7,7,55,55,1,0 alph_t dc.w 13,19,1,0 alph_u dc.w 49,31,1,0 alph_v dc.w 35,19,1,0 alph_w dc.w 33,15,1,63,62,49,31,1,0 alph_x dc.w 7,7,2,41,55,55,1,0 alph_y dc.w 46,6,1,0 alph_z dc.w 43,19,1,0 *- - - - - - - - - - - - - - - - - - * numbers * A table of number addresses * in number order. dc.l alph_0, alph_1, alph_2 dc.l alph_3, alph_4, alph_5 dc.l alph_6, alph_7, alph_8 dc.l alph_9 *- - - - - - - - - - - - - - - - - - * * A table of number sound descriptions * in number order. alph_0 dc.w 43,60,53,1,0 alph_1 dc.w 46,15,15,11,1,0 alph_2 dc.w 13,31,1,0 alph_3 dc.w 29,14,19,1,0 alph_4 dc.w 40,40,58,1,0 alph_5 dc.w 40,40,6,35,1,0 alph_6 dc.w 55,55,12,12,2,41,55,1,0 alph_7 dc.w 55,55,7,7,35,12,11,1,0 alph_8 dc.w 20,2,13,1,0 alph_9 dc.w 11,24,6,11,1,0 *------------------------------------* titlemess dc.b "--------------" dc.b "--------------",cr,lf dc.b "ST Talkin' Typ" dc.b "er " dc.b cr,lf dc.b "(c)1986 Antic " dc.b "Publishing ",cr,lf dc.b "Written by Pat" dc.b "rick Bass",cr,lf dc.b "--------------" dc.b "--------------" dc.b cr,lf,lf,lf,lf,lf,lf dc.b "Press 'Esc' to quit." dc.b cr,lf,0 even *------------------------------------* * Exit current program * and return to GEM/desktop... terminate move.w #Term,-(sp) trap #GEMDOS * Whoops! addq.l #2,sp rts *------------------------------------* message movem.l d1/a0,-(sp) clr.w d1 mess1 move.b (a0)+,d1 beq messx bsr charout bra mess1 messx movem.l (sp)+,d1/a0 rts *------------------------------------* * Write character in d1 to console. charout movem.l d1-d7/a0-a6,-(sp) move.w d1,-(sp) move.w #Conout,-(sp) trap #GEMDOS add.l #4,sp movem.l (sp)+,d1-d7/a0-a6 rts *------------------------------------* scankey move.w #Constat,-(sp) trap #GEMDOS add.l #2,sp tst.l d0 bpl skipkey getkey move.w #Conin,-(sp) trap #GEMDOS add.l #2,sp rts skipkey clr.l d0 rts *- - - - - - - - - - - - - - - - - -* bss ds.l 256 my_stack ds.l 1 even end