Home » CEEFAX disks » telesoftware10.adl » 08-10-88/T\SPK01
08-10-88/T\SPK01
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » CEEFAX disks » telesoftware10.adl |
Filename: | 08-10-88/T\SPK01 |
Read OK: | ✔ |
File size: | 5A55 bytes |
Load address: | 0000 |
Exec address: | FFFFFFFF |
File contents
The Acorn Speech System - by - Gordon Horsington ---------------------------------------------------- Module 1. The Speech Synthesiser Commands. ------------------------------------------ The Acorn speech system can be programmed using the SOUND command from BASIC and Osword &07 from both BASIC and Assembly language. These techniques are explained in detail in the Speech System User Guide. They are easy to understand and I will assume that you are familiar with them when they are used in this series. This series will be concerned with programming the speech processor as another processor fitted inside the BBC B which is controlled by the BBC's CPU. The Texas Instruments TMS 5220 speech synthesiser is a processor in its own right and it can be programmed by the computer's CPU and left to get on with the speech synthesis. The TMS 5220 has two input and two output registers and responds to a set of eight commands. The TMS 5220 registers are described in detail on pages 19 and 20 of the Speech System User Guide. Briefly the input registers are a command register and a 16 byte FIFO register. The output registers are a data register and a status register. Another register of interest is the 14 bit word PHROM address register. All these registers will be used when programming the TMS 5220 and you should read pages 18 to 22 of the User Guide if you need more information about them. The eight commands recognised by the TMS 5220 can be sent to the speech processor using Osbyte &9F. Once a command is sent, the speech processor executes the command independantly of the CPU. The eight commands are shown in figure 1. Command Code | Operation Binary Hex. | -------------------------+--------------------- x000xxxx &00 | Nop x001xxxx &10 | Read Byte x010xxxx &20 | Nop x011xxxx &30 | Read and Branch x100aaaa &4a | Load Address x101xxxx &50 | Speak x110xxxx &60 | Speak External x111xxxx &70 | Reset x = doesn't matter a = address Figure 1. The TMS 5220 command set ---------------------------------- These commands are sent to the speech processor using Osbyte &9F with a command, or data, in the Y register. On return from Osbyte &9F the A, X and Y registers are preserved but the carry flag is undefined. Osbyte &9E is used to read data from a word PHROM or to read the status register of the speech processor. The result is returned in the Y register. In order to read data from a word PHROM a Read Byte command must have been sent to the speech processor using Osbyte &9F. If this command has not been sent then a copy of the status regiser is returned from Osbyte &9E. On return from Osbyte &9E the A and X registers are preserved but the carry flag is undefined. Each command will now be considered in detail and an example of how each one can be used will be given. --- NOP --- Osbyte &9F with Y = &20 or Y = &00 The NOP command is the Speech Processor's equivalent of the Assembly language NOP dummy instruction and it does nothing. Because it does nothing it is a suitable pad character to include in lists of commands to be sent to the speech processor. LDA #&9F \ write to speech processor LDY #&20 \ Nop command JSR &FFF4 \ JSR osbyte ----- Reset ----- Osbyte &9F with Y = &70 *FX 159,0,112 The Reset command allows the CPU to immediately halt a Speak command and put the speech processor into a known state. Reset will not halt a Speak External command because the &70 in the Y register is then taken as data rather than a command. The main use for this command will be to "chop up" the words available in a word PHROM. In this way the word "Acorn" can be made to sound like "ache" or "a-". This method of producing an extended vocabulary will be covered in detail in module 6. LDA #&9F \ write to speech processor LDY #&70 \ Reset command JSR &FFF4 \ JSR osbyte ------------ Load Address ------------ Osbyte &9F with Y = &4n, where n = &0 to &F The Load Address command is used to alter the address register of a word PHROM. This command has to be sent to the speech processor five times to alter the 14 bit word PHROM address register. The 14 bits are sent a nybble at a time with the least significant nybble first, the most significant nybble last, and followed by a null nybble. Each nybble has to be ORed with #&40, the Load Address command, to create a byte which is loaded into the Y register and then Osbyte &9F is used to write the command to the speech processor. The word PHROM number, usually &0F in the Acorn system, is also sent with the Load Address command by ORing the most significant two bits of the word PHROM number (%1100 = &0C) with the fourth byte and ORing the least significant two bits of the word PHROM number (%0011 = &03) with the fifth byte. This rather complicated method of writing to the word PHROM address register is best illustrated with some examples. Let us suppose that the address &1234 is to be written into the address register for word PHROM A. All the examples will use word PHROM A because this is the only one commonly available. The number &0F has been assigned to word PHROM A. First the order of the nybbles has to be reversed and a null fifth nybble added onto the end. The four nybbles 1 2 3 4 are reordered into 4 3 2 1 0 (with the null nybble added onto the end). Each nybble has to be ORed with &40. The five nybbles are transformed into the five bytes &44 &43 &42 &41 and &40. The fourth byte has to be ORed with the two most significant bits (%1100) of the word PHROM number. &41 OR &0C = &4D. The fifth byte has to be ORed with the two least significant bits (%0011) of the word PHROM number. &40 OR &03 = &43. The address &1234 is transformed into the five bytes &44 &43 &42 &4D &43, each of which will need to be loaded into the Y register and sent to the speech processor using Osbyte &9F. The following code could be used to write the address &1234 into the address register for word PHROM A. LDA #&9F \ Osbyte &9F, write to speech processor LDY #&44 \ least significant nybble OR #&40 JSR &FFF4 \ JSR osbyte LDY #&43 JSR &FFF4 LDY #&42 JSR &FFF4 LDY #&4D \ most significant nybble OR #&4C JSR &FFF4 LDY #&43 \ last byte always #&43 with word PHROM A JSR &FFF4 The load address command has to be used five times even if less than four nybbles are used to specify an address. If, for example, the address &42 is to be loaded into the address register it must still undergo the same transformation into five bytes. &0042 is reversed and a null nybble is added onto the end to give 2 4 0 0 0. Each nybble is ORed with &40 to form the five bytes &42 &44 &40 &40 &40. The fourth byte is ORed with &0C and the fifth byte is ORed with &03 to specify word PHROM A (number &0F). The bytes &42 &44 &40 &4C &43 can then be sent to the speech processor using Osbyte &9F five times to load the address register with &42. It should be clear from these examples that, when using word PHROM A (number &0F), the fifth byte will always be &43. Because the word PHROM addresses 16k bytes of memory the most significant nybble of the address will always be either 0, 1, 2 or 3 which, when ORed with &4C, will always result in the fourth byte being either &4C, &4D, &4E or &4F. The transformation of the address into the relevant five bytes and writing the bytes into the address register can be done with subroutine such as the one shown below. The subroutine labeled 'address' is called with the least significant byte of the word PHROM address in the X register and the most significant byte in the Y register. LDX #addr MOD 256 \ addr = 14 bit address for word PHROM LDY #addr DIV 256 \ address register JSR address \ write address into PHROM address register RTS \ return to BASIC .address TYA PHA \ save the MSB of word PHROM address by PHA \ pushing it on the stack twice TXA \ the least significant nybble is in the X register AND #&F \ isolate the least significant nybble ORA #&40 \ OR it with #&40 JSR write \ and write it to the speech processor TXA \ the next nybble is also in the X register AND #&F0 \ isolate the second nybble LSR A \ shift right by four bits LSR A \ to move it into the first four bits LSR A LSR A ORA #&40 \ OR the second nybble with #&40 JSR write \ and write it to the speech processor PLA \ the third and fourth nybbles are on the stack AND #&F \ isolate the third nybble ORA #&40 \ OR it with #&40 JSR write \ and write it to the speech processor PLA \ the fourth nybble is also on the stack AND #&F0 \ isolate the fourth nybble LSR A \ shift right by four bits LSR A \ to move it into the first four bits LSR A LSR A ORA #&4C \ OR the most significant nybble with #&4C JSR write \ and write it to the speech processor LDA #&43 \ last byte always &43 with PHROM &0F .write TAY \ command from A to Y LDA #&9F \ write to speech processor command JMP &FFF4 \ Osbyte and return Coding similar to the Assembly language subroutine address, and its equivalent BASIC procedure PROCaddress, will be used in this series to write to the address register for word PHROM A. DEFPROCaddress(address) A%=&9F :REM: load accumulator with #&9F Y%=&40+(address AND &F) :REM: #&40 OR (least significant nybble) CALL &FFF4 :REM: call osbyte Y%=&40+(address AND &F0) DIV &10 CALL &FFF4 Y%=&40+(address AND &F00) DIV &100 CALL &FFF4 Y%=&4C+(address AND &F000) DIV &1000 CALL &FFF4 Y%=&43 :REM: last byte always #&43 CALL &FFF4 ENDPROC Although it is unlikely that you would ever want to load the contents of the word PHROM address register with a specific 14 bit address and then do nothing with the speech processor afterwards, it is always possible to do such things by accident rather than design. If you do this and follow a Load Address command with another Load Address command, the second address will not be loaded into the address register as required. Loading the address register must always be followed by either a Read Byte, Read and Branch, Speak or Reset command. A Load Address command should not be followed by either an NOP, a Speak External or another Load Address command. There is no reason why a Load Address command should be followed by any of these commands and this mistake should be avoided in all your programs. The effect of this programming error is demonstrated in the program BEWARE. If you load and run this program it will respond by printing the contents of memory location &0272 in word PHROM A after one set of five Load Address commands and again after another two sets of five Load Address commands. Because the second set of five Load Address commands has been followed by a Reset command the two bytes are identical. Either delete lines 350 to 370 or alter line 350 to LDA #0 and run the program again. You will then see that the second byte is not the same as the first indicating the error described above. Using the Load Address command is a useful and very important part of programming the speech processor and you must be aware of this potential error and design your programs so that it never occurs. 10 REM: BEWARE 20 REM: Writing to the word PHROM address register 30 REM: must be followed by a write to speech 40 REM: processor command (osbyte &9F with 50 REM: Y = either &10, &30, &50 or &70) before 60 REM: writing to the address register again. 70 REM: Otherwise the second Load Address results in 80 REM: an error in the address register. 90 osnewl=&FFE7 100 oswrch=&FFEE 110 osbyte=&FFF4 120 DIM mcode &100 130 FORpass=0TO2STEP2 140 P%=mcode 150 [ OPT pass 160 LDA #&EB 170 LDX #0 180 LDY #&FF 190 JSR osbyte \ check for Acorn Speech upgrade 200 CPX #&FF 210 BEQ start 220 BRK 230 BRK 240 EQUS "No Speech upgrade" 250 BRK 260 .start 270 JSR address \ (TONE1) data address 280 JSR read \ read the byte 290 JSR printhex \ should be &B1 300 JSR address \ (TONE1) data address 310 \ 320 \ use LDY #0 in line 350 to generate an error 330 \ or just delete lines 350, 360 and 370 340 \ &10,&30,&50,&70 work &0,&20,&4n,&60 don't 350 LDY #&70 \ reset command 360 LDA #&9F \ write to speech processor 370 JSR osbyte 380 \ 390 JSR address \ (TONE1) data address 400 JSR read \ read the byte 410 JSR printhex \ should be &B1 420 JSR osnewl 430 RTS \ return to BASIC 440 .address 450 LDA #&9F \ write to speech processor 460 LDY #&42 \ address &0272 470 JSR osbyte 480 LDY #&47 490 JSR osbyte 500 LDY #&42 510 JSR osbyte 520 LDY #&4C 530 JSR osbyte 540 LDY #&43 550 JMP osbyte \ osbyte and return 560 .read 570 LDA #&9F \ write to speech processor 580 LDY #&10 \ read byte command 590 JSR osbyte \ send read byte command 600 LDA #&9E \ read from speech processor 610 JSR osbyte \ read next byte from PHROM 620 TYA \ result in accumulator 630 RTS 640 .printhex 650 PHA 660 LSR A 670 LSR A 680 LSR A 690 LSR A 700 JSR nybble 710 PLA 720 .nybble 730 AND #&F 740 SED 750 CLC 760 ADC #&90 770 ADC #&40 780 CLD 790 JMP oswrch 800 ] 810 NEXT 820 CALL mcode ----- Speak ----- Osbyte &9F with Y = &50 *FX 159,0,80 The Speak command is used to generate speech using the speech data stored in a word PHROM. The word PHROM address register must be loaded with the first byte of the speech data and speech will continue until a stop code (%1111) is read from the word PHROM. The Speak command can be halted by a Reset command (Osbyte &9F with Y = &70 or *FX 159,0,112). The Speak and Reset commands will be used in module 6 to produce an almost unlimited vocabulary from word PHROM A. The example program PENCE demonstrates how the Speak command should be used in Assembly language programs. The address register is first loaded with the address of the start of the speech data for the word PENCE and then the Speak command is executed. The speech data for the word PENCE starts at &2B58. This address has been transformed into the five bytes &48 &45 &4B &4E and &43 to be used with the Load Address command. 10 REM: PENCE 20 DIM mcode &100 30 osbyte=&FFF4 40 FORpass=0TO2STEP2 50 P%=mcode 60 [ OPT pass 70 LDA #&9F \ write to speech processor 80 LDY #&48 \ address &2B58 "pence" 90 JSR osbyte 100 LDY #&45 110 JSR osbyte 120 LDY #&4B 130 JSR osbyte 140 LDY #&4E 150 JSR osbyte 160 LDY #&43 170 JSR osbyte 180 LDY #&50 \ speak command 190 JMP osbyte \ say "pence" and return to BASIC 200 ] 210 NEXT 220 CALL mcode -------------- Speak External -------------- Osbyte &9F with Y = &60 The Speak External command is used to allow the CPU to send speech data from RAM to the speech processor. Using Osbyte &9F with Y = &60 flushes the 16 byte FIFO buffer and data subsequently sent to the speech processor are put into this buffer. While this command is active all data sent to the speech processor are routed to the FIFO buffer. The reset command (Osbyte &9F with Y = &70) is not recognised when Speak External is active. Creating the speech data will be covered in some detail in module 5 but, for now, you should look at the demonstration program CLOCK to see how the speak external command can be used. Note in particular that the program does not return until the speech has halted. This is essential if you are to avoid producing garbled nonsence. The program and its data can be in main memory, a Second Processor or reformated for Sideways RAM. 10 REM: CLOCK 20 DIM mcode &100 30 osbyte=&FFF4 40 FORpass=0TO2STEP2 50 P%=mcode 60 [ OPT pass 70 LDA #&9F \ write to speech processor 80 LDY #&60 \ speak external command 90 JSR osbyte 100 LDX #0 110 .loop 120 LDY clock,X \ load Y with data 130 JSR osbyte \ write data to speech processor 140 INX 150 CPX #&47 160 BNE loop 170 .status 180 LDA #&9E \ read speech processor status register 190 JSR osbyte 200 TYA \ status register in Y transfered to A 210 ROL A \ bit 7 (talk status) into carry 220 BCS status \ carry set if still speaking 230 RTS \ return to BASIC 240 .clock 250 EQUD &003BA528 260 EQUD &60A46B5D 270 EQUD &55090D59 280 EQUD &35A4BC32 290 EQUD &70D1AD4B 300 EQUD &D716F673 310 EQUD &ADCC2B29 320 EQUD &AD674DCA 330 EQUD &50AEF52C 340 EQUD &D486389D 350 EQUD &65654B3B 360 EQUD &754BD298 370 EQUD &1264DAF3 380 EQUD &6445DDCA 390 EQUD &28000003 400 EQUD &02231520 410 EQUD &808CE4E4 420 EQUW &072C 430 EQUB &FE 440 ] 450 NEXT 460 CALL mcode --------- Read Byte --------- Osbyte &9F with Y = &10, followed by Osbyte &9E The Read Byte command allows the CPU to read one byte from a word PHROM. Before executing the Read Byte command the Load Address command should be used to specify the address of the byte to be read. The Read byte command causes the byte indicated by the address register to be placed in the eight bit data register. This data byte can then be read by the CPU using Osbyte &9E which returns the contents of the data register in the Y register. The address register is automatically incremented after the Read Byte command so that the next byte can be read without using the Load Address command. The Read Byte command should always be followed by an Osbyte &9E command. If any other command is sent to the speech processor before using Osbyte &9E the data byte will be lost and the status register will be returned in the Y register. The Assembly language subroutine labeled 'read' can be used to read a byte from a word PHROM at the address specified by the address register and return that byte in the accumulator. .read LDA #&9F \ write to speech processor LDY #&10 \ read byte command JSR osbyte \ send read byte command LDA #&9E \ read from speech processor JSR osbyte \ read byte TYA \ result into accumulator RTS --------------- Read and Branch --------------- Osbyte &9F with Y = &30 The Read and Branch instruction is used as an indirect Load Address instruction and can only be used after setting up an address with the Load Address command. The Load Address command must load the address register with the address of a pointer which contains the start address of speech data. Acorn recommend that this command should not be used as it can only be guarenteed to work when only one word PHROM is fitted into the computer. This advice can often be ignored since there is only one word PHROM generally available, that is word PHROM A. If you intend to write software for other users you cannot assume that they have only one word PHROM and you should avoid using this command under those circumstances. The example program TONE1 uses the Load Address command to load the address &0074 into the address register. &0074 is the address in word PHROM A of the pointer to the speech data of (TONE1). The Read and Branch instruction is then used to load the address of the speech data (&0272 - although there is no need to know what the address is) and the Speak command is used to speak the data. 10 REM: TONE1 20 osbyte=&FFF4 30 DIM mcode &100 40 FORpass=0TO2STEP2 50 P%=mcode 60 [ OPT pass 70 LDA #&9F \ write to speech processor 80 LDY #&44 \ address &74 (TONE1) pointer 90 JSR osbyte 100 LDY #&47 110 JSR osbyte 120 LDY #&40 130 JSR osbyte 140 LDY #&4C 150 JSR osbyte 160 LDY #&43 170 JSR osbyte 180 LDA #&9F \ write to speech processor 190 LDY #&30 \ read and branch 200 JSR osbyte 210 LDY #&50 \ speak command 220 JMP osbyte \ speak the word and return 230 ] 240 NEXT 250 CALL mcode -------------------- Read Status Register -------------------- Osbyte &9E The status register can be read using Osbyte &9E at any time except immediately after a Read Byte instruction. The status register contents are returned in the three most significant bits of the Y register. Bit 7 is the Talk Status bit (TS) and is set if speech is being produced. Bit 6 is the Buffer Low bit (BL) which is set if the FIFO buffer is more than half empty. Bit 5 is the Buffer empty bit (BE) which is set if the FIFO buffer has run out of data while executing a Speak External command. The subroutine status can be used to waste time while waiting for bit 7 of the status register to clear. Bit 7 will clear when the production of speech is halted by processing a stop code (%1111), or when the FIFO buffer is empty, or when the Speech Processor is reset. .status LDA #&9E \ read speech processor status register JSR osbyte TYA \ status register in Y transfered to A ROL A \ bit 7 (talk status) into carry BCS status \ carry set if still speaking RTS \ return when speech halted You will need to understand and use all the speech processor commands in the following modules of this series.
00000000 54 68 65 20 41 63 6f 72 6e 20 53 70 65 65 63 68 |The Acorn Speech| 00000010 20 53 79 73 74 65 6d 20 20 2d 20 20 62 79 20 20 | System - by | 00000020 2d 20 20 47 6f 72 64 6f 6e 20 48 6f 72 73 69 6e |- Gordon Horsin| 00000030 67 74 6f 6e 0d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |gton.-----------| 00000040 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000060 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0d 4d 6f 64 75 6c |---------..Modul| 00000070 65 20 31 2e 20 54 68 65 20 53 70 65 65 63 68 20 |e 1. The Speech | 00000080 53 79 6e 74 68 65 73 69 73 65 72 20 43 6f 6d 6d |Synthesiser Comm| 00000090 61 6e 64 73 2e 0d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |ands..----------| 000000a0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 000000c0 0d 0d 54 68 65 20 41 63 6f 72 6e 20 73 70 65 65 |..The Acorn spee| 000000d0 63 68 20 73 79 73 74 65 6d 20 63 61 6e 20 62 65 |ch system can be| 000000e0 20 70 72 6f 67 72 61 6d 6d 65 64 20 75 73 69 6e | programmed usin| 000000f0 67 20 74 68 65 20 53 4f 55 4e 44 20 63 6f 6d 6d |g the SOUND comm| 00000100 61 6e 64 20 66 72 6f 6d 0d 42 41 53 49 43 20 61 |and from.BASIC a| 00000110 6e 64 20 4f 73 77 6f 72 64 20 26 30 37 20 66 72 |nd Osword &07 fr| 00000120 6f 6d 20 62 6f 74 68 20 42 41 53 49 43 20 61 6e |om both BASIC an| 00000130 64 20 41 73 73 65 6d 62 6c 79 20 6c 61 6e 67 75 |d Assembly langu| 00000140 61 67 65 2e 20 54 68 65 73 65 0d 74 65 63 68 6e |age. These.techn| 00000150 69 71 75 65 73 20 61 72 65 20 65 78 70 6c 61 69 |iques are explai| 00000160 6e 65 64 20 69 6e 20 64 65 74 61 69 6c 20 69 6e |ned in detail in| 00000170 20 74 68 65 20 53 70 65 65 63 68 20 53 79 73 74 | the Speech Syst| 00000180 65 6d 20 55 73 65 72 20 47 75 69 64 65 2e 20 54 |em User Guide. T| 00000190 68 65 79 0d 61 72 65 20 65 61 73 79 20 74 6f 20 |hey.are easy to | 000001a0 75 6e 64 65 72 73 74 61 6e 64 20 61 6e 64 20 49 |understand and I| 000001b0 20 77 69 6c 6c 20 61 73 73 75 6d 65 20 74 68 61 | will assume tha| 000001c0 74 20 79 6f 75 20 61 72 65 20 66 61 6d 69 6c 69 |t you are famili| 000001d0 61 72 20 77 69 74 68 20 74 68 65 6d 0d 77 68 65 |ar with them.whe| 000001e0 6e 20 74 68 65 79 20 61 72 65 20 75 73 65 64 20 |n they are used | 000001f0 69 6e 20 74 68 69 73 20 73 65 72 69 65 73 2e 0d |in this series..| 00000200 0d 54 68 69 73 20 73 65 72 69 65 73 20 77 69 6c |.This series wil| 00000210 6c 20 62 65 20 63 6f 6e 63 65 72 6e 65 64 20 77 |l be concerned w| 00000220 69 74 68 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 |ith programming | 00000230 74 68 65 20 73 70 65 65 63 68 20 70 72 6f 63 65 |the speech proce| 00000240 73 73 6f 72 20 61 73 0d 61 6e 6f 74 68 65 72 20 |ssor as.another | 00000250 70 72 6f 63 65 73 73 6f 72 20 66 69 74 74 65 64 |processor fitted| 00000260 20 69 6e 73 69 64 65 20 74 68 65 20 42 42 43 20 | inside the BBC | 00000270 42 20 77 68 69 63 68 20 69 73 20 63 6f 6e 74 72 |B which is contr| 00000280 6f 6c 6c 65 64 20 62 79 20 74 68 65 20 42 42 43 |olled by the BBC| 00000290 27 73 0d 43 50 55 2e 20 54 68 65 20 54 65 78 61 |'s.CPU. The Texa| 000002a0 73 20 49 6e 73 74 72 75 6d 65 6e 74 73 20 54 4d |s Instruments TM| 000002b0 53 20 35 32 32 30 20 73 70 65 65 63 68 20 73 79 |S 5220 speech sy| 000002c0 6e 74 68 65 73 69 73 65 72 20 69 73 20 61 20 70 |nthesiser is a p| 000002d0 72 6f 63 65 73 73 6f 72 20 69 6e 0d 69 74 73 20 |rocessor in.its | 000002e0 6f 77 6e 20 72 69 67 68 74 20 61 6e 64 20 69 74 |own right and it| 000002f0 20 63 61 6e 20 62 65 20 70 72 6f 67 72 61 6d 6d | can be programm| 00000300 65 64 20 62 79 20 74 68 65 20 63 6f 6d 70 75 74 |ed by the comput| 00000310 65 72 27 73 20 43 50 55 20 61 6e 64 20 6c 65 66 |er's CPU and lef| 00000320 74 20 74 6f 0d 67 65 74 20 6f 6e 20 77 69 74 68 |t to.get on with| 00000330 20 74 68 65 20 73 70 65 65 63 68 20 73 79 6e 74 | the speech synt| 00000340 68 65 73 69 73 2e 20 54 68 65 20 54 4d 53 20 35 |hesis. The TMS 5| 00000350 32 32 30 20 68 61 73 20 74 77 6f 20 69 6e 70 75 |220 has two inpu| 00000360 74 20 61 6e 64 20 74 77 6f 0d 6f 75 74 70 75 74 |t and two.output| 00000370 20 72 65 67 69 73 74 65 72 73 20 61 6e 64 20 72 | registers and r| 00000380 65 73 70 6f 6e 64 73 20 74 6f 20 61 20 73 65 74 |esponds to a set| 00000390 20 6f 66 20 65 69 67 68 74 20 63 6f 6d 6d 61 6e | of eight comman| 000003a0 64 73 2e 0d 0d 54 68 65 20 54 4d 53 20 35 32 32 |ds...The TMS 522| 000003b0 30 20 72 65 67 69 73 74 65 72 73 20 61 72 65 20 |0 registers are | 000003c0 64 65 73 63 72 69 62 65 64 20 69 6e 20 64 65 74 |described in det| 000003d0 61 69 6c 20 6f 6e 20 70 61 67 65 73 20 31 39 20 |ail on pages 19 | 000003e0 61 6e 64 20 32 30 20 6f 66 20 74 68 65 0d 53 70 |and 20 of the.Sp| 000003f0 65 65 63 68 20 53 79 73 74 65 6d 20 55 73 65 72 |eech System User| 00000400 20 47 75 69 64 65 2e 20 42 72 69 65 66 6c 79 20 | Guide. Briefly | 00000410 74 68 65 20 69 6e 70 75 74 20 72 65 67 69 73 74 |the input regist| 00000420 65 72 73 20 61 72 65 20 61 20 63 6f 6d 6d 61 6e |ers are a comman| 00000430 64 0d 72 65 67 69 73 74 65 72 20 61 6e 64 20 61 |d.register and a| 00000440 20 31 36 20 62 79 74 65 20 46 49 46 4f 20 72 65 | 16 byte FIFO re| 00000450 67 69 73 74 65 72 2e 20 54 68 65 20 6f 75 74 70 |gister. The outp| 00000460 75 74 20 72 65 67 69 73 74 65 72 73 20 61 72 65 |ut registers are| 00000470 20 61 20 64 61 74 61 0d 72 65 67 69 73 74 65 72 | a data.register| 00000480 20 61 6e 64 20 61 20 73 74 61 74 75 73 20 72 65 | and a status re| 00000490 67 69 73 74 65 72 2e 20 41 6e 6f 74 68 65 72 20 |gister. Another | 000004a0 72 65 67 69 73 74 65 72 20 6f 66 20 69 6e 74 65 |register of inte| 000004b0 72 65 73 74 20 69 73 20 74 68 65 20 31 34 20 62 |rest is the 14 b| 000004c0 69 74 0d 77 6f 72 64 20 50 48 52 4f 4d 20 61 64 |it.word PHROM ad| 000004d0 64 72 65 73 73 20 72 65 67 69 73 74 65 72 2e 20 |dress register. | 000004e0 41 6c 6c 20 74 68 65 73 65 20 72 65 67 69 73 74 |All these regist| 000004f0 65 72 73 20 77 69 6c 6c 20 62 65 20 75 73 65 64 |ers will be used| 00000500 20 77 68 65 6e 0d 70 72 6f 67 72 61 6d 6d 69 6e | when.programmin| 00000510 67 20 74 68 65 20 54 4d 53 20 35 32 32 30 20 61 |g the TMS 5220 a| 00000520 6e 64 20 79 6f 75 20 73 68 6f 75 6c 64 20 72 65 |nd you should re| 00000530 61 64 20 70 61 67 65 73 20 31 38 20 74 6f 20 32 |ad pages 18 to 2| 00000540 32 20 6f 66 20 74 68 65 20 55 73 65 72 0d 47 75 |2 of the User.Gu| 00000550 69 64 65 20 69 66 20 79 6f 75 20 6e 65 65 64 20 |ide if you need | 00000560 6d 6f 72 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e |more information| 00000570 20 61 62 6f 75 74 20 74 68 65 6d 2e 0d 0d 54 68 | about them...Th| 00000580 65 20 65 69 67 68 74 20 63 6f 6d 6d 61 6e 64 73 |e eight commands| 00000590 20 72 65 63 6f 67 6e 69 73 65 64 20 62 79 20 74 | recognised by t| 000005a0 68 65 20 54 4d 53 20 35 32 32 30 20 63 61 6e 20 |he TMS 5220 can | 000005b0 62 65 20 73 65 6e 74 20 74 6f 20 74 68 65 20 73 |be sent to the s| 000005c0 70 65 65 63 68 0d 70 72 6f 63 65 73 73 6f 72 20 |peech.processor | 000005d0 75 73 69 6e 67 20 4f 73 62 79 74 65 20 26 39 46 |using Osbyte &9F| 000005e0 2e 20 4f 6e 63 65 20 61 20 63 6f 6d 6d 61 6e 64 |. Once a command| 000005f0 20 69 73 20 73 65 6e 74 2c 20 74 68 65 20 73 70 | is sent, the sp| 00000600 65 65 63 68 20 70 72 6f 63 65 73 73 6f 72 0d 65 |eech processor.e| 00000610 78 65 63 75 74 65 73 20 74 68 65 20 63 6f 6d 6d |xecutes the comm| 00000620 61 6e 64 20 69 6e 64 65 70 65 6e 64 61 6e 74 6c |and independantl| 00000630 79 20 6f 66 20 74 68 65 20 43 50 55 2e 20 54 68 |y of the CPU. Th| 00000640 65 20 65 69 67 68 74 20 63 6f 6d 6d 61 6e 64 73 |e eight commands| 00000650 20 61 72 65 0d 73 68 6f 77 6e 20 69 6e 20 66 69 | are.shown in fi| 00000660 67 75 72 65 20 31 2e 0d 0d 0d 20 20 20 20 20 20 |gure 1.... | 00000670 20 20 20 20 20 43 6f 6d 6d 61 6e 64 20 43 6f 64 | Command Cod| 00000680 65 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 |e | | 00000690 20 4f 70 65 72 61 74 69 6f 6e 0d 20 20 20 20 20 | Operation. | 000006a0 20 20 42 69 6e 61 72 79 20 20 20 20 20 20 20 20 | Binary | 000006b0 20 20 48 65 78 2e 20 20 20 20 20 7c 0d 20 20 20 | Hex. |. | 000006c0 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ------------| 000006d0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d |-------------+--| 000006e0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| 000006f0 2d 2d 2d 0d 20 20 20 20 20 20 20 78 30 30 30 78 |---. x000x| 00000700 78 78 78 20 20 20 20 20 20 20 20 26 30 30 20 20 |xxx &00 | 00000710 20 20 20 20 7c 20 20 20 20 20 20 4e 6f 70 0d 20 | | Nop. | 00000720 20 20 20 20 20 20 78 30 30 31 78 78 78 78 20 20 | x001xxxx | 00000730 20 20 20 20 20 20 26 31 30 20 20 20 20 20 20 7c | &10 || 00000740 20 20 20 20 20 20 52 65 61 64 20 42 79 74 65 0d | Read Byte.| 00000750 20 20 20 20 20 20 20 78 30 31 30 78 78 78 78 20 | x010xxxx | 00000760 20 20 20 20 20 20 20 26 32 30 20 20 20 20 20 20 | &20 | 00000770 7c 20 20 20 20 20 20 4e 6f 70 0d 20 20 20 20 20 || Nop. | 00000780 20 20 78 30 31 31 78 78 78 78 20 20 20 20 20 20 | x011xxxx | 00000790 20 20 26 33 30 20 20 20 20 20 20 7c 20 20 20 20 | &30 | | 000007a0 20 20 52 65 61 64 20 61 6e 64 20 42 72 61 6e 63 | Read and Branc| 000007b0 68 0d 20 20 20 20 20 20 20 78 31 30 30 61 61 61 |h. x100aaa| 000007c0 61 20 20 20 20 20 20 20 20 26 34 61 20 20 20 20 |a &4a | 000007d0 20 20 7c 20 20 20 20 20 20 4c 6f 61 64 20 41 64 | | Load Ad| 000007e0 64 72 65 73 73 0d 20 20 20 20 20 20 20 78 31 30 |dress. x10| 000007f0 31 78 78 78 78 20 20 20 20 20 20 20 20 26 35 30 |1xxxx &50| 00000800 20 20 20 20 20 20 7c 20 20 20 20 20 20 53 70 65 | | Spe| 00000810 61 6b 0d 20 20 20 20 20 20 20 78 31 31 30 78 78 |ak. x110xx| 00000820 78 78 20 20 20 20 20 20 20 20 26 36 30 20 20 20 |xx &60 | 00000830 20 20 20 7c 20 20 20 20 20 20 53 70 65 61 6b 20 | | Speak | 00000840 45 78 74 65 72 6e 61 6c 0d 20 20 20 20 20 20 20 |External. | 00000850 78 31 31 31 78 78 78 78 20 20 20 20 20 20 20 20 |x111xxxx | 00000860 26 37 30 20 20 20 20 20 20 7c 20 20 20 20 20 20 |&70 | | 00000870 52 65 73 65 74 0d 0d 78 20 3d 20 64 6f 65 73 6e |Reset..x = doesn| 00000880 27 74 20 6d 61 74 74 65 72 0d 61 20 3d 20 61 64 |'t matter.a = ad| 00000890 64 72 65 73 73 0d 0d 46 69 67 75 72 65 20 31 2e |dress..Figure 1.| 000008a0 20 54 68 65 20 54 4d 53 20 35 32 32 30 20 63 6f | The TMS 5220 co| 000008b0 6d 6d 61 6e 64 20 73 65 74 0d 2d 2d 2d 2d 2d 2d |mmand set.------| 000008c0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| 000008d0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0d 0d 54 |------------...T| 000008e0 68 65 73 65 20 63 6f 6d 6d 61 6e 64 73 20 61 72 |hese commands ar| 000008f0 65 20 73 65 6e 74 20 74 6f 20 74 68 65 20 73 70 |e sent to the sp| 00000900 65 65 63 68 20 70 72 6f 63 65 73 73 6f 72 20 75 |eech processor u| 00000910 73 69 6e 67 20 4f 73 62 79 74 65 20 26 39 46 20 |sing Osbyte &9F | 00000920 77 69 74 68 20 61 0d 63 6f 6d 6d 61 6e 64 2c 20 |with a.command, | 00000930 6f 72 20 64 61 74 61 2c 20 69 6e 20 74 68 65 20 |or data, in the | 00000940 59 20 72 65 67 69 73 74 65 72 2e 20 4f 6e 20 72 |Y register. On r| 00000950 65 74 75 72 6e 20 66 72 6f 6d 20 4f 73 62 79 74 |eturn from Osbyt| 00000960 65 20 26 39 46 20 74 68 65 20 41 2c 20 58 0d 61 |e &9F the A, X.a| 00000970 6e 64 20 59 20 72 65 67 69 73 74 65 72 73 20 61 |nd Y registers a| 00000980 72 65 20 70 72 65 73 65 72 76 65 64 20 62 75 74 |re preserved but| 00000990 20 74 68 65 20 63 61 72 72 79 20 66 6c 61 67 20 | the carry flag | 000009a0 69 73 20 75 6e 64 65 66 69 6e 65 64 2e 0d 0d 4f |is undefined...O| 000009b0 73 62 79 74 65 20 26 39 45 20 69 73 20 75 73 65 |sbyte &9E is use| 000009c0 64 20 74 6f 20 72 65 61 64 20 64 61 74 61 20 66 |d to read data f| 000009d0 72 6f 6d 20 61 20 77 6f 72 64 20 50 48 52 4f 4d |rom a word PHROM| 000009e0 20 6f 72 20 74 6f 20 72 65 61 64 20 74 68 65 20 | or to read the | 000009f0 73 74 61 74 75 73 0d 72 65 67 69 73 74 65 72 20 |status.register | 00000a00 6f 66 20 74 68 65 20 73 70 65 65 63 68 20 70 72 |of the speech pr| 00000a10 6f 63 65 73 73 6f 72 2e 20 54 68 65 20 72 65 73 |ocessor. The res| 00000a20 75 6c 74 20 69 73 20 72 65 74 75 72 6e 65 64 20 |ult is returned | 00000a30 69 6e 20 74 68 65 20 59 0d 72 65 67 69 73 74 65 |in the Y.registe| 00000a40 72 2e 20 49 6e 20 6f 72 64 65 72 20 74 6f 20 72 |r. In order to r| 00000a50 65 61 64 20 64 61 74 61 20 66 72 6f 6d 20 61 20 |ead data from a | 00000a60 77 6f 72 64 20 50 48 52 4f 4d 20 61 20 52 65 61 |word PHROM a Rea| 00000a70 64 20 42 79 74 65 20 63 6f 6d 6d 61 6e 64 20 6d |d Byte command m| 00000a80 75 73 74 0d 68 61 76 65 20 62 65 65 6e 20 73 65 |ust.have been se| 00000a90 6e 74 20 74 6f 20 74 68 65 20 73 70 65 65 63 68 |nt to the speech| 00000aa0 20 70 72 6f 63 65 73 73 6f 72 20 75 73 69 6e 67 | processor using| 00000ab0 20 4f 73 62 79 74 65 20 26 39 46 2e 20 49 66 20 | Osbyte &9F. If | 00000ac0 74 68 69 73 20 63 6f 6d 6d 61 6e 64 0d 68 61 73 |this command.has| 00000ad0 20 6e 6f 74 20 62 65 65 6e 20 73 65 6e 74 20 74 | not been sent t| 00000ae0 68 65 6e 20 61 20 63 6f 70 79 20 6f 66 20 74 68 |hen a copy of th| 00000af0 65 20 73 74 61 74 75 73 20 72 65 67 69 73 65 72 |e status regiser| 00000b00 20 69 73 20 72 65 74 75 72 6e 65 64 20 66 72 6f | is returned fro| 00000b10 6d 0d 4f 73 62 79 74 65 20 26 39 45 2e 20 4f 6e |m.Osbyte &9E. On| 00000b20 20 72 65 74 75 72 6e 20 66 72 6f 6d 20 4f 73 62 | return from Osb| 00000b30 79 74 65 20 26 39 45 20 74 68 65 20 41 20 61 6e |yte &9E the A an| 00000b40 64 20 58 20 72 65 67 69 73 74 65 72 73 20 61 72 |d X registers ar| 00000b50 65 20 70 72 65 73 65 72 76 65 64 0d 62 75 74 20 |e preserved.but | 00000b60 74 68 65 20 63 61 72 72 79 20 66 6c 61 67 20 69 |the carry flag i| 00000b70 73 20 75 6e 64 65 66 69 6e 65 64 2e 0d 0d 45 61 |s undefined...Ea| 00000b80 63 68 20 63 6f 6d 6d 61 6e 64 20 77 69 6c 6c 20 |ch command will | 00000b90 6e 6f 77 20 62 65 20 63 6f 6e 73 69 64 65 72 65 |now be considere| 00000ba0 64 20 69 6e 20 64 65 74 61 69 6c 20 61 6e 64 20 |d in detail and | 00000bb0 61 6e 20 65 78 61 6d 70 6c 65 20 6f 66 20 68 6f |an example of ho| 00000bc0 77 20 65 61 63 68 0d 6f 6e 65 20 63 61 6e 20 62 |w each.one can b| 00000bd0 65 20 75 73 65 64 20 77 69 6c 6c 20 62 65 20 67 |e used will be g| 00000be0 69 76 65 6e 2e 0d 0d 2d 2d 2d 0d 4e 4f 50 0d 2d |iven...---.NOP.-| 00000bf0 2d 2d 0d 0d 4f 73 62 79 74 65 20 26 39 46 20 77 |--..Osbyte &9F w| 00000c00 69 74 68 20 59 20 3d 20 26 32 30 20 6f 72 20 59 |ith Y = &20 or Y| 00000c10 20 3d 20 26 30 30 0d 0d 54 68 65 20 4e 4f 50 20 | = &00..The NOP | 00000c20 63 6f 6d 6d 61 6e 64 20 69 73 20 74 68 65 20 53 |command is the S| 00000c30 70 65 65 63 68 20 50 72 6f 63 65 73 73 6f 72 27 |peech Processor'| 00000c40 73 20 65 71 75 69 76 61 6c 65 6e 74 20 6f 66 20 |s equivalent of | 00000c50 74 68 65 20 41 73 73 65 6d 62 6c 79 0d 6c 61 6e |the Assembly.lan| 00000c60 67 75 61 67 65 20 4e 4f 50 20 64 75 6d 6d 79 20 |guage NOP dummy | 00000c70 69 6e 73 74 72 75 63 74 69 6f 6e 20 61 6e 64 20 |instruction and | 00000c80 69 74 20 64 6f 65 73 20 6e 6f 74 68 69 6e 67 2e |it does nothing.| 00000c90 20 42 65 63 61 75 73 65 20 69 74 20 64 6f 65 73 | Because it does| 00000ca0 0d 6e 6f 74 68 69 6e 67 20 69 74 20 69 73 20 61 |.nothing it is a| 00000cb0 20 73 75 69 74 61 62 6c 65 20 70 61 64 20 63 68 | suitable pad ch| 00000cc0 61 72 61 63 74 65 72 20 74 6f 20 69 6e 63 6c 75 |aracter to inclu| 00000cd0 64 65 20 69 6e 20 6c 69 73 74 73 20 6f 66 20 63 |de in lists of c| 00000ce0 6f 6d 6d 61 6e 64 73 20 74 6f 0d 62 65 20 73 65 |ommands to.be se| 00000cf0 6e 74 20 74 6f 20 74 68 65 20 73 70 65 65 63 68 |nt to the speech| 00000d00 20 70 72 6f 63 65 73 73 6f 72 2e 0d 0d 0d 20 20 | processor.... | 00000d10 20 20 20 20 20 4c 44 41 20 23 26 39 46 20 20 20 | LDA #&9F | 00000d20 20 20 20 20 20 5c 20 77 72 69 74 65 20 74 6f 20 | \ write to | 00000d30 73 70 65 65 63 68 20 70 72 6f 63 65 73 73 6f 72 |speech processor| 00000d40 0d 20 20 20 20 20 20 20 4c 44 59 20 23 26 32 30 |. LDY #&20| 00000d50 20 20 20 20 20 20 20 20 5c 20 4e 6f 70 20 63 6f | \ Nop co| 00000d60 6d 6d 61 6e 64 0d 20 20 20 20 20 20 20 4a 53 52 |mmand. JSR| 00000d70 20 26 46 46 46 34 20 20 20 20 20 20 20 5c 20 4a | &FFF4 \ J| 00000d80 53 52 20 6f 73 62 79 74 65 0d 0d 0d 2d 2d 2d 2d |SR osbyte...----| 00000d90 2d 0d 52 65 73 65 74 0d 2d 2d 2d 2d 2d 0d 0d 4f |-.Reset.-----..O| 00000da0 73 62 79 74 65 20 26 39 46 20 77 69 74 68 20 59 |sbyte &9F with Y| 00000db0 20 3d 20 26 37 30 0d 2a 46 58 20 31 35 39 2c 30 | = &70.*FX 159,0| 00000dc0 2c 31 31 32 0d 0d 54 68 65 20 52 65 73 65 74 20 |,112..The Reset | 00000dd0 63 6f 6d 6d 61 6e 64 20 61 6c 6c 6f 77 73 20 74 |command allows t| 00000de0 68 65 20 43 50 55 20 74 6f 20 69 6d 6d 65 64 69 |he CPU to immedi| 00000df0 61 74 65 6c 79 20 68 61 6c 74 20 61 20 53 70 65 |ately halt a Spe| 00000e00 61 6b 20 63 6f 6d 6d 61 6e 64 20 61 6e 64 0d 70 |ak command and.p| 00000e10 75 74 20 74 68 65 20 73 70 65 65 63 68 20 70 72 |ut the speech pr| 00000e20 6f 63 65 73 73 6f 72 20 69 6e 74 6f 20 61 20 6b |ocessor into a k| 00000e30 6e 6f 77 6e 20 73 74 61 74 65 2e 20 52 65 73 65 |nown state. Rese| 00000e40 74 20 77 69 6c 6c 20 6e 6f 74 20 68 61 6c 74 20 |t will not halt | 00000e50 61 20 53 70 65 61 6b 0d 45 78 74 65 72 6e 61 6c |a Speak.External| 00000e60 20 63 6f 6d 6d 61 6e 64 20 62 65 63 61 75 73 65 | command because| 00000e70 20 74 68 65 20 26 37 30 20 69 6e 20 74 68 65 20 | the &70 in the | 00000e80 59 20 72 65 67 69 73 74 65 72 20 69 73 20 74 68 |Y register is th| 00000e90 65 6e 20 74 61 6b 65 6e 20 61 73 20 64 61 74 61 |en taken as data| 00000ea0 0d 72 61 74 68 65 72 20 74 68 61 6e 20 61 20 63 |.rather than a c| 00000eb0 6f 6d 6d 61 6e 64 2e 20 54 68 65 20 6d 61 69 6e |ommand. The main| 00000ec0 20 75 73 65 20 66 6f 72 20 74 68 69 73 20 63 6f | use for this co| 00000ed0 6d 6d 61 6e 64 20 77 69 6c 6c 20 62 65 20 74 6f |mmand will be to| 00000ee0 20 22 63 68 6f 70 20 75 70 22 0d 74 68 65 20 77 | "chop up".the w| 00000ef0 6f 72 64 73 20 61 76 61 69 6c 61 62 6c 65 20 69 |ords available i| 00000f00 6e 20 61 20 77 6f 72 64 20 50 48 52 4f 4d 2e 20 |n a word PHROM. | 00000f10 49 6e 20 74 68 69 73 20 77 61 79 20 74 68 65 20 |In this way the | 00000f20 77 6f 72 64 20 22 41 63 6f 72 6e 22 20 63 61 6e |word "Acorn" can| 00000f30 20 62 65 0d 6d 61 64 65 20 74 6f 20 73 6f 75 6e | be.made to soun| 00000f40 64 20 6c 69 6b 65 20 22 61 63 68 65 22 20 6f 72 |d like "ache" or| 00000f50 20 22 61 2d 22 2e 20 54 68 69 73 20 6d 65 74 68 | "a-". This meth| 00000f60 6f 64 20 6f 66 20 70 72 6f 64 75 63 69 6e 67 20 |od of producing | 00000f70 61 6e 20 65 78 74 65 6e 64 65 64 0d 76 6f 63 61 |an extended.voca| 00000f80 62 75 6c 61 72 79 20 77 69 6c 6c 20 62 65 20 63 |bulary will be c| 00000f90 6f 76 65 72 65 64 20 69 6e 20 64 65 74 61 69 6c |overed in detail| 00000fa0 20 69 6e 20 6d 6f 64 75 6c 65 20 36 2e 0d 0d 0d | in module 6....| 00000fb0 20 20 20 20 20 20 20 4c 44 41 20 23 26 39 46 20 | LDA #&9F | 00000fc0 20 20 20 20 20 20 20 5c 20 77 72 69 74 65 20 74 | \ write t| 00000fd0 6f 20 73 70 65 65 63 68 20 70 72 6f 63 65 73 73 |o speech process| 00000fe0 6f 72 0d 20 20 20 20 20 20 20 4c 44 59 20 23 26 |or. LDY #&| 00000ff0 37 30 20 20 20 20 20 20 20 20 5c 20 52 65 73 65 |70 \ Rese| 00001000 74 20 63 6f 6d 6d 61 6e 64 0d 20 20 20 20 20 20 |t command. | 00001010 20 4a 53 52 20 26 46 46 46 34 20 20 20 20 20 20 | JSR &FFF4 | 00001020 20 5c 20 4a 53 52 20 6f 73 62 79 74 65 0d 0d 0d | \ JSR osbyte...| 00001030 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 4c 6f 61 |------------.Loa| 00001040 64 20 41 64 64 72 65 73 73 0d 2d 2d 2d 2d 2d 2d |d Address.------| 00001050 2d 2d 2d 2d 2d 2d 0d 0d 4f 73 62 79 74 65 20 26 |------..Osbyte &| 00001060 39 46 20 77 69 74 68 20 59 20 3d 20 26 34 6e 2c |9F with Y = &4n,| 00001070 20 77 68 65 72 65 20 6e 20 3d 20 26 30 20 74 6f | where n = &0 to| 00001080 20 26 46 0d 0d 54 68 65 20 4c 6f 61 64 20 41 64 | &F..The Load Ad| 00001090 64 72 65 73 73 20 63 6f 6d 6d 61 6e 64 20 69 73 |dress command is| 000010a0 20 75 73 65 64 20 74 6f 20 61 6c 74 65 72 20 74 | used to alter t| 000010b0 68 65 20 61 64 64 72 65 73 73 20 72 65 67 69 73 |he address regis| 000010c0 74 65 72 20 6f 66 20 61 20 77 6f 72 64 0d 50 48 |ter of a word.PH| 000010d0 52 4f 4d 2e 20 54 68 69 73 20 63 6f 6d 6d 61 6e |ROM. This comman| 000010e0 64 20 68 61 73 20 74 6f 20 62 65 20 73 65 6e 74 |d has to be sent| 000010f0 20 74 6f 20 74 68 65 20 73 70 65 65 63 68 20 70 | to the speech p| 00001100 72 6f 63 65 73 73 6f 72 20 66 69 76 65 20 74 69 |rocessor five ti| 00001110 6d 65 73 20 74 6f 0d 61 6c 74 65 72 20 74 68 65 |mes to.alter the| 00001120 20 31 34 20 62 69 74 20 77 6f 72 64 20 50 48 52 | 14 bit word PHR| 00001130 4f 4d 20 61 64 64 72 65 73 73 20 72 65 67 69 73 |OM address regis| 00001140 74 65 72 2e 20 54 68 65 20 31 34 20 62 69 74 73 |ter. The 14 bits| 00001150 20 61 72 65 20 73 65 6e 74 20 61 0d 6e 79 62 62 | are sent a.nybb| 00001160 6c 65 20 61 74 20 61 20 74 69 6d 65 20 77 69 74 |le at a time wit| 00001170 68 20 74 68 65 20 6c 65 61 73 74 20 73 69 67 6e |h the least sign| 00001180 69 66 69 63 61 6e 74 20 6e 79 62 62 6c 65 20 66 |ificant nybble f| 00001190 69 72 73 74 2c 20 74 68 65 20 6d 6f 73 74 0d 73 |irst, the most.s| 000011a0 69 67 6e 69 66 69 63 61 6e 74 20 6e 79 62 62 6c |ignificant nybbl| 000011b0 65 20 6c 61 73 74 2c 20 61 6e 64 20 66 6f 6c 6c |e last, and foll| 000011c0 6f 77 65 64 20 62 79 20 61 20 6e 75 6c 6c 20 6e |owed by a null n| 000011d0 79 62 62 6c 65 2e 20 45 61 63 68 20 6e 79 62 62 |ybble. Each nybb| 000011e0 6c 65 20 68 61 73 20 74 6f 0d 62 65 20 4f 52 65 |le has to.be ORe| 000011f0 64 20 77 69 74 68 20 23 26 34 30 2c 20 74 68 65 |d with #&40, the| 00001200 20 4c 6f 61 64 20 41 64 64 72 65 73 73 20 63 6f | Load Address co| 00001210 6d 6d 61 6e 64 2c 20 74 6f 20 63 72 65 61 74 65 |mmand, to create| 00001220 20 61 20 62 79 74 65 20 77 68 69 63 68 20 69 73 | a byte which is| 00001230 0d 6c 6f 61 64 65 64 20 69 6e 74 6f 20 74 68 65 |.loaded into the| 00001240 20 59 20 72 65 67 69 73 74 65 72 20 61 6e 64 20 | Y register and | 00001250 74 68 65 6e 20 4f 73 62 79 74 65 20 26 39 46 20 |then Osbyte &9F | 00001260 69 73 20 75 73 65 64 20 74 6f 20 77 72 69 74 65 |is used to write| 00001270 20 74 68 65 0d 63 6f 6d 6d 61 6e 64 20 74 6f 20 | the.command to | 00001280 74 68 65 20 73 70 65 65 63 68 20 70 72 6f 63 65 |the speech proce| 00001290 73 73 6f 72 2e 20 54 68 65 20 77 6f 72 64 20 50 |ssor. The word P| 000012a0 48 52 4f 4d 20 6e 75 6d 62 65 72 2c 20 75 73 75 |HROM number, usu| 000012b0 61 6c 6c 79 20 26 30 46 20 69 6e 20 74 68 65 0d |ally &0F in the.| 000012c0 41 63 6f 72 6e 20 73 79 73 74 65 6d 2c 20 69 73 |Acorn system, is| 000012d0 20 61 6c 73 6f 20 73 65 6e 74 20 77 69 74 68 20 | also sent with | 000012e0 74 68 65 20 4c 6f 61 64 20 41 64 64 72 65 73 73 |the Load Address| 000012f0 20 63 6f 6d 6d 61 6e 64 20 62 79 20 4f 52 69 6e | command by ORin| 00001300 67 20 74 68 65 20 6d 6f 73 74 0d 73 69 67 6e 69 |g the most.signi| 00001310 66 69 63 61 6e 74 20 74 77 6f 20 62 69 74 73 20 |ficant two bits | 00001320 6f 66 20 74 68 65 20 77 6f 72 64 20 50 48 52 4f |of the word PHRO| 00001330 4d 20 6e 75 6d 62 65 72 20 28 25 31 31 30 30 20 |M number (%1100 | 00001340 3d 20 26 30 43 29 20 77 69 74 68 20 74 68 65 0d |= &0C) with the.| 00001350 66 6f 75 72 74 68 20 62 79 74 65 20 61 6e 64 20 |fourth byte and | 00001360 4f 52 69 6e 67 20 74 68 65 20 6c 65 61 73 74 20 |ORing the least | 00001370 73 69 67 6e 69 66 69 63 61 6e 74 20 74 77 6f 20 |significant two | 00001380 62 69 74 73 20 6f 66 20 74 68 65 20 77 6f 72 64 |bits of the word| 00001390 20 50 48 52 4f 4d 0d 6e 75 6d 62 65 72 20 28 25 | PHROM.number (%| 000013a0 30 30 31 31 20 3d 20 26 30 33 29 20 77 69 74 68 |0011 = &03) with| 000013b0 20 74 68 65 20 66 69 66 74 68 20 62 79 74 65 2e | the fifth byte.| 000013c0 0d 0d 54 68 69 73 20 72 61 74 68 65 72 20 63 6f |..This rather co| 000013d0 6d 70 6c 69 63 61 74 65 64 20 6d 65 74 68 6f 64 |mplicated method| 000013e0 20 6f 66 20 77 72 69 74 69 6e 67 20 74 6f 20 74 | of writing to t| 000013f0 68 65 20 77 6f 72 64 20 50 48 52 4f 4d 20 61 64 |he word PHROM ad| 00001400 64 72 65 73 73 0d 72 65 67 69 73 74 65 72 20 69 |dress.register i| 00001410 73 20 62 65 73 74 20 69 6c 6c 75 73 74 72 61 74 |s best illustrat| 00001420 65 64 20 77 69 74 68 20 73 6f 6d 65 20 65 78 61 |ed with some exa| 00001430 6d 70 6c 65 73 2e 20 4c 65 74 20 75 73 20 73 75 |mples. Let us su| 00001440 70 70 6f 73 65 20 74 68 61 74 20 74 68 65 0d 61 |ppose that the.a| 00001450 64 64 72 65 73 73 20 26 31 32 33 34 20 69 73 20 |ddress &1234 is | 00001460 74 6f 20 62 65 20 77 72 69 74 74 65 6e 20 69 6e |to be written in| 00001470 74 6f 20 74 68 65 20 61 64 64 72 65 73 73 20 72 |to the address r| 00001480 65 67 69 73 74 65 72 20 66 6f 72 20 77 6f 72 64 |egister for word| 00001490 20 50 48 52 4f 4d 20 41 2e 0d 41 6c 6c 20 74 68 | PHROM A..All th| 000014a0 65 20 65 78 61 6d 70 6c 65 73 20 77 69 6c 6c 20 |e examples will | 000014b0 75 73 65 20 77 6f 72 64 20 50 48 52 4f 4d 20 41 |use word PHROM A| 000014c0 20 62 65 63 61 75 73 65 20 74 68 69 73 20 69 73 | because this is| 000014d0 20 74 68 65 20 6f 6e 6c 79 20 6f 6e 65 0d 63 6f | the only one.co| 000014e0 6d 6d 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65 |mmonly available| 000014f0 2e 20 54 68 65 20 6e 75 6d 62 65 72 20 26 30 46 |. The number &0F| 00001500 20 68 61 73 20 62 65 65 6e 20 61 73 73 69 67 6e | has been assign| 00001510 65 64 20 74 6f 20 77 6f 72 64 20 50 48 52 4f 4d |ed to word PHROM| 00001520 20 41 2e 0d 0d 46 69 72 73 74 20 74 68 65 20 6f | A...First the o| 00001530 72 64 65 72 20 6f 66 20 74 68 65 20 6e 79 62 62 |rder of the nybb| 00001540 6c 65 73 20 68 61 73 20 74 6f 20 62 65 20 72 65 |les has to be re| 00001550 76 65 72 73 65 64 20 61 6e 64 20 61 20 6e 75 6c |versed and a nul| 00001560 6c 20 66 69 66 74 68 20 6e 79 62 62 6c 65 0d 61 |l fifth nybble.a| 00001570 64 64 65 64 20 6f 6e 74 6f 20 74 68 65 20 65 6e |dded onto the en| 00001580 64 2e 20 54 68 65 20 66 6f 75 72 20 6e 79 62 62 |d. The four nybb| 00001590 6c 65 73 20 31 20 32 20 33 20 34 20 61 72 65 20 |les 1 2 3 4 are | 000015a0 72 65 6f 72 64 65 72 65 64 20 69 6e 74 6f 20 34 |reordered into 4| 000015b0 20 33 20 32 20 31 20 30 0d 28 77 69 74 68 20 74 | 3 2 1 0.(with t| 000015c0 68 65 20 6e 75 6c 6c 20 6e 79 62 62 6c 65 20 61 |he null nybble a| 000015d0 64 64 65 64 20 6f 6e 74 6f 20 74 68 65 20 65 6e |dded onto the en| 000015e0 64 29 2e 20 45 61 63 68 20 6e 79 62 62 6c 65 20 |d). Each nybble | 000015f0 68 61 73 20 74 6f 20 62 65 20 4f 52 65 64 20 77 |has to be ORed w| 00001600 69 74 68 0d 26 34 30 2e 20 54 68 65 20 66 69 76 |ith.&40. The fiv| 00001610 65 20 6e 79 62 62 6c 65 73 20 61 72 65 20 74 72 |e nybbles are tr| 00001620 61 6e 73 66 6f 72 6d 65 64 20 69 6e 74 6f 20 74 |ansformed into t| 00001630 68 65 20 66 69 76 65 20 62 79 74 65 73 20 26 34 |he five bytes &4| 00001640 34 20 26 34 33 20 26 34 32 20 26 34 31 0d 61 6e |4 &43 &42 &41.an| 00001650 64 20 26 34 30 2e 20 54 68 65 20 66 6f 75 72 74 |d &40. The fourt| 00001660 68 20 62 79 74 65 20 68 61 73 20 74 6f 20 62 65 |h byte has to be| 00001670 20 4f 52 65 64 20 77 69 74 68 20 74 68 65 20 74 | ORed with the t| 00001680 77 6f 20 6d 6f 73 74 20 73 69 67 6e 69 66 69 63 |wo most signific| 00001690 61 6e 74 20 62 69 74 73 0d 28 25 31 31 30 30 29 |ant bits.(%1100)| 000016a0 20 6f 66 20 74 68 65 20 77 6f 72 64 20 50 48 52 | of the word PHR| 000016b0 4f 4d 20 6e 75 6d 62 65 72 2e 20 26 34 31 20 4f |OM number. &41 O| 000016c0 52 20 26 30 43 20 3d 20 26 34 44 2e 20 54 68 65 |R &0C = &4D. The| 000016d0 20 66 69 66 74 68 20 62 79 74 65 20 68 61 73 20 | fifth byte has | 000016e0 74 6f 0d 62 65 20 4f 52 65 64 20 77 69 74 68 20 |to.be ORed with | 000016f0 74 68 65 20 74 77 6f 20 6c 65 61 73 74 20 73 69 |the two least si| 00001700 67 6e 69 66 69 63 61 6e 74 20 62 69 74 73 20 28 |gnificant bits (| 00001710 25 30 30 31 31 29 20 6f 66 20 74 68 65 20 77 6f |%0011) of the wo| 00001720 72 64 20 50 48 52 4f 4d 0d 6e 75 6d 62 65 72 2e |rd PHROM.number.| 00001730 20 26 34 30 20 4f 52 20 26 30 33 20 3d 20 26 34 | &40 OR &03 = &4| 00001740 33 2e 20 54 68 65 20 61 64 64 72 65 73 73 20 26 |3. The address &| 00001750 31 32 33 34 20 69 73 20 74 72 61 6e 73 66 6f 72 |1234 is transfor| 00001760 6d 65 64 20 69 6e 74 6f 20 74 68 65 20 66 69 76 |med into the fiv| 00001770 65 0d 62 79 74 65 73 20 26 34 34 20 26 34 33 20 |e.bytes &44 &43 | 00001780 26 34 32 20 26 34 44 20 26 34 33 2c 20 65 61 63 |&42 &4D &43, eac| 00001790 68 20 6f 66 20 77 68 69 63 68 20 77 69 6c 6c 20 |h of which will | 000017a0 6e 65 65 64 20 74 6f 20 62 65 20 6c 6f 61 64 65 |need to be loade| 000017b0 64 20 69 6e 74 6f 20 74 68 65 20 59 0d 72 65 67 |d into the Y.reg| 000017c0 69 73 74 65 72 20 61 6e 64 20 73 65 6e 74 20 74 |ister and sent t| 000017d0 6f 20 74 68 65 20 73 70 65 65 63 68 20 70 72 6f |o the speech pro| 000017e0 63 65 73 73 6f 72 20 75 73 69 6e 67 20 4f 73 62 |cessor using Osb| 000017f0 79 74 65 20 26 39 46 2e 0d 0d 54 68 65 20 66 6f |yte &9F...The fo| 00001800 6c 6c 6f 77 69 6e 67 20 63 6f 64 65 20 63 6f 75 |llowing code cou| 00001810 6c 64 20 62 65 20 75 73 65 64 20 74 6f 20 77 72 |ld be used to wr| 00001820 69 74 65 20 74 68 65 20 61 64 64 72 65 73 73 20 |ite the address | 00001830 26 31 32 33 34 20 69 6e 74 6f 20 74 68 65 0d 61 |&1234 into the.a| 00001840 64 64 72 65 73 73 20 72 65 67 69 73 74 65 72 20 |ddress register | 00001850 66 6f 72 20 77 6f 72 64 20 50 48 52 4f 4d 20 41 |for word PHROM A| 00001860 2e 0d 0d 0d 20 20 20 20 20 20 20 4c 44 41 20 23 |.... LDA #| 00001870 26 39 46 20 20 20 20 20 20 20 20 5c 20 4f 73 62 |&9F \ Osb| 00001880 79 74 65 20 26 39 46 2c 20 77 72 69 74 65 20 74 |yte &9F, write t| 00001890 6f 20 73 70 65 65 63 68 20 70 72 6f 63 65 73 73 |o speech process| 000018a0 6f 72 0d 20 20 20 20 20 20 20 4c 44 59 20 23 26 |or. LDY #&| 000018b0 34 34 20 20 20 20 20 20 20 20 5c 20 6c 65 61 73 |44 \ leas| 000018c0 74 20 73 69 67 6e 69 66 69 63 61 6e 74 20 6e 79 |t significant ny| 000018d0 62 62 6c 65 20 4f 52 20 23 26 34 30 0d 20 20 20 |bble OR #&40. | 000018e0 20 20 20 20 4a 53 52 20 26 46 46 46 34 20 20 20 | JSR &FFF4 | 000018f0 20 20 20 20 5c 20 4a 53 52 20 6f 73 62 79 74 65 | \ JSR osbyte| 00001900 0d 20 20 20 20 20 20 20 4c 44 59 20 23 26 34 33 |. LDY #&43| 00001910 0d 20 20 20 20 20 20 20 4a 53 52 20 26 46 46 46 |. JSR &FFF| 00001920 34 0d 20 20 20 20 20 20 20 4c 44 59 20 23 26 34 |4. LDY #&4| 00001930 32 0d 20 20 20 20 20 20 20 4a 53 52 20 26 46 46 |2. JSR &FF| 00001940 46 34 0d 20 20 20 20 20 20 20 4c 44 59 20 23 26 |F4. LDY #&| 00001950 34 44 20 20 20 20 20 20 20 20 5c 20 6d 6f 73 74 |4D \ most| 00001960 20 73 69 67 6e 69 66 69 63 61 6e 74 20 6e 79 62 | significant nyb| 00001970 62 6c 65 20 4f 52 20 23 26 34 43 0d 20 20 20 20 |ble OR #&4C. | 00001980 20 20 20 4a 53 52 20 26 46 46 46 34 0d 20 20 20 | JSR &FFF4. | 00001990 20 20 20 20 4c 44 59 20 23 26 34 33 20 20 20 20 | LDY #&43 | 000019a0 20 20 20 20 5c 20 6c 61 73 74 20 62 79 74 65 20 | \ last byte | 000019b0 61 6c 77 61 79 73 20 23 26 34 33 20 77 69 74 68 |always #&43 with| 000019c0 20 77 6f 72 64 20 50 48 52 4f 4d 20 41 0d 20 20 | word PHROM A. | 000019d0 20 20 20 20 20 4a 53 52 20 26 46 46 46 34 0d 0d | JSR &FFF4..| 000019e0 0d 54 68 65 20 6c 6f 61 64 20 61 64 64 72 65 73 |.The load addres| 000019f0 73 20 63 6f 6d 6d 61 6e 64 20 68 61 73 20 74 6f |s command has to| 00001a00 20 62 65 20 75 73 65 64 20 66 69 76 65 20 74 69 | be used five ti| 00001a10 6d 65 73 20 65 76 65 6e 20 69 66 20 6c 65 73 73 |mes even if less| 00001a20 20 74 68 61 6e 20 66 6f 75 72 0d 6e 79 62 62 6c | than four.nybbl| 00001a30 65 73 20 61 72 65 20 75 73 65 64 20 74 6f 20 73 |es are used to s| 00001a40 70 65 63 69 66 79 20 61 6e 20 61 64 64 72 65 73 |pecify an addres| 00001a50 73 2e 20 49 66 2c 20 66 6f 72 20 65 78 61 6d 70 |s. If, for examp| 00001a60 6c 65 2c 20 74 68 65 20 61 64 64 72 65 73 73 20 |le, the address | 00001a70 26 34 32 0d 69 73 20 74 6f 20 62 65 20 6c 6f 61 |&42.is to be loa| 00001a80 64 65 64 20 69 6e 74 6f 20 74 68 65 20 61 64 64 |ded into the add| 00001a90 72 65 73 73 20 72 65 67 69 73 74 65 72 20 69 74 |ress register it| 00001aa0 20 6d 75 73 74 20 73 74 69 6c 6c 20 75 6e 64 65 | must still unde| 00001ab0 72 67 6f 20 74 68 65 20 73 61 6d 65 0d 74 72 61 |rgo the same.tra| 00001ac0 6e 73 66 6f 72 6d 61 74 69 6f 6e 20 69 6e 74 6f |nsformation into| 00001ad0 20 66 69 76 65 20 62 79 74 65 73 2e 20 26 30 30 | five bytes. &00| 00001ae0 34 32 20 69 73 20 72 65 76 65 72 73 65 64 20 61 |42 is reversed a| 00001af0 6e 64 20 61 20 6e 75 6c 6c 20 6e 79 62 62 6c 65 |nd a null nybble| 00001b00 20 69 73 0d 61 64 64 65 64 20 6f 6e 74 6f 20 74 | is.added onto t| 00001b10 68 65 20 65 6e 64 20 74 6f 20 67 69 76 65 20 32 |he end to give 2| 00001b20 20 34 20 30 20 30 20 30 2e 20 45 61 63 68 20 6e | 4 0 0 0. Each n| 00001b30 79 62 62 6c 65 20 69 73 20 4f 52 65 64 20 77 69 |ybble is ORed wi| 00001b40 74 68 20 26 34 30 20 74 6f 20 66 6f 72 6d 0d 74 |th &40 to form.t| 00001b50 68 65 20 66 69 76 65 20 62 79 74 65 73 20 26 34 |he five bytes &4| 00001b60 32 20 26 34 34 20 26 34 30 20 26 34 30 20 26 34 |2 &44 &40 &40 &4| 00001b70 30 2e 20 54 68 65 20 66 6f 75 72 74 68 20 62 79 |0. The fourth by| 00001b80 74 65 20 69 73 20 4f 52 65 64 20 77 69 74 68 20 |te is ORed with | 00001b90 26 30 43 20 61 6e 64 0d 74 68 65 20 66 69 66 74 |&0C and.the fift| 00001ba0 68 20 62 79 74 65 20 69 73 20 4f 52 65 64 20 77 |h byte is ORed w| 00001bb0 69 74 68 20 26 30 33 20 74 6f 20 73 70 65 63 69 |ith &03 to speci| 00001bc0 66 79 20 77 6f 72 64 20 50 48 52 4f 4d 20 41 20 |fy word PHROM A | 00001bd0 28 6e 75 6d 62 65 72 20 26 30 46 29 2e 20 54 68 |(number &0F). Th| 00001be0 65 0d 62 79 74 65 73 20 26 34 32 20 26 34 34 20 |e.bytes &42 &44 | 00001bf0 26 34 30 20 26 34 43 20 26 34 33 20 63 61 6e 20 |&40 &4C &43 can | 00001c00 74 68 65 6e 20 62 65 20 73 65 6e 74 20 74 6f 20 |then be sent to | 00001c10 74 68 65 20 73 70 65 65 63 68 20 70 72 6f 63 65 |the speech proce| 00001c20 73 73 6f 72 20 75 73 69 6e 67 0d 4f 73 62 79 74 |ssor using.Osbyt| 00001c30 65 20 26 39 46 20 66 69 76 65 20 74 69 6d 65 73 |e &9F five times| 00001c40 20 74 6f 20 6c 6f 61 64 20 74 68 65 20 61 64 64 | to load the add| 00001c50 72 65 73 73 20 72 65 67 69 73 74 65 72 20 77 69 |ress register wi| 00001c60 74 68 20 26 34 32 2e 0d 0d 49 74 20 73 68 6f 75 |th &42...It shou| 00001c70 6c 64 20 62 65 20 63 6c 65 61 72 20 66 72 6f 6d |ld be clear from| 00001c80 20 74 68 65 73 65 20 65 78 61 6d 70 6c 65 73 20 | these examples | 00001c90 74 68 61 74 2c 20 77 68 65 6e 20 75 73 69 6e 67 |that, when using| 00001ca0 20 77 6f 72 64 20 50 48 52 4f 4d 20 41 0d 28 6e | word PHROM A.(n| 00001cb0 75 6d 62 65 72 20 26 30 46 29 2c 20 74 68 65 20 |umber &0F), the | 00001cc0 66 69 66 74 68 20 62 79 74 65 20 77 69 6c 6c 20 |fifth byte will | 00001cd0 61 6c 77 61 79 73 20 62 65 20 26 34 33 2e 20 42 |always be &43. B| 00001ce0 65 63 61 75 73 65 20 74 68 65 20 77 6f 72 64 20 |ecause the word | 00001cf0 50 48 52 4f 4d 0d 61 64 64 72 65 73 73 65 73 20 |PHROM.addresses | 00001d00 31 36 6b 20 62 79 74 65 73 20 6f 66 20 6d 65 6d |16k bytes of mem| 00001d10 6f 72 79 20 74 68 65 20 6d 6f 73 74 20 73 69 67 |ory the most sig| 00001d20 6e 69 66 69 63 61 6e 74 20 6e 79 62 62 6c 65 20 |nificant nybble | 00001d30 6f 66 20 74 68 65 20 61 64 64 72 65 73 73 0d 77 |of the address.w| 00001d40 69 6c 6c 20 61 6c 77 61 79 73 20 62 65 20 65 69 |ill always be ei| 00001d50 74 68 65 72 20 30 2c 20 31 2c 20 32 20 6f 72 20 |ther 0, 1, 2 or | 00001d60 33 20 77 68 69 63 68 2c 20 77 68 65 6e 20 4f 52 |3 which, when OR| 00001d70 65 64 20 77 69 74 68 20 26 34 43 2c 20 77 69 6c |ed with &4C, wil| 00001d80 6c 20 61 6c 77 61 79 73 0d 72 65 73 75 6c 74 20 |l always.result | 00001d90 69 6e 20 74 68 65 20 66 6f 75 72 74 68 20 62 79 |in the fourth by| 00001da0 74 65 20 62 65 69 6e 67 20 65 69 74 68 65 72 20 |te being either | 00001db0 26 34 43 2c 20 26 34 44 2c 20 26 34 45 20 6f 72 |&4C, &4D, &4E or| 00001dc0 20 26 34 46 2e 0d 0d 54 68 65 20 74 72 61 6e 73 | &4F...The trans| 00001dd0 66 6f 72 6d 61 74 69 6f 6e 20 6f 66 20 74 68 65 |formation of the| 00001de0 20 61 64 64 72 65 73 73 20 69 6e 74 6f 20 74 68 | address into th| 00001df0 65 20 72 65 6c 65 76 61 6e 74 20 66 69 76 65 20 |e relevant five | 00001e00 62 79 74 65 73 20 61 6e 64 20 77 72 69 74 69 6e |bytes and writin| 00001e10 67 0d 74 68 65 20 62 79 74 65 73 20 69 6e 74 6f |g.the bytes into| 00001e20 20 74 68 65 20 61 64 64 72 65 73 73 20 72 65 67 | the address reg| 00001e30 69 73 74 65 72 20 63 61 6e 20 62 65 20 64 6f 6e |ister can be don| 00001e40 65 20 77 69 74 68 20 73 75 62 72 6f 75 74 69 6e |e with subroutin| 00001e50 65 20 73 75 63 68 20 61 73 0d 74 68 65 20 6f 6e |e such as.the on| 00001e60 65 20 73 68 6f 77 6e 20 62 65 6c 6f 77 2e 20 54 |e shown below. T| 00001e70 68 65 20 73 75 62 72 6f 75 74 69 6e 65 20 6c 61 |he subroutine la| 00001e80 62 65 6c 65 64 20 27 61 64 64 72 65 73 73 27 20 |beled 'address' | 00001e90 69 73 20 63 61 6c 6c 65 64 20 77 69 74 68 20 74 |is called with t| 00001ea0 68 65 0d 6c 65 61 73 74 20 73 69 67 6e 69 66 69 |he.least signifi| 00001eb0 63 61 6e 74 20 62 79 74 65 20 6f 66 20 74 68 65 |cant byte of the| 00001ec0 20 77 6f 72 64 20 50 48 52 4f 4d 20 61 64 64 72 | word PHROM addr| 00001ed0 65 73 73 20 69 6e 20 74 68 65 20 58 20 72 65 67 |ess in the X reg| 00001ee0 69 73 74 65 72 20 61 6e 64 20 74 68 65 0d 6d 6f |ister and the.mo| 00001ef0 73 74 20 73 69 67 6e 69 66 69 63 61 6e 74 20 62 |st significant b| 00001f00 79 74 65 20 69 6e 20 74 68 65 20 59 20 72 65 67 |yte in the Y reg| 00001f10 69 73 74 65 72 2e 0d 0d 0d 20 20 20 20 20 20 20 |ister.... | 00001f20 4c 44 58 20 23 61 64 64 72 20 4d 4f 44 20 32 35 |LDX #addr MOD 25| 00001f30 36 20 20 20 20 20 20 20 5c 20 61 64 64 72 20 3d |6 \ addr =| 00001f40 20 31 34 20 62 69 74 20 61 64 64 72 65 73 73 20 | 14 bit address | 00001f50 66 6f 72 20 77 6f 72 64 20 50 48 52 4f 4d 0d 20 |for word PHROM. | 00001f60 20 20 20 20 20 20 4c 44 59 20 23 61 64 64 72 20 | LDY #addr | 00001f70 44 49 56 20 32 35 36 20 20 20 20 20 20 20 5c 20 |DIV 256 \ | 00001f80 61 64 64 72 65 73 73 20 72 65 67 69 73 74 65 72 |address register| 00001f90 0d 20 20 20 20 20 20 20 4a 53 52 20 61 64 64 72 |. JSR addr| 00001fa0 65 73 73 20 20 20 20 20 20 20 20 20 20 20 20 20 |ess | 00001fb0 5c 20 77 72 69 74 65 20 61 64 64 72 65 73 73 20 |\ write address | 00001fc0 69 6e 74 6f 20 50 48 52 4f 4d 20 61 64 64 72 65 |into PHROM addre| 00001fd0 73 73 20 72 65 67 69 73 74 65 72 0d 20 20 20 20 |ss register. | 00001fe0 20 20 20 52 54 53 20 20 20 20 20 20 20 20 20 20 | RTS | 00001ff0 20 20 20 20 20 20 20 20 20 20 20 5c 20 72 65 74 | \ ret| 00002000 75 72 6e 20 74 6f 20 42 41 53 49 43 0d 2e 61 64 |urn to BASIC..ad| 00002010 64 72 65 73 73 0d 20 20 20 20 20 20 20 54 59 41 |dress. TYA| 00002020 0d 20 20 20 20 20 20 20 50 48 41 20 20 20 20 20 |. PHA | 00002030 20 20 20 20 20 20 20 20 5c 20 73 61 76 65 20 74 | \ save t| 00002040 68 65 20 4d 53 42 20 6f 66 20 77 6f 72 64 20 50 |he MSB of word P| 00002050 48 52 4f 4d 20 61 64 64 72 65 73 73 20 62 79 0d |HROM address by.| 00002060 20 20 20 20 20 20 20 50 48 41 20 20 20 20 20 20 | PHA | 00002070 20 20 20 20 20 20 20 5c 20 70 75 73 68 69 6e 67 | \ pushing| 00002080 20 69 74 20 6f 6e 20 74 68 65 20 73 74 61 63 6b | it on the stack| 00002090 20 74 77 69 63 65 0d 20 20 20 20 20 20 20 54 58 | twice. TX| 000020a0 41 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 |A \ | 000020b0 74 68 65 20 6c 65 61 73 74 20 73 69 67 6e 69 66 |the least signif| 000020c0 69 63 61 6e 74 20 6e 79 62 62 6c 65 20 69 73 20 |icant nybble is | 000020d0 69 6e 20 74 68 65 20 58 20 72 65 67 69 73 74 65 |in the X registe| 000020e0 72 0d 20 20 20 20 20 20 20 41 4e 44 20 23 26 46 |r. AND #&F| 000020f0 20 20 20 20 20 20 20 20 20 5c 20 69 73 6f 6c 61 | \ isola| 00002100 74 65 20 74 68 65 20 6c 65 61 73 74 20 73 69 67 |te the least sig| 00002110 6e 69 66 69 63 61 6e 74 20 6e 79 62 62 6c 65 0d |nificant nybble.| 00002120 20 20 20 20 20 20 20 4f 52 41 20 23 26 34 30 20 | ORA #&40 | 00002130 20 20 20 20 20 20 20 5c 20 4f 52 20 69 74 20 77 | \ OR it w| 00002140 69 74 68 20 23 26 34 30 0d 20 20 20 20 20 20 20 |ith #&40. | 00002150 4a 53 52 20 77 72 69 74 65 20 20 20 20 20 20 20 |JSR write | 00002160 5c 20 61 6e 64 20 77 72 69 74 65 20 69 74 20 74 |\ and write it t| 00002170 6f 20 74 68 65 20 73 70 65 65 63 68 20 70 72 6f |o the speech pro| 00002180 63 65 73 73 6f 72 0d 20 20 20 20 20 20 20 54 58 |cessor. TX| 00002190 41 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 |A \ | 000021a0 74 68 65 20 6e 65 78 74 20 6e 79 62 62 6c 65 20 |the next nybble | 000021b0 69 73 20 61 6c 73 6f 20 69 6e 20 74 68 65 20 58 |is also in the X| 000021c0 20 72 65 67 69 73 74 65 72 0d 20 20 20 20 20 20 | register. | 000021d0 20 41 4e 44 20 23 26 46 30 20 20 20 20 20 20 20 | AND #&F0 | 000021e0 20 5c 20 69 73 6f 6c 61 74 65 20 74 68 65 20 73 | \ isolate the s| 000021f0 65 63 6f 6e 64 20 6e 79 62 62 6c 65 0d 20 20 20 |econd nybble. | 00002200 20 20 20 20 4c 53 52 20 41 20 20 20 20 20 20 20 | LSR A | 00002210 20 20 20 20 5c 20 73 68 69 66 74 20 72 69 67 68 | \ shift righ| 00002220 74 20 62 79 20 66 6f 75 72 20 62 69 74 73 0d 20 |t by four bits. | 00002230 20 20 20 20 20 20 4c 53 52 20 41 20 20 20 20 20 | LSR A | 00002240 20 20 20 20 20 20 5c 20 74 6f 20 6d 6f 76 65 20 | \ to move | 00002250 69 74 20 69 6e 74 6f 20 74 68 65 20 66 69 72 73 |it into the firs| 00002260 74 20 66 6f 75 72 20 62 69 74 73 0d 20 20 20 20 |t four bits. | 00002270 20 20 20 4c 53 52 20 41 0d 20 20 20 20 20 20 20 | LSR A. | 00002280 4c 53 52 20 41 0d 20 20 20 20 20 20 20 4f 52 41 |LSR A. ORA| 00002290 20 23 26 34 30 20 20 20 20 20 20 20 20 5c 20 4f | #&40 \ O| 000022a0 52 20 74 68 65 20 73 65 63 6f 6e 64 20 6e 79 62 |R the second nyb| 000022b0 62 6c 65 20 77 69 74 68 20 23 26 34 30 0d 20 20 |ble with #&40. | 000022c0 20 20 20 20 20 4a 53 52 20 77 72 69 74 65 20 20 | JSR write | 000022d0 20 20 20 20 20 5c 20 61 6e 64 20 77 72 69 74 65 | \ and write| 000022e0 20 69 74 20 74 6f 20 74 68 65 20 73 70 65 65 63 | it to the speec| 000022f0 68 20 70 72 6f 63 65 73 73 6f 72 0d 20 20 20 20 |h processor. | 00002300 20 20 20 50 4c 41 20 20 20 20 20 20 20 20 20 20 | PLA | 00002310 20 20 20 5c 20 74 68 65 20 74 68 69 72 64 20 61 | \ the third a| 00002320 6e 64 20 66 6f 75 72 74 68 20 6e 79 62 62 6c 65 |nd fourth nybble| 00002330 73 20 61 72 65 20 6f 6e 20 74 68 65 20 73 74 61 |s are on the sta| 00002340 63 6b 0d 20 20 20 20 20 20 20 41 4e 44 20 23 26 |ck. AND #&| 00002350 46 20 20 20 20 20 20 20 20 20 5c 20 69 73 6f 6c |F \ isol| 00002360 61 74 65 20 74 68 65 20 74 68 69 72 64 20 6e 79 |ate the third ny| 00002370 62 62 6c 65 0d 20 20 20 20 20 20 20 4f 52 41 20 |bble. ORA | 00002380 23 26 34 30 20 20 20 20 20 20 20 20 5c 20 4f 52 |#&40 \ OR| 00002390 20 69 74 20 77 69 74 68 20 23 26 34 30 0d 20 20 | it with #&40. | 000023a0 20 20 20 20 20 4a 53 52 20 77 72 69 74 65 20 20 | JSR write | 000023b0 20 20 20 20 20 5c 20 61 6e 64 20 77 72 69 74 65 | \ and write| 000023c0 20 69 74 20 74 6f 20 74 68 65 20 73 70 65 65 63 | it to the speec| 000023d0 68 20 70 72 6f 63 65 73 73 6f 72 0d 20 20 20 20 |h processor. | 000023e0 20 20 20 50 4c 41 20 20 20 20 20 20 20 20 20 20 | PLA | 000023f0 20 20 20 5c 20 74 68 65 20 66 6f 75 72 74 68 20 | \ the fourth | 00002400 6e 79 62 62 6c 65 20 69 73 20 61 6c 73 6f 20 6f |nybble is also o| 00002410 6e 20 74 68 65 20 73 74 61 63 6b 0d 20 20 20 20 |n the stack. | 00002420 20 20 20 41 4e 44 20 23 26 46 30 20 20 20 20 20 | AND #&F0 | 00002430 20 20 20 5c 20 69 73 6f 6c 61 74 65 20 74 68 65 | \ isolate the| 00002440 20 66 6f 75 72 74 68 20 6e 79 62 62 6c 65 0d 20 | fourth nybble. | 00002450 20 20 20 20 20 20 4c 53 52 20 41 20 20 20 20 20 | LSR A | 00002460 20 20 20 20 20 20 5c 20 73 68 69 66 74 20 72 69 | \ shift ri| 00002470 67 68 74 20 62 79 20 66 6f 75 72 20 62 69 74 73 |ght by four bits| 00002480 0d 20 20 20 20 20 20 20 4c 53 52 20 41 20 20 20 |. LSR A | 00002490 20 20 20 20 20 20 20 20 5c 20 74 6f 20 6d 6f 76 | \ to mov| 000024a0 65 20 69 74 20 69 6e 74 6f 20 74 68 65 20 66 69 |e it into the fi| 000024b0 72 73 74 20 66 6f 75 72 20 62 69 74 73 0d 20 20 |rst four bits. | 000024c0 20 20 20 20 20 4c 53 52 20 41 0d 20 20 20 20 20 | LSR A. | 000024d0 20 20 4c 53 52 20 41 0d 20 20 20 20 20 20 20 4f | LSR A. O| 000024e0 52 41 20 23 26 34 43 20 20 20 20 20 20 20 20 5c |RA #&4C \| 000024f0 20 4f 52 20 74 68 65 20 6d 6f 73 74 20 73 69 67 | OR the most sig| 00002500 6e 69 66 69 63 61 6e 74 20 6e 79 62 62 6c 65 20 |nificant nybble | 00002510 77 69 74 68 20 23 26 34 43 0d 20 20 20 20 20 20 |with #&4C. | 00002520 20 4a 53 52 20 77 72 69 74 65 20 20 20 20 20 20 | JSR write | 00002530 20 5c 20 61 6e 64 20 77 72 69 74 65 20 69 74 20 | \ and write it | 00002540 74 6f 20 74 68 65 20 73 70 65 65 63 68 20 70 72 |to the speech pr| 00002550 6f 63 65 73 73 6f 72 0d 20 20 20 20 20 20 20 4c |ocessor. L| 00002560 44 41 20 23 26 34 33 20 20 20 20 20 20 20 20 5c |DA #&43 \| 00002570 20 6c 61 73 74 20 62 79 74 65 20 61 6c 77 61 79 | last byte alway| 00002580 73 20 26 34 33 20 77 69 74 68 20 50 48 52 4f 4d |s &43 with PHROM| 00002590 20 26 30 46 0d 2e 77 72 69 74 65 0d 20 20 20 20 | &0F..write. | 000025a0 20 20 20 54 41 59 20 20 20 20 20 20 20 20 20 20 | TAY | 000025b0 20 20 20 5c 20 63 6f 6d 6d 61 6e 64 20 66 72 6f | \ command fro| 000025c0 6d 20 41 20 74 6f 20 59 0d 20 20 20 20 20 20 20 |m A to Y. | 000025d0 4c 44 41 20 23 26 39 46 20 20 20 20 20 20 20 20 |LDA #&9F | 000025e0 5c 20 77 72 69 74 65 20 74 6f 20 73 70 65 65 63 |\ write to speec| 000025f0 68 20 70 72 6f 63 65 73 73 6f 72 20 63 6f 6d 6d |h processor comm| 00002600 61 6e 64 0d 20 20 20 20 20 20 20 4a 4d 50 20 26 |and. JMP &| 00002610 46 46 46 34 20 20 20 20 20 20 20 5c 20 4f 73 62 |FFF4 \ Osb| 00002620 79 74 65 20 61 6e 64 20 72 65 74 75 72 6e 0d 0d |yte and return..| 00002630 0d 43 6f 64 69 6e 67 20 73 69 6d 69 6c 61 72 20 |.Coding similar | 00002640 74 6f 20 74 68 65 20 41 73 73 65 6d 62 6c 79 20 |to the Assembly | 00002650 6c 61 6e 67 75 61 67 65 20 73 75 62 72 6f 75 74 |language subrout| 00002660 69 6e 65 20 61 64 64 72 65 73 73 2c 20 61 6e 64 |ine address, and| 00002670 20 69 74 73 0d 65 71 75 69 76 61 6c 65 6e 74 20 | its.equivalent | 00002680 42 41 53 49 43 20 70 72 6f 63 65 64 75 72 65 20 |BASIC procedure | 00002690 50 52 4f 43 61 64 64 72 65 73 73 2c 20 77 69 6c |PROCaddress, wil| 000026a0 6c 20 62 65 20 75 73 65 64 20 69 6e 20 74 68 69 |l be used in thi| 000026b0 73 20 73 65 72 69 65 73 20 74 6f 0d 77 72 69 74 |s series to.writ| 000026c0 65 20 74 6f 20 74 68 65 20 61 64 64 72 65 73 73 |e to the address| 000026d0 20 72 65 67 69 73 74 65 72 20 66 6f 72 20 77 6f | register for wo| 000026e0 72 64 20 50 48 52 4f 4d 20 41 2e 0d 0d 0d 20 20 |rd PHROM A.... | 000026f0 20 20 20 20 20 44 45 46 50 52 4f 43 61 64 64 72 | DEFPROCaddr| 00002700 65 73 73 28 61 64 64 72 65 73 73 29 0d 20 20 20 |ess(address). | 00002710 20 20 20 20 41 25 3d 26 39 46 20 20 3a 52 45 4d | A%=&9F :REM| 00002720 3a 20 6c 6f 61 64 20 61 63 63 75 6d 75 6c 61 74 |: load accumulat| 00002730 6f 72 20 77 69 74 68 20 23 26 39 46 0d 20 20 20 |or with #&9F. | 00002740 20 20 20 20 59 25 3d 26 34 30 2b 28 61 64 64 72 | Y%=&40+(addr| 00002750 65 73 73 20 41 4e 44 20 26 46 29 20 3a 52 45 4d |ess AND &F) :REM| 00002760 3a 20 23 26 34 30 20 4f 52 20 28 6c 65 61 73 74 |: #&40 OR (least| 00002770 20 73 69 67 6e 69 66 69 63 61 6e 74 20 6e 79 62 | significant nyb| 00002780 62 6c 65 29 0d 20 20 20 20 20 20 20 43 41 4c 4c |ble). CALL| 00002790 20 26 46 46 46 34 20 20 20 20 20 20 3a 52 45 4d | &FFF4 :REM| 000027a0 3a 20 63 61 6c 6c 20 6f 73 62 79 74 65 0d 20 20 |: call osbyte. | 000027b0 20 20 20 20 20 59 25 3d 26 34 30 2b 28 61 64 64 | Y%=&40+(add| 000027c0 72 65 73 73 20 41 4e 44 20 26 46 30 29 20 44 49 |ress AND &F0) DI| 000027d0 56 20 26 31 30 0d 20 20 20 20 20 20 20 43 41 4c |V &10. CAL| 000027e0 4c 20 26 46 46 46 34 0d 20 20 20 20 20 20 20 59 |L &FFF4. Y| 000027f0 25 3d 26 34 30 2b 28 61 64 64 72 65 73 73 20 41 |%=&40+(address A| 00002800 4e 44 20 26 46 30 30 29 20 44 49 56 20 26 31 30 |ND &F00) DIV &10| 00002810 30 0d 20 20 20 20 20 20 20 43 41 4c 4c 20 26 46 |0. CALL &F| 00002820 46 46 34 0d 20 20 20 20 20 20 20 59 25 3d 26 34 |FF4. Y%=&4| 00002830 43 2b 28 61 64 64 72 65 73 73 20 41 4e 44 20 26 |C+(address AND &| 00002840 46 30 30 30 29 20 44 49 56 20 26 31 30 30 30 0d |F000) DIV &1000.| 00002850 20 20 20 20 20 20 20 43 41 4c 4c 20 26 46 46 46 | CALL &FFF| 00002860 34 0d 20 20 20 20 20 20 20 59 25 3d 26 34 33 20 |4. Y%=&43 | 00002870 20 3a 52 45 4d 3a 20 6c 61 73 74 20 62 79 74 65 | :REM: last byte| 00002880 20 61 6c 77 61 79 73 20 23 26 34 33 0d 20 20 20 | always #&43. | 00002890 20 20 20 20 43 41 4c 4c 20 26 46 46 46 34 0d 20 | CALL &FFF4. | 000028a0 20 20 20 20 20 20 45 4e 44 50 52 4f 43 0d 0d 0d | ENDPROC...| 000028b0 41 6c 74 68 6f 75 67 68 20 69 74 20 69 73 20 75 |Although it is u| 000028c0 6e 6c 69 6b 65 6c 79 20 74 68 61 74 20 79 6f 75 |nlikely that you| 000028d0 20 77 6f 75 6c 64 20 65 76 65 72 20 77 61 6e 74 | would ever want| 000028e0 20 74 6f 20 6c 6f 61 64 20 74 68 65 20 63 6f 6e | to load the con| 000028f0 74 65 6e 74 73 20 6f 66 0d 74 68 65 20 77 6f 72 |tents of.the wor| 00002900 64 20 50 48 52 4f 4d 20 61 64 64 72 65 73 73 20 |d PHROM address | 00002910 72 65 67 69 73 74 65 72 20 77 69 74 68 20 61 20 |register with a | 00002920 73 70 65 63 69 66 69 63 20 31 34 20 62 69 74 20 |specific 14 bit | 00002930 61 64 64 72 65 73 73 20 61 6e 64 20 74 68 65 6e |address and then| 00002940 20 64 6f 0d 6e 6f 74 68 69 6e 67 20 77 69 74 68 | do.nothing with| 00002950 20 74 68 65 20 73 70 65 65 63 68 20 70 72 6f 63 | the speech proc| 00002960 65 73 73 6f 72 20 61 66 74 65 72 77 61 72 64 73 |essor afterwards| 00002970 2c 20 69 74 20 69 73 20 61 6c 77 61 79 73 20 70 |, it is always p| 00002980 6f 73 73 69 62 6c 65 20 74 6f 20 64 6f 0d 73 75 |ossible to do.su| 00002990 63 68 20 74 68 69 6e 67 73 20 62 79 20 61 63 63 |ch things by acc| 000029a0 69 64 65 6e 74 20 72 61 74 68 65 72 20 74 68 61 |ident rather tha| 000029b0 6e 20 64 65 73 69 67 6e 2e 20 49 66 20 79 6f 75 |n design. If you| 000029c0 20 64 6f 20 74 68 69 73 20 61 6e 64 20 66 6f 6c | do this and fol| 000029d0 6c 6f 77 20 61 0d 4c 6f 61 64 20 41 64 64 72 65 |low a.Load Addre| 000029e0 73 73 20 63 6f 6d 6d 61 6e 64 20 77 69 74 68 20 |ss command with | 000029f0 61 6e 6f 74 68 65 72 20 4c 6f 61 64 20 41 64 64 |another Load Add| 00002a00 72 65 73 73 20 63 6f 6d 6d 61 6e 64 2c 20 74 68 |ress command, th| 00002a10 65 20 73 65 63 6f 6e 64 20 61 64 64 72 65 73 73 |e second address| 00002a20 0d 77 69 6c 6c 20 6e 6f 74 20 62 65 20 6c 6f 61 |.will not be loa| 00002a30 64 65 64 20 69 6e 74 6f 20 74 68 65 20 61 64 64 |ded into the add| 00002a40 72 65 73 73 20 72 65 67 69 73 74 65 72 20 61 73 |ress register as| 00002a50 20 72 65 71 75 69 72 65 64 2e 20 4c 6f 61 64 69 | required. Loadi| 00002a60 6e 67 20 74 68 65 0d 61 64 64 72 65 73 73 20 72 |ng the.address r| 00002a70 65 67 69 73 74 65 72 20 6d 75 73 74 20 61 6c 77 |egister must alw| 00002a80 61 79 73 20 62 65 20 66 6f 6c 6c 6f 77 65 64 20 |ays be followed | 00002a90 62 79 20 65 69 74 68 65 72 20 61 20 52 65 61 64 |by either a Read| 00002aa0 20 42 79 74 65 2c 20 52 65 61 64 20 61 6e 64 0d | Byte, Read and.| 00002ab0 42 72 61 6e 63 68 2c 20 53 70 65 61 6b 20 6f 72 |Branch, Speak or| 00002ac0 20 52 65 73 65 74 20 63 6f 6d 6d 61 6e 64 2e 20 | Reset command. | 00002ad0 41 20 4c 6f 61 64 20 41 64 64 72 65 73 73 20 63 |A Load Address c| 00002ae0 6f 6d 6d 61 6e 64 20 73 68 6f 75 6c 64 20 6e 6f |ommand should no| 00002af0 74 20 62 65 0d 66 6f 6c 6c 6f 77 65 64 20 62 79 |t be.followed by| 00002b00 20 65 69 74 68 65 72 20 61 6e 20 4e 4f 50 2c 20 | either an NOP, | 00002b10 61 20 53 70 65 61 6b 20 45 78 74 65 72 6e 61 6c |a Speak External| 00002b20 20 6f 72 20 61 6e 6f 74 68 65 72 20 4c 6f 61 64 | or another Load| 00002b30 20 41 64 64 72 65 73 73 0d 63 6f 6d 6d 61 6e 64 | Address.command| 00002b40 2e 20 54 68 65 72 65 20 69 73 20 6e 6f 20 72 65 |. There is no re| 00002b50 61 73 6f 6e 20 77 68 79 20 61 20 4c 6f 61 64 20 |ason why a Load | 00002b60 41 64 64 72 65 73 73 20 63 6f 6d 6d 61 6e 64 20 |Address command | 00002b70 73 68 6f 75 6c 64 20 62 65 20 66 6f 6c 6c 6f 77 |should be follow| 00002b80 65 64 0d 62 79 20 61 6e 79 20 6f 66 20 74 68 65 |ed.by any of the| 00002b90 73 65 20 63 6f 6d 6d 61 6e 64 73 20 61 6e 64 20 |se commands and | 00002ba0 74 68 69 73 20 6d 69 73 74 61 6b 65 20 73 68 6f |this mistake sho| 00002bb0 75 6c 64 20 62 65 20 61 76 6f 69 64 65 64 20 69 |uld be avoided i| 00002bc0 6e 20 61 6c 6c 20 79 6f 75 72 0d 70 72 6f 67 72 |n all your.progr| 00002bd0 61 6d 73 2e 0d 0d 54 68 65 20 65 66 66 65 63 74 |ams...The effect| 00002be0 20 6f 66 20 74 68 69 73 20 70 72 6f 67 72 61 6d | of this program| 00002bf0 6d 69 6e 67 20 65 72 72 6f 72 20 69 73 20 64 65 |ming error is de| 00002c00 6d 6f 6e 73 74 72 61 74 65 64 20 69 6e 20 74 68 |monstrated in th| 00002c10 65 20 70 72 6f 67 72 61 6d 0d 42 45 57 41 52 45 |e program.BEWARE| 00002c20 2e 20 49 66 20 79 6f 75 20 6c 6f 61 64 20 61 6e |. If you load an| 00002c30 64 20 72 75 6e 20 74 68 69 73 20 70 72 6f 67 72 |d run this progr| 00002c40 61 6d 20 69 74 20 77 69 6c 6c 20 72 65 73 70 6f |am it will respo| 00002c50 6e 64 20 62 79 20 70 72 69 6e 74 69 6e 67 20 74 |nd by printing t| 00002c60 68 65 0d 63 6f 6e 74 65 6e 74 73 20 6f 66 20 6d |he.contents of m| 00002c70 65 6d 6f 72 79 20 6c 6f 63 61 74 69 6f 6e 20 26 |emory location &| 00002c80 30 32 37 32 20 69 6e 20 77 6f 72 64 20 50 48 52 |0272 in word PHR| 00002c90 4f 4d 20 41 20 61 66 74 65 72 20 6f 6e 65 20 73 |OM A after one s| 00002ca0 65 74 20 6f 66 20 66 69 76 65 0d 4c 6f 61 64 20 |et of five.Load | 00002cb0 41 64 64 72 65 73 73 20 63 6f 6d 6d 61 6e 64 73 |Address commands| 00002cc0 20 61 6e 64 20 61 67 61 69 6e 20 61 66 74 65 72 | and again after| 00002cd0 20 61 6e 6f 74 68 65 72 20 74 77 6f 20 73 65 74 | another two set| 00002ce0 73 20 6f 66 20 66 69 76 65 20 4c 6f 61 64 0d 41 |s of five Load.A| 00002cf0 64 64 72 65 73 73 20 63 6f 6d 6d 61 6e 64 73 2e |ddress commands.| 00002d00 20 42 65 63 61 75 73 65 20 74 68 65 20 73 65 63 | Because the sec| 00002d10 6f 6e 64 20 73 65 74 20 6f 66 20 66 69 76 65 20 |ond set of five | 00002d20 4c 6f 61 64 20 41 64 64 72 65 73 73 20 63 6f 6d |Load Address com| 00002d30 6d 61 6e 64 73 20 68 61 73 0d 62 65 65 6e 20 66 |mands has.been f| 00002d40 6f 6c 6c 6f 77 65 64 20 62 79 20 61 20 52 65 73 |ollowed by a Res| 00002d50 65 74 20 63 6f 6d 6d 61 6e 64 20 74 68 65 20 74 |et command the t| 00002d60 77 6f 20 62 79 74 65 73 20 61 72 65 20 69 64 65 |wo bytes are ide| 00002d70 6e 74 69 63 61 6c 2e 20 45 69 74 68 65 72 0d 64 |ntical. Either.d| 00002d80 65 6c 65 74 65 20 6c 69 6e 65 73 20 33 35 30 20 |elete lines 350 | 00002d90 74 6f 20 33 37 30 20 6f 72 20 61 6c 74 65 72 20 |to 370 or alter | 00002da0 6c 69 6e 65 20 33 35 30 20 74 6f 20 4c 44 41 20 |line 350 to LDA | 00002db0 23 30 20 61 6e 64 20 72 75 6e 20 74 68 65 20 70 |#0 and run the p| 00002dc0 72 6f 67 72 61 6d 0d 61 67 61 69 6e 2e 20 59 6f |rogram.again. Yo| 00002dd0 75 20 77 69 6c 6c 20 74 68 65 6e 20 73 65 65 20 |u will then see | 00002de0 74 68 61 74 20 74 68 65 20 73 65 63 6f 6e 64 20 |that the second | 00002df0 62 79 74 65 20 69 73 20 6e 6f 74 20 74 68 65 20 |byte is not the | 00002e00 73 61 6d 65 20 61 73 20 74 68 65 20 66 69 72 73 |same as the firs| 00002e10 74 0d 69 6e 64 69 63 61 74 69 6e 67 20 74 68 65 |t.indicating the| 00002e20 20 65 72 72 6f 72 20 64 65 73 63 72 69 62 65 64 | error described| 00002e30 20 61 62 6f 76 65 2e 20 55 73 69 6e 67 20 74 68 | above. Using th| 00002e40 65 20 4c 6f 61 64 20 41 64 64 72 65 73 73 20 63 |e Load Address c| 00002e50 6f 6d 6d 61 6e 64 20 69 73 20 61 0d 75 73 65 66 |ommand is a.usef| 00002e60 75 6c 20 61 6e 64 20 76 65 72 79 20 69 6d 70 6f |ul and very impo| 00002e70 72 74 61 6e 74 20 70 61 72 74 20 6f 66 20 70 72 |rtant part of pr| 00002e80 6f 67 72 61 6d 6d 69 6e 67 20 74 68 65 20 73 70 |ogramming the sp| 00002e90 65 65 63 68 20 70 72 6f 63 65 73 73 6f 72 20 61 |eech processor a| 00002ea0 6e 64 20 79 6f 75 0d 6d 75 73 74 20 62 65 20 61 |nd you.must be a| 00002eb0 77 61 72 65 20 6f 66 20 74 68 69 73 20 70 6f 74 |ware of this pot| 00002ec0 65 6e 74 69 61 6c 20 65 72 72 6f 72 20 61 6e 64 |ential error and| 00002ed0 20 64 65 73 69 67 6e 20 79 6f 75 72 20 70 72 6f | design your pro| 00002ee0 67 72 61 6d 73 20 73 6f 20 74 68 61 74 20 69 74 |grams so that it| 00002ef0 0d 6e 65 76 65 72 20 6f 63 63 75 72 73 2e 0d 0d |.never occurs...| 00002f00 0d 20 20 20 31 30 20 52 45 4d 3a 20 42 45 57 41 |. 10 REM: BEWA| 00002f10 52 45 0d 20 20 20 32 30 20 52 45 4d 3a 20 57 72 |RE. 20 REM: Wr| 00002f20 69 74 69 6e 67 20 74 6f 20 74 68 65 20 77 6f 72 |iting to the wor| 00002f30 64 20 50 48 52 4f 4d 20 61 64 64 72 65 73 73 20 |d PHROM address | 00002f40 72 65 67 69 73 74 65 72 0d 20 20 20 33 30 20 52 |register. 30 R| 00002f50 45 4d 3a 20 6d 75 73 74 20 62 65 20 66 6f 6c 6c |EM: must be foll| 00002f60 6f 77 65 64 20 62 79 20 61 20 77 72 69 74 65 20 |owed by a write | 00002f70 74 6f 20 73 70 65 65 63 68 0d 20 20 20 34 30 20 |to speech. 40 | 00002f80 52 45 4d 3a 20 70 72 6f 63 65 73 73 6f 72 20 63 |REM: processor c| 00002f90 6f 6d 6d 61 6e 64 20 28 6f 73 62 79 74 65 20 26 |ommand (osbyte &| 00002fa0 39 46 20 77 69 74 68 0d 20 20 20 35 30 20 52 45 |9F with. 50 RE| 00002fb0 4d 3a 20 59 20 3d 20 65 69 74 68 65 72 20 26 31 |M: Y = either &1| 00002fc0 30 2c 20 26 33 30 2c 20 26 35 30 20 6f 72 20 26 |0, &30, &50 or &| 00002fd0 37 30 29 20 62 65 66 6f 72 65 0d 20 20 20 36 30 |70) before. 60| 00002fe0 20 52 45 4d 3a 20 77 72 69 74 69 6e 67 20 74 6f | REM: writing to| 00002ff0 20 74 68 65 20 61 64 64 72 65 73 73 20 72 65 67 | the address reg| 00003000 69 73 74 65 72 20 61 67 61 69 6e 2e 0d 20 20 20 |ister again.. | 00003010 37 30 20 52 45 4d 3a 20 4f 74 68 65 72 77 69 73 |70 REM: Otherwis| 00003020 65 20 74 68 65 20 73 65 63 6f 6e 64 20 4c 6f 61 |e the second Loa| 00003030 64 20 41 64 64 72 65 73 73 20 72 65 73 75 6c 74 |d Address result| 00003040 73 20 69 6e 0d 20 20 20 38 30 20 52 45 4d 3a 20 |s in. 80 REM: | 00003050 61 6e 20 65 72 72 6f 72 20 69 6e 20 74 68 65 20 |an error in the | 00003060 61 64 64 72 65 73 73 20 72 65 67 69 73 74 65 72 |address register| 00003070 2e 0d 20 20 20 39 30 20 6f 73 6e 65 77 6c 3d 26 |.. 90 osnewl=&| 00003080 46 46 45 37 0d 20 20 31 30 30 20 6f 73 77 72 63 |FFE7. 100 oswrc| 00003090 68 3d 26 46 46 45 45 0d 20 20 31 31 30 20 6f 73 |h=&FFEE. 110 os| 000030a0 62 79 74 65 3d 26 46 46 46 34 0d 20 20 31 32 30 |byte=&FFF4. 120| 000030b0 20 44 49 4d 20 6d 63 6f 64 65 20 26 31 30 30 0d | DIM mcode &100.| 000030c0 20 20 31 33 30 20 46 4f 52 70 61 73 73 3d 30 54 | 130 FORpass=0T| 000030d0 4f 32 53 54 45 50 32 0d 20 20 31 34 30 20 50 25 |O2STEP2. 140 P%| 000030e0 3d 6d 63 6f 64 65 0d 20 20 31 35 30 20 5b 20 20 |=mcode. 150 [ | 000030f0 20 20 20 20 20 4f 50 54 20 70 61 73 73 0d 20 20 | OPT pass. | 00003100 31 36 30 20 20 20 20 20 20 20 20 20 4c 44 41 20 |160 LDA | 00003110 23 26 45 42 0d 20 20 31 37 30 20 20 20 20 20 20 |#&EB. 170 | 00003120 20 20 20 4c 44 58 20 23 30 0d 20 20 31 38 30 20 | LDX #0. 180 | 00003130 20 20 20 20 20 20 20 20 4c 44 59 20 23 26 46 46 | LDY #&FF| 00003140 0d 20 20 31 39 30 20 20 20 20 20 20 20 20 20 4a |. 190 J| 00003150 53 52 20 6f 73 62 79 74 65 20 20 20 20 5c 20 63 |SR osbyte \ c| 00003160 68 65 63 6b 20 66 6f 72 20 41 63 6f 72 6e 20 53 |heck for Acorn S| 00003170 70 65 65 63 68 20 75 70 67 72 61 64 65 0d 20 20 |peech upgrade. | 00003180 32 30 30 20 20 20 20 20 20 20 20 20 43 50 58 20 |200 CPX | 00003190 23 26 46 46 0d 20 20 32 31 30 20 20 20 20 20 20 |#&FF. 210 | 000031a0 20 20 20 42 45 51 20 73 74 61 72 74 0d 20 20 32 | BEQ start. 2| 000031b0 32 30 20 20 20 20 20 20 20 20 20 42 52 4b 0d 20 |20 BRK. | 000031c0 20 32 33 30 20 20 20 20 20 20 20 20 20 42 52 4b | 230 BRK| 000031d0 0d 20 20 32 34 30 20 20 20 20 20 20 20 20 20 45 |. 240 E| 000031e0 51 55 53 20 22 4e 6f 20 53 70 65 65 63 68 20 75 |QUS "No Speech u| 000031f0 70 67 72 61 64 65 22 0d 20 20 32 35 30 20 20 20 |pgrade". 250 | 00003200 20 20 20 20 20 20 42 52 4b 0d 20 20 32 36 30 20 | BRK. 260 | 00003210 2e 73 74 61 72 74 0d 20 20 32 37 30 20 20 20 20 |.start. 270 | 00003220 20 20 20 20 20 4a 53 52 20 61 64 64 72 65 73 73 | JSR address| 00003230 20 20 20 5c 20 28 54 4f 4e 45 31 29 20 64 61 74 | \ (TONE1) dat| 00003240 61 20 61 64 64 72 65 73 73 0d 20 20 32 38 30 20 |a address. 280 | 00003250 20 20 20 20 20 20 20 20 4a 53 52 20 72 65 61 64 | JSR read| 00003260 20 20 20 20 20 20 5c 20 72 65 61 64 20 74 68 65 | \ read the| 00003270 20 62 79 74 65 0d 20 20 32 39 30 20 20 20 20 20 | byte. 290 | 00003280 20 20 20 20 4a 53 52 20 70 72 69 6e 74 68 65 78 | JSR printhex| 00003290 20 20 5c 20 73 68 6f 75 6c 64 20 62 65 20 26 42 | \ should be &B| 000032a0 31 0d 20 20 33 30 30 20 20 20 20 20 20 20 20 20 |1. 300 | 000032b0 4a 53 52 20 61 64 64 72 65 73 73 20 20 20 5c 20 |JSR address \ | 000032c0 28 54 4f 4e 45 31 29 20 64 61 74 61 20 61 64 64 |(TONE1) data add| 000032d0 72 65 73 73 0d 20 20 33 31 30 20 20 20 20 20 20 |ress. 310 | 000032e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000032f0 20 5c 0d 20 20 33 32 30 20 20 20 20 20 20 20 20 | \. 320 | 00003300 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c | \| 00003310 20 75 73 65 20 4c 44 59 20 23 30 20 69 6e 20 6c | use LDY #0 in l| 00003320 69 6e 65 20 33 35 30 20 74 6f 20 67 65 6e 65 72 |ine 350 to gener| 00003330 61 74 65 20 61 6e 20 65 72 72 6f 72 0d 20 20 33 |ate an error. 3| 00003340 33 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |30 | 00003350 20 20 20 20 20 20 20 20 20 5c 20 6f 72 20 6a 75 | \ or ju| 00003360 73 74 20 64 65 6c 65 74 65 20 6c 69 6e 65 73 20 |st delete lines | 00003370 33 35 30 2c 20 33 36 30 20 61 6e 64 20 33 37 30 |350, 360 and 370| 00003380 0d 20 20 33 34 30 20 20 20 20 20 20 20 20 20 20 |. 340 | 00003390 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 26 | \ &| 000033a0 31 30 2c 26 33 30 2c 26 35 30 2c 26 37 30 20 77 |10,&30,&50,&70 w| 000033b0 6f 72 6b 20 26 30 2c 26 32 30 2c 26 34 6e 2c 26 |ork &0,&20,&4n,&| 000033c0 36 30 20 64 6f 6e 27 74 0d 20 20 33 35 30 20 20 |60 don't. 350 | 000033d0 20 20 20 20 20 20 20 4c 44 59 20 23 26 37 30 20 | LDY #&70 | 000033e0 20 20 20 20 20 5c 20 72 65 73 65 74 20 63 6f 6d | \ reset com| 000033f0 6d 61 6e 64 0d 20 20 33 36 30 20 20 20 20 20 20 |mand. 360 | 00003400 20 20 20 4c 44 41 20 23 26 39 46 20 20 20 20 20 | LDA #&9F | 00003410 20 5c 20 77 72 69 74 65 20 74 6f 20 73 70 65 65 | \ write to spee| 00003420 63 68 20 70 72 6f 63 65 73 73 6f 72 0d 20 20 33 |ch processor. 3| 00003430 37 30 20 20 20 20 20 20 20 20 20 4a 53 52 20 6f |70 JSR o| 00003440 73 62 79 74 65 0d 20 20 33 38 30 20 20 20 20 20 |sbyte. 380 | 00003450 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00003460 20 20 5c 0d 20 20 33 39 30 20 20 20 20 20 20 20 | \. 390 | 00003470 20 20 4a 53 52 20 61 64 64 72 65 73 73 20 20 20 | JSR address | 00003480 5c 20 28 54 4f 4e 45 31 29 20 64 61 74 61 20 61 |\ (TONE1) data a| 00003490 64 64 72 65 73 73 0d 20 20 34 30 30 20 20 20 20 |ddress. 400 | 000034a0 20 20 20 20 20 4a 53 52 20 72 65 61 64 20 20 20 | JSR read | 000034b0 20 20 20 5c 20 72 65 61 64 20 74 68 65 20 62 79 | \ read the by| 000034c0 74 65 0d 20 20 34 31 30 20 20 20 20 20 20 20 20 |te. 410 | 000034d0 20 4a 53 52 20 70 72 69 6e 74 68 65 78 20 20 5c | JSR printhex \| 000034e0 20 73 68 6f 75 6c 64 20 62 65 20 26 42 31 0d 20 | should be &B1. | 000034f0 20 34 32 30 20 20 20 20 20 20 20 20 20 4a 53 52 | 420 JSR| 00003500 20 6f 73 6e 65 77 6c 0d 20 20 34 33 30 20 20 20 | osnewl. 430 | 00003510 20 20 20 20 20 20 52 54 53 20 20 20 20 20 20 20 | RTS | 00003520 20 20 20 20 5c 20 72 65 74 75 72 6e 20 74 6f 20 | \ return to | 00003530 42 41 53 49 43 0d 20 20 34 34 30 20 2e 61 64 64 |BASIC. 440 .add| 00003540 72 65 73 73 0d 20 20 34 35 30 20 20 20 20 20 20 |ress. 450 | 00003550 20 20 20 4c 44 41 20 23 26 39 46 20 20 20 20 20 | LDA #&9F | 00003560 20 5c 20 77 72 69 74 65 20 74 6f 20 73 70 65 65 | \ write to spee| 00003570 63 68 20 70 72 6f 63 65 73 73 6f 72 0d 20 20 34 |ch processor. 4| 00003580 36 30 20 20 20 20 20 20 20 20 20 4c 44 59 20 23 |60 LDY #| 00003590 26 34 32 20 20 20 20 20 20 5c 20 61 64 64 72 65 |&42 \ addre| 000035a0 73 73 20 26 30 32 37 32 0d 20 20 34 37 30 20 20 |ss &0272. 470 | 000035b0 20 20 20 20 20 20 20 4a 53 52 20 6f 73 62 79 74 | JSR osbyt| 000035c0 65 0d 20 20 34 38 30 20 20 20 20 20 20 20 20 20 |e. 480 | 000035d0 4c 44 59 20 23 26 34 37 0d 20 20 34 39 30 20 20 |LDY #&47. 490 | 000035e0 20 20 20 20 20 20 20 4a 53 52 20 6f 73 62 79 74 | JSR osbyt| 000035f0 65 0d 20 20 35 30 30 20 20 20 20 20 20 20 20 20 |e. 500 | 00003600 4c 44 59 20 23 26 34 32 0d 20 20 35 31 30 20 20 |LDY #&42. 510 | 00003610 20 20 20 20 20 20 20 4a 53 52 20 6f 73 62 79 74 | JSR osbyt| 00003620 65 0d 20 20 35 32 30 20 20 20 20 20 20 20 20 20 |e. 520 | 00003630 4c 44 59 20 23 26 34 43 0d 20 20 35 33 30 20 20 |LDY #&4C. 530 | 00003640 20 20 20 20 20 20 20 4a 53 52 20 6f 73 62 79 74 | JSR osbyt| 00003650 65 0d 20 20 35 34 30 20 20 20 20 20 20 20 20 20 |e. 540 | 00003660 4c 44 59 20 23 26 34 33 0d 20 20 35 35 30 20 20 |LDY #&43. 550 | 00003670 20 20 20 20 20 20 20 4a 4d 50 20 6f 73 62 79 74 | JMP osbyt| 00003680 65 20 20 20 20 5c 20 6f 73 62 79 74 65 20 61 6e |e \ osbyte an| 00003690 64 20 72 65 74 75 72 6e 0d 20 20 35 36 30 20 2e |d return. 560 .| 000036a0 72 65 61 64 0d 20 20 35 37 30 20 20 20 20 20 20 |read. 570 | 000036b0 20 20 20 4c 44 41 20 23 26 39 46 20 20 20 20 20 | LDA #&9F | 000036c0 20 5c 20 77 72 69 74 65 20 74 6f 20 73 70 65 65 | \ write to spee| 000036d0 63 68 20 70 72 6f 63 65 73 73 6f 72 0d 20 20 35 |ch processor. 5| 000036e0 38 30 20 20 20 20 20 20 20 20 20 4c 44 59 20 23 |80 LDY #| 000036f0 26 31 30 20 20 20 20 20 20 5c 20 72 65 61 64 20 |&10 \ read | 00003700 62 79 74 65 20 63 6f 6d 6d 61 6e 64 0d 20 20 35 |byte command. 5| 00003710 39 30 20 20 20 20 20 20 20 20 20 4a 53 52 20 6f |90 JSR o| 00003720 73 62 79 74 65 20 20 20 20 5c 20 73 65 6e 64 20 |sbyte \ send | 00003730 72 65 61 64 20 62 79 74 65 20 63 6f 6d 6d 61 6e |read byte comman| 00003740 64 0d 20 20 36 30 30 20 20 20 20 20 20 20 20 20 |d. 600 | 00003750 4c 44 41 20 23 26 39 45 20 20 20 20 20 20 5c 20 |LDA #&9E \ | 00003760 72 65 61 64 20 66 72 6f 6d 20 73 70 65 65 63 68 |read from speech| 00003770 20 70 72 6f 63 65 73 73 6f 72 0d 20 20 36 31 30 | processor. 610| 00003780 20 20 20 20 20 20 20 20 20 4a 53 52 20 6f 73 62 | JSR osb| 00003790 79 74 65 20 20 20 20 5c 20 72 65 61 64 20 6e 65 |yte \ read ne| 000037a0 78 74 20 62 79 74 65 20 66 72 6f 6d 20 50 48 52 |xt byte from PHR| 000037b0 4f 4d 0d 20 20 36 32 30 20 20 20 20 20 20 20 20 |OM. 620 | 000037c0 20 54 59 41 20 20 20 20 20 20 20 20 20 20 20 5c | TYA \| 000037d0 20 72 65 73 75 6c 74 20 69 6e 20 61 63 63 75 6d | result in accum| 000037e0 75 6c 61 74 6f 72 0d 20 20 36 33 30 20 20 20 20 |ulator. 630 | 000037f0 20 20 20 20 20 52 54 53 0d 20 20 36 34 30 20 2e | RTS. 640 .| 00003800 70 72 69 6e 74 68 65 78 0d 20 20 36 35 30 20 20 |printhex. 650 | 00003810 20 20 20 20 20 20 20 50 48 41 0d 20 20 36 36 30 | PHA. 660| 00003820 20 20 20 20 20 20 20 20 20 4c 53 52 20 41 0d 20 | LSR A. | 00003830 20 36 37 30 20 20 20 20 20 20 20 20 20 4c 53 52 | 670 LSR| 00003840 20 41 0d 20 20 36 38 30 20 20 20 20 20 20 20 20 | A. 680 | 00003850 20 4c 53 52 20 41 0d 20 20 36 39 30 20 20 20 20 | LSR A. 690 | 00003860 20 20 20 20 20 4c 53 52 20 41 0d 20 20 37 30 30 | LSR A. 700| 00003870 20 20 20 20 20 20 20 20 20 4a 53 52 20 6e 79 62 | JSR nyb| 00003880 62 6c 65 0d 20 20 37 31 30 20 20 20 20 20 20 20 |ble. 710 | 00003890 20 20 50 4c 41 0d 20 20 37 32 30 20 2e 6e 79 62 | PLA. 720 .nyb| 000038a0 62 6c 65 0d 20 20 37 33 30 20 20 20 20 20 20 20 |ble. 730 | 000038b0 20 20 41 4e 44 20 23 26 46 0d 20 20 37 34 30 20 | AND #&F. 740 | 000038c0 20 20 20 20 20 20 20 20 53 45 44 0d 20 20 37 35 | SED. 75| 000038d0 30 20 20 20 20 20 20 20 20 20 43 4c 43 0d 20 20 |0 CLC. | 000038e0 37 36 30 20 20 20 20 20 20 20 20 20 41 44 43 20 |760 ADC | 000038f0 23 26 39 30 0d 20 20 37 37 30 20 20 20 20 20 20 |#&90. 770 | 00003900 20 20 20 41 44 43 20 23 26 34 30 0d 20 20 37 38 | ADC #&40. 78| 00003910 30 20 20 20 20 20 20 20 20 20 43 4c 44 0d 20 20 |0 CLD. | 00003920 37 39 30 20 20 20 20 20 20 20 20 20 4a 4d 50 20 |790 JMP | 00003930 6f 73 77 72 63 68 0d 20 20 38 30 30 20 5d 0d 20 |oswrch. 800 ]. | 00003940 20 38 31 30 20 4e 45 58 54 0d 20 20 38 32 30 20 | 810 NEXT. 820 | 00003950 43 41 4c 4c 20 6d 63 6f 64 65 0d 0d 0d 2d 2d 2d |CALL mcode...---| 00003960 2d 2d 0d 53 70 65 61 6b 0d 2d 2d 2d 2d 2d 0d 0d |--.Speak.-----..| 00003970 4f 73 62 79 74 65 20 26 39 46 20 77 69 74 68 20 |Osbyte &9F with | 00003980 59 20 3d 20 26 35 30 0d 2a 46 58 20 31 35 39 2c |Y = &50.*FX 159,| 00003990 30 2c 38 30 0d 0d 54 68 65 20 53 70 65 61 6b 20 |0,80..The Speak | 000039a0 63 6f 6d 6d 61 6e 64 20 69 73 20 75 73 65 64 20 |command is used | 000039b0 74 6f 20 67 65 6e 65 72 61 74 65 20 73 70 65 65 |to generate spee| 000039c0 63 68 20 75 73 69 6e 67 20 74 68 65 20 73 70 65 |ch using the spe| 000039d0 65 63 68 20 64 61 74 61 20 73 74 6f 72 65 64 0d |ech data stored.| 000039e0 69 6e 20 61 20 77 6f 72 64 20 50 48 52 4f 4d 2e |in a word PHROM.| 000039f0 20 54 68 65 20 77 6f 72 64 20 50 48 52 4f 4d 20 | The word PHROM | 00003a00 61 64 64 72 65 73 73 20 72 65 67 69 73 74 65 72 |address register| 00003a10 20 6d 75 73 74 20 62 65 20 6c 6f 61 64 65 64 20 | must be loaded | 00003a20 77 69 74 68 20 74 68 65 0d 66 69 72 73 74 20 62 |with the.first b| 00003a30 79 74 65 20 6f 66 20 74 68 65 20 73 70 65 65 63 |yte of the speec| 00003a40 68 20 64 61 74 61 20 61 6e 64 20 73 70 65 65 63 |h data and speec| 00003a50 68 20 77 69 6c 6c 20 63 6f 6e 74 69 6e 75 65 20 |h will continue | 00003a60 75 6e 74 69 6c 20 61 20 73 74 6f 70 20 63 6f 64 |until a stop cod| 00003a70 65 0d 28 25 31 31 31 31 29 20 69 73 20 72 65 61 |e.(%1111) is rea| 00003a80 64 20 66 72 6f 6d 20 74 68 65 20 77 6f 72 64 20 |d from the word | 00003a90 50 48 52 4f 4d 2e 20 54 68 65 20 53 70 65 61 6b |PHROM. The Speak| 00003aa0 20 63 6f 6d 6d 61 6e 64 20 63 61 6e 20 62 65 20 | command can be | 00003ab0 68 61 6c 74 65 64 20 62 79 20 61 0d 52 65 73 65 |halted by a.Rese| 00003ac0 74 20 63 6f 6d 6d 61 6e 64 20 28 4f 73 62 79 74 |t command (Osbyt| 00003ad0 65 20 26 39 46 20 77 69 74 68 20 59 20 3d 20 26 |e &9F with Y = &| 00003ae0 37 30 20 6f 72 20 2a 46 58 20 31 35 39 2c 30 2c |70 or *FX 159,0,| 00003af0 31 31 32 29 2e 20 54 68 65 20 53 70 65 61 6b 20 |112). The Speak | 00003b00 61 6e 64 0d 52 65 73 65 74 20 63 6f 6d 6d 61 6e |and.Reset comman| 00003b10 64 73 20 77 69 6c 6c 20 62 65 20 75 73 65 64 20 |ds will be used | 00003b20 69 6e 20 6d 6f 64 75 6c 65 20 36 20 74 6f 20 70 |in module 6 to p| 00003b30 72 6f 64 75 63 65 20 61 6e 20 61 6c 6d 6f 73 74 |roduce an almost| 00003b40 20 75 6e 6c 69 6d 69 74 65 64 0d 76 6f 63 61 62 | unlimited.vocab| 00003b50 75 6c 61 72 79 20 66 72 6f 6d 20 77 6f 72 64 20 |ulary from word | 00003b60 50 48 52 4f 4d 20 41 2e 0d 0d 54 68 65 20 65 78 |PHROM A...The ex| 00003b70 61 6d 70 6c 65 20 70 72 6f 67 72 61 6d 20 50 45 |ample program PE| 00003b80 4e 43 45 20 64 65 6d 6f 6e 73 74 72 61 74 65 73 |NCE demonstrates| 00003b90 20 68 6f 77 20 74 68 65 20 53 70 65 61 6b 20 63 | how the Speak c| 00003ba0 6f 6d 6d 61 6e 64 20 73 68 6f 75 6c 64 20 62 65 |ommand should be| 00003bb0 0d 75 73 65 64 20 69 6e 20 41 73 73 65 6d 62 6c |.used in Assembl| 00003bc0 79 20 6c 61 6e 67 75 61 67 65 20 70 72 6f 67 72 |y language progr| 00003bd0 61 6d 73 2e 20 54 68 65 20 61 64 64 72 65 73 73 |ams. The address| 00003be0 20 72 65 67 69 73 74 65 72 20 69 73 20 66 69 72 | register is fir| 00003bf0 73 74 20 6c 6f 61 64 65 64 0d 77 69 74 68 20 74 |st loaded.with t| 00003c00 68 65 20 61 64 64 72 65 73 73 20 6f 66 20 74 68 |he address of th| 00003c10 65 20 73 74 61 72 74 20 6f 66 20 74 68 65 20 73 |e start of the s| 00003c20 70 65 65 63 68 20 64 61 74 61 20 66 6f 72 20 74 |peech data for t| 00003c30 68 65 20 77 6f 72 64 20 50 45 4e 43 45 20 61 6e |he word PENCE an| 00003c40 64 0d 74 68 65 6e 20 74 68 65 20 53 70 65 61 6b |d.then the Speak| 00003c50 20 63 6f 6d 6d 61 6e 64 20 69 73 20 65 78 65 63 | command is exec| 00003c60 75 74 65 64 2e 20 54 68 65 20 73 70 65 65 63 68 |uted. The speech| 00003c70 20 64 61 74 61 20 66 6f 72 20 74 68 65 20 77 6f | data for the wo| 00003c80 72 64 20 50 45 4e 43 45 0d 73 74 61 72 74 73 20 |rd PENCE.starts | 00003c90 61 74 20 26 32 42 35 38 2e 20 54 68 69 73 20 61 |at &2B58. This a| 00003ca0 64 64 72 65 73 73 20 68 61 73 20 62 65 65 6e 20 |ddress has been | 00003cb0 74 72 61 6e 73 66 6f 72 6d 65 64 20 69 6e 74 6f |transformed into| 00003cc0 20 74 68 65 20 66 69 76 65 20 62 79 74 65 73 20 | the five bytes | 00003cd0 26 34 38 0d 26 34 35 20 26 34 42 20 26 34 45 20 |&48.&45 &4B &4E | 00003ce0 61 6e 64 20 26 34 33 20 74 6f 20 62 65 20 75 73 |and &43 to be us| 00003cf0 65 64 20 77 69 74 68 20 74 68 65 20 4c 6f 61 64 |ed with the Load| 00003d00 20 41 64 64 72 65 73 73 20 63 6f 6d 6d 61 6e 64 | Address command| 00003d10 2e 0d 0d 0d 20 20 20 31 30 20 52 45 4d 3a 20 50 |.... 10 REM: P| 00003d20 45 4e 43 45 0d 20 20 20 32 30 20 44 49 4d 20 6d |ENCE. 20 DIM m| 00003d30 63 6f 64 65 20 26 31 30 30 0d 20 20 20 33 30 20 |code &100. 30 | 00003d40 6f 73 62 79 74 65 3d 26 46 46 46 34 0d 20 20 20 |osbyte=&FFF4. | 00003d50 34 30 20 46 4f 52 70 61 73 73 3d 30 54 4f 32 53 |40 FORpass=0TO2S| 00003d60 54 45 50 32 0d 20 20 20 35 30 20 50 25 3d 6d 63 |TEP2. 50 P%=mc| 00003d70 6f 64 65 0d 20 20 20 36 30 20 5b 20 20 20 20 20 |ode. 60 [ | 00003d80 20 20 4f 50 54 20 70 61 73 73 0d 20 20 20 37 30 | OPT pass. 70| 00003d90 20 20 20 20 20 20 20 20 20 4c 44 41 20 23 26 39 | LDA #&9| 00003da0 46 20 20 20 20 20 20 5c 20 77 72 69 74 65 20 74 |F \ write t| 00003db0 6f 20 73 70 65 65 63 68 20 70 72 6f 63 65 73 73 |o speech process| 00003dc0 6f 72 0d 20 20 20 38 30 20 20 20 20 20 20 20 20 |or. 80 | 00003dd0 20 4c 44 59 20 23 26 34 38 20 20 20 20 20 20 5c | LDY #&48 \| 00003de0 20 61 64 64 72 65 73 73 20 26 32 42 35 38 20 22 | address &2B58 "| 00003df0 70 65 6e 63 65 22 0d 20 20 20 39 30 20 20 20 20 |pence". 90 | 00003e00 20 20 20 20 20 4a 53 52 20 6f 73 62 79 74 65 0d | JSR osbyte.| 00003e10 20 20 31 30 30 20 20 20 20 20 20 20 20 20 4c 44 | 100 LD| 00003e20 59 20 23 26 34 35 0d 20 20 31 31 30 20 20 20 20 |Y #&45. 110 | 00003e30 20 20 20 20 20 4a 53 52 20 6f 73 62 79 74 65 0d | JSR osbyte.| 00003e40 20 20 31 32 30 20 20 20 20 20 20 20 20 20 4c 44 | 120 LD| 00003e50 59 20 23 26 34 42 0d 20 20 31 33 30 20 20 20 20 |Y #&4B. 130 | 00003e60 20 20 20 20 20 4a 53 52 20 6f 73 62 79 74 65 0d | JSR osbyte.| 00003e70 20 20 31 34 30 20 20 20 20 20 20 20 20 20 4c 44 | 140 LD| 00003e80 59 20 23 26 34 45 0d 20 20 31 35 30 20 20 20 20 |Y #&4E. 150 | 00003e90 20 20 20 20 20 4a 53 52 20 6f 73 62 79 74 65 0d | JSR osbyte.| 00003ea0 20 20 31 36 30 20 20 20 20 20 20 20 20 20 4c 44 | 160 LD| 00003eb0 59 20 23 26 34 33 0d 20 20 31 37 30 20 20 20 20 |Y #&43. 170 | 00003ec0 20 20 20 20 20 4a 53 52 20 6f 73 62 79 74 65 0d | JSR osbyte.| 00003ed0 20 20 31 38 30 20 20 20 20 20 20 20 20 20 4c 44 | 180 LD| 00003ee0 59 20 23 26 35 30 20 20 20 20 20 20 5c 20 73 70 |Y #&50 \ sp| 00003ef0 65 61 6b 20 63 6f 6d 6d 61 6e 64 0d 20 20 31 39 |eak command. 19| 00003f00 30 20 20 20 20 20 20 20 20 20 4a 4d 50 20 6f 73 |0 JMP os| 00003f10 62 79 74 65 20 20 20 20 5c 20 73 61 79 20 22 70 |byte \ say "p| 00003f20 65 6e 63 65 22 20 61 6e 64 20 72 65 74 75 72 6e |ence" and return| 00003f30 20 74 6f 20 42 41 53 49 43 0d 20 20 32 30 30 20 | to BASIC. 200 | 00003f40 5d 0d 20 20 32 31 30 20 4e 45 58 54 0d 20 20 32 |]. 210 NEXT. 2| 00003f50 32 30 20 43 41 4c 4c 20 6d 63 6f 64 65 0d 0d 0d |20 CALL mcode...| 00003f60 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 53 |--------------.S| 00003f70 70 65 61 6b 20 45 78 74 65 72 6e 61 6c 0d 2d 2d |peak External.--| 00003f80 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0d 4f 73 |------------..Os| 00003f90 62 79 74 65 20 26 39 46 20 77 69 74 68 20 59 20 |byte &9F with Y | 00003fa0 3d 20 26 36 30 0d 0d 54 68 65 20 53 70 65 61 6b |= &60..The Speak| 00003fb0 20 45 78 74 65 72 6e 61 6c 20 63 6f 6d 6d 61 6e | External comman| 00003fc0 64 20 69 73 20 75 73 65 64 20 74 6f 20 61 6c 6c |d is used to all| 00003fd0 6f 77 20 74 68 65 20 43 50 55 20 74 6f 20 73 65 |ow the CPU to se| 00003fe0 6e 64 20 73 70 65 65 63 68 20 64 61 74 61 0d 66 |nd speech data.f| 00003ff0 72 6f 6d 20 52 41 4d 20 74 6f 20 74 68 65 20 73 |rom RAM to the s| 00004000 70 65 65 63 68 20 70 72 6f 63 65 73 73 6f 72 2e |peech processor.| 00004010 20 55 73 69 6e 67 20 4f 73 62 79 74 65 20 26 39 | Using Osbyte &9| 00004020 46 20 77 69 74 68 20 59 20 3d 20 26 36 30 20 66 |F with Y = &60 f| 00004030 6c 75 73 68 65 73 0d 74 68 65 20 31 36 20 62 79 |lushes.the 16 by| 00004040 74 65 20 46 49 46 4f 20 62 75 66 66 65 72 20 61 |te FIFO buffer a| 00004050 6e 64 20 64 61 74 61 20 73 75 62 73 65 71 75 65 |nd data subseque| 00004060 6e 74 6c 79 20 73 65 6e 74 20 74 6f 20 74 68 65 |ntly sent to the| 00004070 20 73 70 65 65 63 68 20 70 72 6f 63 65 73 73 6f | speech processo| 00004080 72 0d 61 72 65 20 70 75 74 20 69 6e 74 6f 20 74 |r.are put into t| 00004090 68 69 73 20 62 75 66 66 65 72 2e 20 57 68 69 6c |his buffer. Whil| 000040a0 65 20 74 68 69 73 20 63 6f 6d 6d 61 6e 64 20 69 |e this command i| 000040b0 73 20 61 63 74 69 76 65 20 61 6c 6c 20 64 61 74 |s active all dat| 000040c0 61 20 73 65 6e 74 20 74 6f 0d 74 68 65 20 73 70 |a sent to.the sp| 000040d0 65 65 63 68 20 70 72 6f 63 65 73 73 6f 72 20 61 |eech processor a| 000040e0 72 65 20 72 6f 75 74 65 64 20 74 6f 20 74 68 65 |re routed to the| 000040f0 20 46 49 46 4f 20 62 75 66 66 65 72 2e 20 54 68 | FIFO buffer. Th| 00004100 65 20 72 65 73 65 74 20 63 6f 6d 6d 61 6e 64 0d |e reset command.| 00004110 28 4f 73 62 79 74 65 20 26 39 46 20 77 69 74 68 |(Osbyte &9F with| 00004120 20 59 20 3d 20 26 37 30 29 20 69 73 20 6e 6f 74 | Y = &70) is not| 00004130 20 72 65 63 6f 67 6e 69 73 65 64 20 77 68 65 6e | recognised when| 00004140 20 53 70 65 61 6b 20 45 78 74 65 72 6e 61 6c 20 | Speak External | 00004150 69 73 20 61 63 74 69 76 65 2e 0d 0d 43 72 65 61 |is active...Crea| 00004160 74 69 6e 67 20 74 68 65 20 73 70 65 65 63 68 20 |ting the speech | 00004170 64 61 74 61 20 77 69 6c 6c 20 62 65 20 63 6f 76 |data will be cov| 00004180 65 72 65 64 20 69 6e 20 73 6f 6d 65 20 64 65 74 |ered in some det| 00004190 61 69 6c 20 69 6e 20 6d 6f 64 75 6c 65 20 35 20 |ail in module 5 | 000041a0 62 75 74 2c 0d 66 6f 72 20 6e 6f 77 2c 20 79 6f |but,.for now, yo| 000041b0 75 20 73 68 6f 75 6c 64 20 6c 6f 6f 6b 20 61 74 |u should look at| 000041c0 20 74 68 65 20 64 65 6d 6f 6e 73 74 72 61 74 69 | the demonstrati| 000041d0 6f 6e 20 70 72 6f 67 72 61 6d 20 43 4c 4f 43 4b |on program CLOCK| 000041e0 20 74 6f 20 73 65 65 20 68 6f 77 20 74 68 65 0d | to see how the.| 000041f0 73 70 65 61 6b 20 65 78 74 65 72 6e 61 6c 20 63 |speak external c| 00004200 6f 6d 6d 61 6e 64 20 63 61 6e 20 62 65 20 75 73 |ommand can be us| 00004210 65 64 2e 20 4e 6f 74 65 20 69 6e 20 70 61 72 74 |ed. Note in part| 00004220 69 63 75 6c 61 72 20 74 68 61 74 20 74 68 65 20 |icular that the | 00004230 70 72 6f 67 72 61 6d 0d 64 6f 65 73 20 6e 6f 74 |program.does not| 00004240 20 72 65 74 75 72 6e 20 75 6e 74 69 6c 20 74 68 | return until th| 00004250 65 20 73 70 65 65 63 68 20 68 61 73 20 68 61 6c |e speech has hal| 00004260 74 65 64 2e 20 54 68 69 73 20 69 73 20 65 73 73 |ted. This is ess| 00004270 65 6e 74 69 61 6c 20 69 66 20 79 6f 75 20 61 72 |ential if you ar| 00004280 65 0d 74 6f 20 61 76 6f 69 64 20 70 72 6f 64 75 |e.to avoid produ| 00004290 63 69 6e 67 20 67 61 72 62 6c 65 64 20 6e 6f 6e |cing garbled non| 000042a0 73 65 6e 63 65 2e 20 54 68 65 20 70 72 6f 67 72 |sence. The progr| 000042b0 61 6d 20 61 6e 64 20 69 74 73 20 64 61 74 61 20 |am and its data | 000042c0 63 61 6e 20 62 65 20 69 6e 0d 6d 61 69 6e 20 6d |can be in.main m| 000042d0 65 6d 6f 72 79 2c 20 61 20 53 65 63 6f 6e 64 20 |emory, a Second | 000042e0 50 72 6f 63 65 73 73 6f 72 20 6f 72 20 72 65 66 |Processor or ref| 000042f0 6f 72 6d 61 74 65 64 20 66 6f 72 20 53 69 64 65 |ormated for Side| 00004300 77 61 79 73 20 52 41 4d 2e 0d 0d 0d 20 20 20 31 |ways RAM.... 1| 00004310 30 20 52 45 4d 3a 20 43 4c 4f 43 4b 0d 20 20 20 |0 REM: CLOCK. | 00004320 32 30 20 44 49 4d 20 6d 63 6f 64 65 20 26 31 30 |20 DIM mcode &10| 00004330 30 0d 20 20 20 33 30 20 6f 73 62 79 74 65 3d 26 |0. 30 osbyte=&| 00004340 46 46 46 34 0d 20 20 20 34 30 20 46 4f 52 70 61 |FFF4. 40 FORpa| 00004350 73 73 3d 30 54 4f 32 53 54 45 50 32 0d 20 20 20 |ss=0TO2STEP2. | 00004360 35 30 20 50 25 3d 6d 63 6f 64 65 0d 20 20 20 36 |50 P%=mcode. 6| 00004370 30 20 5b 20 20 20 20 20 20 20 4f 50 54 20 70 61 |0 [ OPT pa| 00004380 73 73 0d 20 20 20 37 30 20 20 20 20 20 20 20 20 |ss. 70 | 00004390 20 4c 44 41 20 23 26 39 46 20 20 20 20 20 20 5c | LDA #&9F \| 000043a0 20 77 72 69 74 65 20 74 6f 20 73 70 65 65 63 68 | write to speech| 000043b0 20 70 72 6f 63 65 73 73 6f 72 0d 20 20 20 38 30 | processor. 80| 000043c0 20 20 20 20 20 20 20 20 20 4c 44 59 20 23 26 36 | LDY #&6| 000043d0 30 20 20 20 20 20 20 5c 20 73 70 65 61 6b 20 65 |0 \ speak e| 000043e0 78 74 65 72 6e 61 6c 20 63 6f 6d 6d 61 6e 64 0d |xternal command.| 000043f0 20 20 20 39 30 20 20 20 20 20 20 20 20 20 4a 53 | 90 JS| 00004400 52 20 6f 73 62 79 74 65 0d 20 20 31 30 30 20 20 |R osbyte. 100 | 00004410 20 20 20 20 20 20 20 4c 44 58 20 23 30 0d 20 20 | LDX #0. | 00004420 31 31 30 20 2e 6c 6f 6f 70 0d 20 20 31 32 30 20 |110 .loop. 120 | 00004430 20 20 20 20 20 20 20 20 4c 44 59 20 63 6c 6f 63 | LDY cloc| 00004440 6b 2c 58 20 20 20 5c 20 6c 6f 61 64 20 59 20 77 |k,X \ load Y w| 00004450 69 74 68 20 64 61 74 61 0d 20 20 31 33 30 20 20 |ith data. 130 | 00004460 20 20 20 20 20 20 20 4a 53 52 20 6f 73 62 79 74 | JSR osbyt| 00004470 65 20 20 20 20 5c 20 77 72 69 74 65 20 64 61 74 |e \ write dat| 00004480 61 20 74 6f 20 73 70 65 65 63 68 20 70 72 6f 63 |a to speech proc| 00004490 65 73 73 6f 72 0d 20 20 31 34 30 20 20 20 20 20 |essor. 140 | 000044a0 20 20 20 20 49 4e 58 0d 20 20 31 35 30 20 20 20 | INX. 150 | 000044b0 20 20 20 20 20 20 43 50 58 20 23 26 34 37 0d 20 | CPX #&47. | 000044c0 20 31 36 30 20 20 20 20 20 20 20 20 20 42 4e 45 | 160 BNE| 000044d0 20 6c 6f 6f 70 0d 20 20 31 37 30 20 2e 73 74 61 | loop. 170 .sta| 000044e0 74 75 73 0d 20 20 31 38 30 20 20 20 20 20 20 20 |tus. 180 | 000044f0 20 20 4c 44 41 20 23 26 39 45 20 20 20 20 20 20 | LDA #&9E | 00004500 5c 20 72 65 61 64 20 73 70 65 65 63 68 20 70 72 |\ read speech pr| 00004510 6f 63 65 73 73 6f 72 20 73 74 61 74 75 73 20 72 |ocessor status r| 00004520 65 67 69 73 74 65 72 0d 20 20 31 39 30 20 20 20 |egister. 190 | 00004530 20 20 20 20 20 20 4a 53 52 20 6f 73 62 79 74 65 | JSR osbyte| 00004540 0d 20 20 32 30 30 20 20 20 20 20 20 20 20 20 54 |. 200 T| 00004550 59 41 20 20 20 20 20 20 20 20 20 20 20 5c 20 73 |YA \ s| 00004560 74 61 74 75 73 20 72 65 67 69 73 74 65 72 20 69 |tatus register i| 00004570 6e 20 59 20 74 72 61 6e 73 66 65 72 65 64 20 74 |n Y transfered t| 00004580 6f 20 41 0d 20 20 32 31 30 20 20 20 20 20 20 20 |o A. 210 | 00004590 20 20 52 4f 4c 20 41 20 20 20 20 20 20 20 20 20 | ROL A | 000045a0 5c 20 62 69 74 20 37 20 28 74 61 6c 6b 20 73 74 |\ bit 7 (talk st| 000045b0 61 74 75 73 29 20 69 6e 74 6f 20 63 61 72 72 79 |atus) into carry| 000045c0 0d 20 20 32 32 30 20 20 20 20 20 20 20 20 20 42 |. 220 B| 000045d0 43 53 20 73 74 61 74 75 73 20 20 20 20 5c 20 63 |CS status \ c| 000045e0 61 72 72 79 20 73 65 74 20 69 66 20 73 74 69 6c |arry set if stil| 000045f0 6c 20 73 70 65 61 6b 69 6e 67 0d 20 20 32 33 30 |l speaking. 230| 00004600 20 20 20 20 20 20 20 20 20 52 54 53 20 20 20 20 | RTS | 00004610 20 20 20 20 20 20 20 5c 20 72 65 74 75 72 6e 20 | \ return | 00004620 74 6f 20 42 41 53 49 43 0d 20 20 32 34 30 20 2e |to BASIC. 240 .| 00004630 63 6c 6f 63 6b 0d 20 20 32 35 30 20 20 20 20 20 |clock. 250 | 00004640 20 20 20 20 45 51 55 44 20 26 30 30 33 42 41 35 | EQUD &003BA5| 00004650 32 38 0d 20 20 32 36 30 20 20 20 20 20 20 20 20 |28. 260 | 00004660 20 45 51 55 44 20 26 36 30 41 34 36 42 35 44 0d | EQUD &60A46B5D.| 00004670 20 20 32 37 30 20 20 20 20 20 20 20 20 20 45 51 | 270 EQ| 00004680 55 44 20 26 35 35 30 39 30 44 35 39 0d 20 20 32 |UD &55090D59. 2| 00004690 38 30 20 20 20 20 20 20 20 20 20 45 51 55 44 20 |80 EQUD | 000046a0 26 33 35 41 34 42 43 33 32 0d 20 20 32 39 30 20 |&35A4BC32. 290 | 000046b0 20 20 20 20 20 20 20 20 45 51 55 44 20 26 37 30 | EQUD &70| 000046c0 44 31 41 44 34 42 0d 20 20 33 30 30 20 20 20 20 |D1AD4B. 300 | 000046d0 20 20 20 20 20 45 51 55 44 20 26 44 37 31 36 46 | EQUD &D716F| 000046e0 36 37 33 0d 20 20 33 31 30 20 20 20 20 20 20 20 |673. 310 | 000046f0 20 20 45 51 55 44 20 26 41 44 43 43 32 42 32 39 | EQUD &ADCC2B29| 00004700 0d 20 20 33 32 30 20 20 20 20 20 20 20 20 20 45 |. 320 E| 00004710 51 55 44 20 26 41 44 36 37 34 44 43 41 0d 20 20 |QUD &AD674DCA. | 00004720 33 33 30 20 20 20 20 20 20 20 20 20 45 51 55 44 |330 EQUD| 00004730 20 26 35 30 41 45 46 35 32 43 0d 20 20 33 34 30 | &50AEF52C. 340| 00004740 20 20 20 20 20 20 20 20 20 45 51 55 44 20 26 44 | EQUD &D| 00004750 34 38 36 33 38 39 44 0d 20 20 33 35 30 20 20 20 |486389D. 350 | 00004760 20 20 20 20 20 20 45 51 55 44 20 26 36 35 36 35 | EQUD &6565| 00004770 34 42 33 42 0d 20 20 33 36 30 20 20 20 20 20 20 |4B3B. 360 | 00004780 20 20 20 45 51 55 44 20 26 37 35 34 42 44 32 39 | EQUD &754BD29| 00004790 38 0d 20 20 33 37 30 20 20 20 20 20 20 20 20 20 |8. 370 | 000047a0 45 51 55 44 20 26 31 32 36 34 44 41 46 33 0d 20 |EQUD &1264DAF3. | 000047b0 20 33 38 30 20 20 20 20 20 20 20 20 20 45 51 55 | 380 EQU| 000047c0 44 20 26 36 34 34 35 44 44 43 41 0d 20 20 33 39 |D &6445DDCA. 39| 000047d0 30 20 20 20 20 20 20 20 20 20 45 51 55 44 20 26 |0 EQUD &| 000047e0 32 38 30 30 30 30 30 33 0d 20 20 34 30 30 20 20 |28000003. 400 | 000047f0 20 20 20 20 20 20 20 45 51 55 44 20 26 30 32 32 | EQUD &022| 00004800 33 31 35 32 30 0d 20 20 34 31 30 20 20 20 20 20 |31520. 410 | 00004810 20 20 20 20 45 51 55 44 20 26 38 30 38 43 45 34 | EQUD &808CE4| 00004820 45 34 0d 20 20 34 32 30 20 20 20 20 20 20 20 20 |E4. 420 | 00004830 20 45 51 55 57 20 26 30 37 32 43 0d 20 20 34 33 | EQUW &072C. 43| 00004840 30 20 20 20 20 20 20 20 20 20 45 51 55 42 20 26 |0 EQUB &| 00004850 46 45 0d 20 20 34 34 30 20 5d 0d 20 20 34 35 30 |FE. 440 ]. 450| 00004860 20 4e 45 58 54 0d 20 20 34 36 30 20 43 41 4c 4c | NEXT. 460 CALL| 00004870 20 6d 63 6f 64 65 0d 0d 0d 2d 2d 2d 2d 2d 2d 2d | mcode...-------| 00004880 2d 2d 0d 52 65 61 64 20 42 79 74 65 0d 2d 2d 2d |--.Read Byte.---| 00004890 2d 2d 2d 2d 2d 2d 0d 0d 4f 73 62 79 74 65 20 26 |------..Osbyte &| 000048a0 39 46 20 77 69 74 68 20 59 20 3d 20 26 31 30 2c |9F with Y = &10,| 000048b0 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 4f 73 62 | followed by Osb| 000048c0 79 74 65 20 26 39 45 0d 0d 54 68 65 20 52 65 61 |yte &9E..The Rea| 000048d0 64 20 42 79 74 65 20 63 6f 6d 6d 61 6e 64 20 61 |d Byte command a| 000048e0 6c 6c 6f 77 73 20 74 68 65 20 43 50 55 20 74 6f |llows the CPU to| 000048f0 20 72 65 61 64 20 6f 6e 65 20 62 79 74 65 20 66 | read one byte f| 00004900 72 6f 6d 20 61 20 77 6f 72 64 20 50 48 52 4f 4d |rom a word PHROM| 00004910 2e 0d 42 65 66 6f 72 65 20 65 78 65 63 75 74 69 |..Before executi| 00004920 6e 67 20 74 68 65 20 52 65 61 64 20 42 79 74 65 |ng the Read Byte| 00004930 20 63 6f 6d 6d 61 6e 64 20 74 68 65 20 4c 6f 61 | command the Loa| 00004940 64 20 41 64 64 72 65 73 73 20 63 6f 6d 6d 61 6e |d Address comman| 00004950 64 20 73 68 6f 75 6c 64 20 62 65 0d 75 73 65 64 |d should be.used| 00004960 20 74 6f 20 73 70 65 63 69 66 79 20 74 68 65 20 | to specify the | 00004970 61 64 64 72 65 73 73 20 6f 66 20 74 68 65 20 62 |address of the b| 00004980 79 74 65 20 74 6f 20 62 65 20 72 65 61 64 2e 20 |yte to be read. | 00004990 54 68 65 20 52 65 61 64 20 62 79 74 65 20 63 6f |The Read byte co| 000049a0 6d 6d 61 6e 64 0d 63 61 75 73 65 73 20 74 68 65 |mmand.causes the| 000049b0 20 62 79 74 65 20 69 6e 64 69 63 61 74 65 64 20 | byte indicated | 000049c0 62 79 20 74 68 65 20 61 64 64 72 65 73 73 20 72 |by the address r| 000049d0 65 67 69 73 74 65 72 20 74 6f 20 62 65 20 70 6c |egister to be pl| 000049e0 61 63 65 64 20 69 6e 20 74 68 65 0d 65 69 67 68 |aced in the.eigh| 000049f0 74 20 62 69 74 20 64 61 74 61 20 72 65 67 69 73 |t bit data regis| 00004a00 74 65 72 2e 20 54 68 69 73 20 64 61 74 61 20 62 |ter. This data b| 00004a10 79 74 65 20 63 61 6e 20 74 68 65 6e 20 62 65 20 |yte can then be | 00004a20 72 65 61 64 20 62 79 20 74 68 65 20 43 50 55 20 |read by the CPU | 00004a30 75 73 69 6e 67 0d 4f 73 62 79 74 65 20 26 39 45 |using.Osbyte &9E| 00004a40 20 77 68 69 63 68 20 72 65 74 75 72 6e 73 20 74 | which returns t| 00004a50 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 74 |he contents of t| 00004a60 68 65 20 64 61 74 61 20 72 65 67 69 73 74 65 72 |he data register| 00004a70 20 69 6e 20 74 68 65 20 59 0d 72 65 67 69 73 74 | in the Y.regist| 00004a80 65 72 2e 20 54 68 65 20 61 64 64 72 65 73 73 20 |er. The address | 00004a90 72 65 67 69 73 74 65 72 20 69 73 20 61 75 74 6f |register is auto| 00004aa0 6d 61 74 69 63 61 6c 6c 79 20 69 6e 63 72 65 6d |matically increm| 00004ab0 65 6e 74 65 64 20 61 66 74 65 72 20 74 68 65 20 |ented after the | 00004ac0 52 65 61 64 0d 42 79 74 65 20 63 6f 6d 6d 61 6e |Read.Byte comman| 00004ad0 64 20 73 6f 20 74 68 61 74 20 74 68 65 20 6e 65 |d so that the ne| 00004ae0 78 74 20 62 79 74 65 20 63 61 6e 20 62 65 20 72 |xt byte can be r| 00004af0 65 61 64 20 77 69 74 68 6f 75 74 20 75 73 69 6e |ead without usin| 00004b00 67 20 74 68 65 20 4c 6f 61 64 0d 41 64 64 72 65 |g the Load.Addre| 00004b10 73 73 20 63 6f 6d 6d 61 6e 64 2e 0d 0d 54 68 65 |ss command...The| 00004b20 20 52 65 61 64 20 42 79 74 65 20 63 6f 6d 6d 61 | Read Byte comma| 00004b30 6e 64 20 73 68 6f 75 6c 64 20 61 6c 77 61 79 73 |nd should always| 00004b40 20 62 65 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 | be followed by | 00004b50 61 6e 20 4f 73 62 79 74 65 20 26 39 45 20 63 6f |an Osbyte &9E co| 00004b60 6d 6d 61 6e 64 2e 0d 49 66 20 61 6e 79 20 6f 74 |mmand..If any ot| 00004b70 68 65 72 20 63 6f 6d 6d 61 6e 64 20 69 73 20 73 |her command is s| 00004b80 65 6e 74 20 74 6f 20 74 68 65 20 73 70 65 65 63 |ent to the speec| 00004b90 68 20 70 72 6f 63 65 73 73 6f 72 20 62 65 66 6f |h processor befo| 00004ba0 72 65 20 75 73 69 6e 67 20 4f 73 62 79 74 65 0d |re using Osbyte.| 00004bb0 26 39 45 20 74 68 65 20 64 61 74 61 20 62 79 74 |&9E the data byt| 00004bc0 65 20 77 69 6c 6c 20 62 65 20 6c 6f 73 74 20 61 |e will be lost a| 00004bd0 6e 64 20 74 68 65 20 73 74 61 74 75 73 20 72 65 |nd the status re| 00004be0 67 69 73 74 65 72 20 77 69 6c 6c 20 62 65 20 72 |gister will be r| 00004bf0 65 74 75 72 6e 65 64 20 69 6e 0d 74 68 65 20 59 |eturned in.the Y| 00004c00 20 72 65 67 69 73 74 65 72 2e 20 54 68 65 20 41 | register. The A| 00004c10 73 73 65 6d 62 6c 79 20 6c 61 6e 67 75 61 67 65 |ssembly language| 00004c20 20 73 75 62 72 6f 75 74 69 6e 65 20 6c 61 62 65 | subroutine labe| 00004c30 6c 65 64 20 27 72 65 61 64 27 20 63 61 6e 20 62 |led 'read' can b| 00004c40 65 0d 75 73 65 64 20 74 6f 20 72 65 61 64 20 61 |e.used to read a| 00004c50 20 62 79 74 65 20 66 72 6f 6d 20 61 20 77 6f 72 | byte from a wor| 00004c60 64 20 50 48 52 4f 4d 20 61 74 20 74 68 65 20 61 |d PHROM at the a| 00004c70 64 64 72 65 73 73 20 73 70 65 63 69 66 69 65 64 |ddress specified| 00004c80 20 62 79 20 74 68 65 0d 61 64 64 72 65 73 73 20 | by the.address | 00004c90 72 65 67 69 73 74 65 72 20 61 6e 64 20 72 65 74 |register and ret| 00004ca0 75 72 6e 20 74 68 61 74 20 62 79 74 65 20 69 6e |urn that byte in| 00004cb0 20 74 68 65 20 61 63 63 75 6d 75 6c 61 74 6f 72 | the accumulator| 00004cc0 2e 0d 0d 0d 2e 72 65 61 64 0d 20 20 20 20 20 20 |.....read. | 00004cd0 20 4c 44 41 20 23 26 39 46 20 20 20 20 20 20 20 | LDA #&9F | 00004ce0 20 20 5c 20 77 72 69 74 65 20 74 6f 20 73 70 65 | \ write to spe| 00004cf0 65 63 68 20 70 72 6f 63 65 73 73 6f 72 0d 20 20 |ech processor. | 00004d00 20 20 20 20 20 4c 44 59 20 23 26 31 30 20 20 20 | LDY #&10 | 00004d10 20 20 20 20 20 20 5c 20 72 65 61 64 20 62 79 74 | \ read byt| 00004d20 65 20 63 6f 6d 6d 61 6e 64 0d 20 20 20 20 20 20 |e command. | 00004d30 20 4a 53 52 20 6f 73 62 79 74 65 20 20 20 20 20 | JSR osbyte | 00004d40 20 20 5c 20 73 65 6e 64 20 72 65 61 64 20 62 79 | \ send read by| 00004d50 74 65 20 63 6f 6d 6d 61 6e 64 0d 20 20 20 20 20 |te command. | 00004d60 20 20 4c 44 41 20 23 26 39 45 20 20 20 20 20 20 | LDA #&9E | 00004d70 20 20 20 5c 20 72 65 61 64 20 66 72 6f 6d 20 73 | \ read from s| 00004d80 70 65 65 63 68 20 70 72 6f 63 65 73 73 6f 72 0d |peech processor.| 00004d90 20 20 20 20 20 20 20 4a 53 52 20 6f 73 62 79 74 | JSR osbyt| 00004da0 65 20 20 20 20 20 20 20 5c 20 72 65 61 64 20 62 |e \ read b| 00004db0 79 74 65 0d 20 20 20 20 20 20 20 54 59 41 20 20 |yte. TYA | 00004dc0 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 72 65 | \ re| 00004dd0 73 75 6c 74 20 69 6e 74 6f 20 61 63 63 75 6d 75 |sult into accumu| 00004de0 6c 61 74 6f 72 0d 20 20 20 20 20 20 20 52 54 53 |lator. RTS| 00004df0 0d 0d 0d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |...-------------| 00004e00 2d 2d 0d 52 65 61 64 20 61 6e 64 20 42 72 61 6e |--.Read and Bran| 00004e10 63 68 0d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |ch.-------------| 00004e20 2d 2d 0d 0d 4f 73 62 79 74 65 20 26 39 46 20 77 |--..Osbyte &9F w| 00004e30 69 74 68 20 59 20 3d 20 26 33 30 0d 0d 54 68 65 |ith Y = &30..The| 00004e40 20 52 65 61 64 20 61 6e 64 20 42 72 61 6e 63 68 | Read and Branch| 00004e50 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 69 73 20 | instruction is | 00004e60 75 73 65 64 20 61 73 20 61 6e 20 69 6e 64 69 72 |used as an indir| 00004e70 65 63 74 20 4c 6f 61 64 20 41 64 64 72 65 73 73 |ect Load Address| 00004e80 0d 69 6e 73 74 72 75 63 74 69 6f 6e 20 61 6e 64 |.instruction and| 00004e90 20 63 61 6e 20 6f 6e 6c 79 20 62 65 20 75 73 65 | can only be use| 00004ea0 64 20 61 66 74 65 72 20 73 65 74 74 69 6e 67 20 |d after setting | 00004eb0 75 70 20 61 6e 20 61 64 64 72 65 73 73 20 77 69 |up an address wi| 00004ec0 74 68 20 74 68 65 20 4c 6f 61 64 0d 41 64 64 72 |th the Load.Addr| 00004ed0 65 73 73 20 63 6f 6d 6d 61 6e 64 2e 20 54 68 65 |ess command. The| 00004ee0 20 4c 6f 61 64 20 41 64 64 72 65 73 73 20 63 6f | Load Address co| 00004ef0 6d 6d 61 6e 64 20 6d 75 73 74 20 6c 6f 61 64 20 |mmand must load | 00004f00 74 68 65 20 61 64 64 72 65 73 73 20 72 65 67 69 |the address regi| 00004f10 73 74 65 72 0d 77 69 74 68 20 74 68 65 20 61 64 |ster.with the ad| 00004f20 64 72 65 73 73 20 6f 66 20 61 20 70 6f 69 6e 74 |dress of a point| 00004f30 65 72 20 77 68 69 63 68 20 63 6f 6e 74 61 69 6e |er which contain| 00004f40 73 20 74 68 65 20 73 74 61 72 74 20 61 64 64 72 |s the start addr| 00004f50 65 73 73 20 6f 66 20 73 70 65 65 63 68 0d 64 61 |ess of speech.da| 00004f60 74 61 2e 0d 0d 41 63 6f 72 6e 20 72 65 63 6f 6d |ta...Acorn recom| 00004f70 6d 65 6e 64 20 74 68 61 74 20 74 68 69 73 20 63 |mend that this c| 00004f80 6f 6d 6d 61 6e 64 20 73 68 6f 75 6c 64 20 6e 6f |ommand should no| 00004f90 74 20 62 65 20 75 73 65 64 20 61 73 20 69 74 20 |t be used as it | 00004fa0 63 61 6e 20 6f 6e 6c 79 20 62 65 0d 67 75 61 72 |can only be.guar| 00004fb0 65 6e 74 65 65 64 20 74 6f 20 77 6f 72 6b 20 77 |enteed to work w| 00004fc0 68 65 6e 20 6f 6e 6c 79 20 6f 6e 65 20 77 6f 72 |hen only one wor| 00004fd0 64 20 50 48 52 4f 4d 20 69 73 20 66 69 74 74 65 |d PHROM is fitte| 00004fe0 64 20 69 6e 74 6f 20 74 68 65 20 63 6f 6d 70 75 |d into the compu| 00004ff0 74 65 72 2e 0d 54 68 69 73 20 61 64 76 69 63 65 |ter..This advice| 00005000 20 63 61 6e 20 6f 66 74 65 6e 20 62 65 20 69 67 | can often be ig| 00005010 6e 6f 72 65 64 20 73 69 6e 63 65 20 74 68 65 72 |nored since ther| 00005020 65 20 69 73 20 6f 6e 6c 79 20 6f 6e 65 20 77 6f |e is only one wo| 00005030 72 64 20 50 48 52 4f 4d 0d 67 65 6e 65 72 61 6c |rd PHROM.general| 00005040 6c 79 20 61 76 61 69 6c 61 62 6c 65 2c 20 74 68 |ly available, th| 00005050 61 74 20 69 73 20 77 6f 72 64 20 50 48 52 4f 4d |at is word PHROM| 00005060 20 41 2e 20 49 66 20 79 6f 75 20 69 6e 74 65 6e | A. If you inten| 00005070 64 20 74 6f 20 77 72 69 74 65 20 73 6f 66 74 77 |d to write softw| 00005080 61 72 65 0d 66 6f 72 20 6f 74 68 65 72 20 75 73 |are.for other us| 00005090 65 72 73 20 79 6f 75 20 63 61 6e 6e 6f 74 20 61 |ers you cannot a| 000050a0 73 73 75 6d 65 20 74 68 61 74 20 74 68 65 79 20 |ssume that they | 000050b0 68 61 76 65 20 6f 6e 6c 79 20 6f 6e 65 20 77 6f |have only one wo| 000050c0 72 64 20 50 48 52 4f 4d 20 61 6e 64 0d 79 6f 75 |rd PHROM and.you| 000050d0 20 73 68 6f 75 6c 64 20 61 76 6f 69 64 20 75 73 | should avoid us| 000050e0 69 6e 67 20 74 68 69 73 20 63 6f 6d 6d 61 6e 64 |ing this command| 000050f0 20 75 6e 64 65 72 20 74 68 6f 73 65 20 63 69 72 | under those cir| 00005100 63 75 6d 73 74 61 6e 63 65 73 2e 0d 0d 54 68 65 |cumstances...The| 00005110 20 65 78 61 6d 70 6c 65 20 70 72 6f 67 72 61 6d | example program| 00005120 20 54 4f 4e 45 31 20 75 73 65 73 20 74 68 65 20 | TONE1 uses the | 00005130 4c 6f 61 64 20 41 64 64 72 65 73 73 20 63 6f 6d |Load Address com| 00005140 6d 61 6e 64 20 74 6f 20 6c 6f 61 64 20 74 68 65 |mand to load the| 00005150 0d 61 64 64 72 65 73 73 20 26 30 30 37 34 20 69 |.address &0074 i| 00005160 6e 74 6f 20 74 68 65 20 61 64 64 72 65 73 73 20 |nto the address | 00005170 72 65 67 69 73 74 65 72 2e 20 26 30 30 37 34 20 |register. &0074 | 00005180 69 73 20 74 68 65 20 61 64 64 72 65 73 73 20 69 |is the address i| 00005190 6e 20 77 6f 72 64 0d 50 48 52 4f 4d 20 41 20 6f |n word.PHROM A o| 000051a0 66 20 74 68 65 20 70 6f 69 6e 74 65 72 20 74 6f |f the pointer to| 000051b0 20 74 68 65 20 73 70 65 65 63 68 20 64 61 74 61 | the speech data| 000051c0 20 6f 66 20 28 54 4f 4e 45 31 29 2e 20 54 68 65 | of (TONE1). The| 000051d0 20 52 65 61 64 20 61 6e 64 20 42 72 61 6e 63 68 | Read and Branch| 000051e0 0d 69 6e 73 74 72 75 63 74 69 6f 6e 20 69 73 20 |.instruction is | 000051f0 74 68 65 6e 20 75 73 65 64 20 74 6f 20 6c 6f 61 |then used to loa| 00005200 64 20 74 68 65 20 61 64 64 72 65 73 73 20 6f 66 |d the address of| 00005210 20 74 68 65 20 73 70 65 65 63 68 20 64 61 74 61 | the speech data| 00005220 20 28 26 30 32 37 32 20 2d 0d 61 6c 74 68 6f 75 | (&0272 -.althou| 00005230 67 68 20 74 68 65 72 65 20 69 73 20 6e 6f 20 6e |gh there is no n| 00005240 65 65 64 20 74 6f 20 6b 6e 6f 77 20 77 68 61 74 |eed to know what| 00005250 20 74 68 65 20 61 64 64 72 65 73 73 20 69 73 29 | the address is)| 00005260 20 61 6e 64 20 74 68 65 20 53 70 65 61 6b 0d 63 | and the Speak.c| 00005270 6f 6d 6d 61 6e 64 20 69 73 20 75 73 65 64 20 74 |ommand is used t| 00005280 6f 20 73 70 65 61 6b 20 74 68 65 20 64 61 74 61 |o speak the data| 00005290 2e 0d 0d 0d 20 20 20 31 30 20 52 45 4d 3a 20 54 |.... 10 REM: T| 000052a0 4f 4e 45 31 0d 20 20 20 32 30 20 6f 73 62 79 74 |ONE1. 20 osbyt| 000052b0 65 3d 26 46 46 46 34 0d 20 20 20 33 30 20 44 49 |e=&FFF4. 30 DI| 000052c0 4d 20 6d 63 6f 64 65 20 26 31 30 30 0d 20 20 20 |M mcode &100. | 000052d0 34 30 20 46 4f 52 70 61 73 73 3d 30 54 4f 32 53 |40 FORpass=0TO2S| 000052e0 54 45 50 32 0d 20 20 20 35 30 20 50 25 3d 6d 63 |TEP2. 50 P%=mc| 000052f0 6f 64 65 0d 20 20 20 36 30 20 5b 20 20 20 20 20 |ode. 60 [ | 00005300 20 20 4f 50 54 20 70 61 73 73 0d 20 20 20 37 30 | OPT pass. 70| 00005310 20 20 20 20 20 20 20 20 20 4c 44 41 20 23 26 39 | LDA #&9| 00005320 46 20 20 20 20 20 20 5c 20 77 72 69 74 65 20 74 |F \ write t| 00005330 6f 20 73 70 65 65 63 68 20 70 72 6f 63 65 73 73 |o speech process| 00005340 6f 72 0d 20 20 20 38 30 20 20 20 20 20 20 20 20 |or. 80 | 00005350 20 4c 44 59 20 23 26 34 34 20 20 20 20 20 20 5c | LDY #&44 \| 00005360 20 61 64 64 72 65 73 73 20 26 37 34 20 28 54 4f | address &74 (TO| 00005370 4e 45 31 29 20 70 6f 69 6e 74 65 72 0d 20 20 20 |NE1) pointer. | 00005380 39 30 20 20 20 20 20 20 20 20 20 4a 53 52 20 6f |90 JSR o| 00005390 73 62 79 74 65 0d 20 20 31 30 30 20 20 20 20 20 |sbyte. 100 | 000053a0 20 20 20 20 4c 44 59 20 23 26 34 37 0d 20 20 31 | LDY #&47. 1| 000053b0 31 30 20 20 20 20 20 20 20 20 20 4a 53 52 20 6f |10 JSR o| 000053c0 73 62 79 74 65 0d 20 20 31 32 30 20 20 20 20 20 |sbyte. 120 | 000053d0 20 20 20 20 4c 44 59 20 23 26 34 30 0d 20 20 31 | LDY #&40. 1| 000053e0 33 30 20 20 20 20 20 20 20 20 20 4a 53 52 20 6f |30 JSR o| 000053f0 73 62 79 74 65 0d 20 20 31 34 30 20 20 20 20 20 |sbyte. 140 | 00005400 20 20 20 20 4c 44 59 20 23 26 34 43 0d 20 20 31 | LDY #&4C. 1| 00005410 35 30 20 20 20 20 20 20 20 20 20 4a 53 52 20 6f |50 JSR o| 00005420 73 62 79 74 65 0d 20 20 31 36 30 20 20 20 20 20 |sbyte. 160 | 00005430 20 20 20 20 4c 44 59 20 23 26 34 33 0d 20 20 31 | LDY #&43. 1| 00005440 37 30 20 20 20 20 20 20 20 20 20 4a 53 52 20 6f |70 JSR o| 00005450 73 62 79 74 65 0d 20 20 31 38 30 20 20 20 20 20 |sbyte. 180 | 00005460 20 20 20 20 4c 44 41 20 23 26 39 46 20 20 20 20 | LDA #&9F | 00005470 20 20 5c 20 77 72 69 74 65 20 74 6f 20 73 70 65 | \ write to spe| 00005480 65 63 68 20 70 72 6f 63 65 73 73 6f 72 0d 20 20 |ech processor. | 00005490 31 39 30 20 20 20 20 20 20 20 20 20 4c 44 59 20 |190 LDY | 000054a0 23 26 33 30 20 20 20 20 20 20 5c 20 72 65 61 64 |#&30 \ read| 000054b0 20 61 6e 64 20 62 72 61 6e 63 68 0d 20 20 32 30 | and branch. 20| 000054c0 30 20 20 20 20 20 20 20 20 20 4a 53 52 20 6f 73 |0 JSR os| 000054d0 62 79 74 65 0d 20 20 32 31 30 20 20 20 20 20 20 |byte. 210 | 000054e0 20 20 20 4c 44 59 20 23 26 35 30 20 20 20 20 20 | LDY #&50 | 000054f0 20 5c 20 73 70 65 61 6b 20 63 6f 6d 6d 61 6e 64 | \ speak command| 00005500 0d 20 20 32 32 30 20 20 20 20 20 20 20 20 20 4a |. 220 J| 00005510 4d 50 20 6f 73 62 79 74 65 20 20 20 20 5c 20 73 |MP osbyte \ s| 00005520 70 65 61 6b 20 74 68 65 20 77 6f 72 64 20 61 6e |peak the word an| 00005530 64 20 72 65 74 75 72 6e 0d 20 20 32 33 30 20 5d |d return. 230 ]| 00005540 0d 20 20 32 34 30 20 4e 45 58 54 0d 20 20 32 35 |. 240 NEXT. 25| 00005550 30 20 43 41 4c 4c 20 6d 63 6f 64 65 0d 0d 0d 2d |0 CALL mcode...-| 00005560 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| 00005570 2d 2d 2d 0d 52 65 61 64 20 53 74 61 74 75 73 20 |---.Read Status | 00005580 52 65 67 69 73 74 65 72 0d 2d 2d 2d 2d 2d 2d 2d |Register.-------| 00005590 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0d 4f |-------------..O| 000055a0 73 62 79 74 65 20 26 39 45 0d 0d 54 68 65 20 73 |sbyte &9E..The s| 000055b0 74 61 74 75 73 20 72 65 67 69 73 74 65 72 20 63 |tatus register c| 000055c0 61 6e 20 62 65 20 72 65 61 64 20 75 73 69 6e 67 |an be read using| 000055d0 20 4f 73 62 79 74 65 20 26 39 45 20 61 74 20 61 | Osbyte &9E at a| 000055e0 6e 79 20 74 69 6d 65 20 65 78 63 65 70 74 0d 69 |ny time except.i| 000055f0 6d 6d 65 64 69 61 74 65 6c 79 20 61 66 74 65 72 |mmediately after| 00005600 20 61 20 52 65 61 64 20 42 79 74 65 20 69 6e 73 | a Read Byte ins| 00005610 74 72 75 63 74 69 6f 6e 2e 20 54 68 65 20 73 74 |truction. The st| 00005620 61 74 75 73 20 72 65 67 69 73 74 65 72 20 63 6f |atus register co| 00005630 6e 74 65 6e 74 73 0d 61 72 65 20 72 65 74 75 72 |ntents.are retur| 00005640 6e 65 64 20 69 6e 20 74 68 65 20 74 68 72 65 65 |ned in the three| 00005650 20 6d 6f 73 74 20 73 69 67 6e 69 66 69 63 61 6e | most significan| 00005660 74 20 62 69 74 73 20 6f 66 20 74 68 65 20 59 20 |t bits of the Y | 00005670 72 65 67 69 73 74 65 72 2e 0d 0d 42 69 74 20 37 |register...Bit 7| 00005680 20 69 73 20 74 68 65 20 54 61 6c 6b 20 53 74 61 | is the Talk Sta| 00005690 74 75 73 20 62 69 74 20 28 54 53 29 20 61 6e 64 |tus bit (TS) and| 000056a0 20 69 73 20 73 65 74 20 69 66 20 73 70 65 65 63 | is set if speec| 000056b0 68 20 69 73 20 62 65 69 6e 67 20 70 72 6f 64 75 |h is being produ| 000056c0 63 65 64 2e 0d 42 69 74 20 36 20 69 73 20 74 68 |ced..Bit 6 is th| 000056d0 65 20 42 75 66 66 65 72 20 4c 6f 77 20 62 69 74 |e Buffer Low bit| 000056e0 20 28 42 4c 29 20 77 68 69 63 68 20 69 73 20 73 | (BL) which is s| 000056f0 65 74 20 69 66 20 74 68 65 20 46 49 46 4f 20 62 |et if the FIFO b| 00005700 75 66 66 65 72 20 69 73 20 6d 6f 72 65 0d 74 68 |uffer is more.th| 00005710 61 6e 20 68 61 6c 66 20 65 6d 70 74 79 2e 20 42 |an half empty. B| 00005720 69 74 20 35 20 69 73 20 74 68 65 20 42 75 66 66 |it 5 is the Buff| 00005730 65 72 20 65 6d 70 74 79 20 62 69 74 20 28 42 45 |er empty bit (BE| 00005740 29 20 77 68 69 63 68 20 69 73 20 73 65 74 20 69 |) which is set i| 00005750 66 20 74 68 65 0d 46 49 46 4f 20 62 75 66 66 65 |f the.FIFO buffe| 00005760 72 20 68 61 73 20 72 75 6e 20 6f 75 74 20 6f 66 |r has run out of| 00005770 20 64 61 74 61 20 77 68 69 6c 65 20 65 78 65 63 | data while exec| 00005780 75 74 69 6e 67 20 61 20 53 70 65 61 6b 20 45 78 |uting a Speak Ex| 00005790 74 65 72 6e 61 6c 20 63 6f 6d 6d 61 6e 64 2e 0d |ternal command..| 000057a0 0d 54 68 65 20 73 75 62 72 6f 75 74 69 6e 65 20 |.The subroutine | 000057b0 73 74 61 74 75 73 20 63 61 6e 20 62 65 20 75 73 |status can be us| 000057c0 65 64 20 74 6f 20 77 61 73 74 65 20 74 69 6d 65 |ed to waste time| 000057d0 20 77 68 69 6c 65 20 77 61 69 74 69 6e 67 20 66 | while waiting f| 000057e0 6f 72 20 62 69 74 20 37 0d 6f 66 20 74 68 65 20 |or bit 7.of the | 000057f0 73 74 61 74 75 73 20 72 65 67 69 73 74 65 72 20 |status register | 00005800 74 6f 20 63 6c 65 61 72 2e 20 42 69 74 20 37 20 |to clear. Bit 7 | 00005810 77 69 6c 6c 20 63 6c 65 61 72 20 77 68 65 6e 20 |will clear when | 00005820 74 68 65 20 70 72 6f 64 75 63 74 69 6f 6e 20 6f |the production o| 00005830 66 0d 73 70 65 65 63 68 20 69 73 20 68 61 6c 74 |f.speech is halt| 00005840 65 64 20 62 79 20 70 72 6f 63 65 73 73 69 6e 67 |ed by processing| 00005850 20 61 20 73 74 6f 70 20 63 6f 64 65 20 28 25 31 | a stop code (%1| 00005860 31 31 31 29 2c 20 6f 72 20 77 68 65 6e 20 74 68 |111), or when th| 00005870 65 20 46 49 46 4f 0d 62 75 66 66 65 72 20 69 73 |e FIFO.buffer is| 00005880 20 65 6d 70 74 79 2c 20 6f 72 20 77 68 65 6e 20 | empty, or when | 00005890 74 68 65 20 53 70 65 65 63 68 20 50 72 6f 63 65 |the Speech Proce| 000058a0 73 73 6f 72 20 69 73 20 72 65 73 65 74 2e 0d 0d |ssor is reset...| 000058b0 0d 2e 73 74 61 74 75 73 0d 20 20 20 20 20 20 20 |..status. | 000058c0 20 4c 44 41 20 23 26 39 45 20 20 20 20 20 20 5c | LDA #&9E \| 000058d0 20 72 65 61 64 20 73 70 65 65 63 68 20 70 72 6f | read speech pro| 000058e0 63 65 73 73 6f 72 20 73 74 61 74 75 73 20 72 65 |cessor status re| 000058f0 67 69 73 74 65 72 0d 20 20 20 20 20 20 20 20 4a |gister. J| 00005900 53 52 20 6f 73 62 79 74 65 0d 20 20 20 20 20 20 |SR osbyte. | 00005910 20 20 54 59 41 20 20 20 20 20 20 20 20 20 20 20 | TYA | 00005920 5c 20 73 74 61 74 75 73 20 72 65 67 69 73 74 65 |\ status registe| 00005930 72 20 69 6e 20 59 20 74 72 61 6e 73 66 65 72 65 |r in Y transfere| 00005940 64 20 74 6f 20 41 0d 20 20 20 20 20 20 20 20 52 |d to A. R| 00005950 4f 4c 20 41 20 20 20 20 20 20 20 20 20 5c 20 62 |OL A \ b| 00005960 69 74 20 37 20 28 74 61 6c 6b 20 73 74 61 74 75 |it 7 (talk statu| 00005970 73 29 20 69 6e 74 6f 20 63 61 72 72 79 0d 20 20 |s) into carry. | 00005980 20 20 20 20 20 20 42 43 53 20 73 74 61 74 75 73 | BCS status| 00005990 20 20 20 20 5c 20 63 61 72 72 79 20 73 65 74 20 | \ carry set | 000059a0 69 66 20 73 74 69 6c 6c 20 73 70 65 61 6b 69 6e |if still speakin| 000059b0 67 0d 20 20 20 20 20 20 20 20 52 54 53 20 20 20 |g. RTS | 000059c0 20 20 20 20 20 20 20 20 5c 20 72 65 74 75 72 6e | \ return| 000059d0 20 77 68 65 6e 20 73 70 65 65 63 68 20 68 61 6c | when speech hal| 000059e0 74 65 64 0d 0d 0d 59 6f 75 20 77 69 6c 6c 20 6e |ted...You will n| 000059f0 65 65 64 20 74 6f 20 75 6e 64 65 72 73 74 61 6e |eed to understan| 00005a00 64 20 61 6e 64 20 75 73 65 20 61 6c 6c 20 74 68 |d and use all th| 00005a10 65 20 73 70 65 65 63 68 20 70 72 6f 63 65 73 73 |e speech process| 00005a20 6f 72 20 63 6f 6d 6d 61 6e 64 73 20 69 6e 0d 74 |or commands in.t| 00005a30 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 6d 6f 64 |he following mod| 00005a40 75 6c 65 73 20 6f 66 20 74 68 69 73 20 73 65 72 |ules of this ser| 00005a50 69 65 73 2e 0d |ies..| 00005a55