diff options
| author | Reiner Herrmann <reiner@reiner-h.de> | 2012-02-10 18:26:29 +0100 |
|---|---|---|
| committer | Reiner Herrmann <reiner@reiner-h.de> | 2012-02-10 18:26:29 +0100 |
| commit | a24097ba8118181886a9f0765e76d5fac99f6056 (patch) | |
| tree | 9351f183ebdf4cd7261597a4e5c03765eff452d6 /sam.c | |
| parent | 374045d1f8a5c55301e453d3977f00bdc122fe5c (diff) | |
converted to unix line endings
Diffstat (limited to 'sam.c')
| -rw-r--r-- | sam.c | 134 |
1 files changed, 67 insertions, 67 deletions
@@ -1,67 +1,67 @@ -// sam.c
-//
-// 20060811 Markku Alén
-
-#include "sam.h"
-#include "c64.h"
-#include "cpu.h"
-#include "sid.h"
-
-static void feed(const char *text)
-{
- char c;
- while((c = *(text++)) != '\0')
- {
- kbd_ascii_push(c, 1);
- c64_run(20000);
- kbd_ascii_push(c, 0);
- c64_run(20000);
- }
-}
-
-static void run_to(int addr_start, int addr_stop)
-{
- int pc;
- for(;;)
- {
- pc = get_pc();
- if(pc >= addr_start && pc <= addr_stop)
- break;
- c64_run(20000);
- }
-}
-
-void sam_init(void)
-{
- c64_init();
- run_to(0xe5cd, 0xe5d5);
- feed("LOAD\"SAM.PRG\",1,1\r RUN\rH");
- run_to(0xe5cd, 0xe5d5);
- //feed("]RE\r");
- //run_to(0xe5cd, 0xe5d5);
-}
-
-static void sam_say(const char *text, unsigned int frequency, unsigned char *wave_buf, unsigned int *wave_len_ref)
-{
- feed("SAY\"");
- feed(text);
- feed("\"\r");
- start_record(frequency, wave_buf, *wave_len_ref);
- run_to(0xe5cd, 0xe5d5);
- *wave_len_ref = stop_record();
-}
-
-void sam_recite(const char *text, unsigned int frequency, unsigned char *wave_buf, unsigned int *wave_len_ref)
-{
- feed("]RECITER\r");
- run_to(0xe5cd, 0xe5d5);
- sam_say(text, frequency, wave_buf, wave_len_ref);
-}
-
-void sam_phonetic(const char *text, unsigned int frequency, unsigned char *wave_buf, unsigned int *wave_len_ref)
-{
- feed("]SAM\r");
- run_to(0xe5cd, 0xe5d5);
- sam_say(text, frequency, wave_buf, wave_len_ref);
-}
-
+// sam.c +// +// 20060811 Markku Alén + +#include "sam.h" +#include "c64.h" +#include "cpu.h" +#include "sid.h" + +static void feed(const char *text) +{ + char c; + while((c = *(text++)) != '\0') + { + kbd_ascii_push(c, 1); + c64_run(20000); + kbd_ascii_push(c, 0); + c64_run(20000); + } +} + +static void run_to(int addr_start, int addr_stop) +{ + int pc; + for(;;) + { + pc = get_pc(); + if(pc >= addr_start && pc <= addr_stop) + break; + c64_run(20000); + } +} + +void sam_init(void) +{ + c64_init(); + run_to(0xe5cd, 0xe5d5); + feed("LOAD\"SAM.PRG\",1,1\r RUN\rH"); + run_to(0xe5cd, 0xe5d5); + //feed("]RE\r"); + //run_to(0xe5cd, 0xe5d5); +} + +static void sam_say(const char *text, unsigned int frequency, unsigned char *wave_buf, unsigned int *wave_len_ref) +{ + feed("SAY\""); + feed(text); + feed("\"\r"); + start_record(frequency, wave_buf, *wave_len_ref); + run_to(0xe5cd, 0xe5d5); + *wave_len_ref = stop_record(); +} + +void sam_recite(const char *text, unsigned int frequency, unsigned char *wave_buf, unsigned int *wave_len_ref) +{ + feed("]RECITER\r"); + run_to(0xe5cd, 0xe5d5); + sam_say(text, frequency, wave_buf, wave_len_ref); +} + +void sam_phonetic(const char *text, unsigned int frequency, unsigned char *wave_buf, unsigned int *wave_len_ref) +{ + feed("]SAM\r"); + run_to(0xe5cd, 0xe5d5); + sam_say(text, frequency, wave_buf, wave_len_ref); +} + |
