E886 PHA ;save it E887 SEC ;set carry E888 ROR &0800,X ;and pass into bit 7 to warn that channel is active E88B BMI &E8A4 ;goto E8A4 ALWAYS!! **********:speech handling routine ************************************** E88D PHP ;push flags E88E INY ;Y=2 E88F LDA (&F0),Y ;get byte E891 PHA ;store it E892 INY ;Y=4 E893 LDA (&F0),Y ;get byte E895 PHA ;store it E896 LDY #&00 ;Y=0 E898 LDA (&F0),Y ;get byte E89A LDX #&08 ;X=8 E89C JSR &E1F8 ;select speech buffer and pass A E89F BCS &E869 ;if carry set on return restore stack ;and exit E8A1 ROR &02D7 ;else clear bit 7 of buffer busy flag to show ;buffer has been set E8A4 PLA ;get back byte E8A5 JSR &E4B0 ;enter it in buffer X E8A8 PLA ;get back next E8A9 JSR &E4B0 ;and enter it again E8AC PLP ;get back flags E8AD RTS ;and exit ************************************************************************* * * * OSWORD 08 ENTRY POINT * * * * define envelope * * * ************************************************************************* ;block of 14 bytes set at address pointed to by 00F0/1 ;XY +0 Envelope number, also in A ; 1 bits 0-6 length of each step in centi-secsonds bit 7=0 auto repeat ; 2 change of Pitch per step (-128-+127) in section 1 ; 3 change of Pitch per step (-128-+127) in section 2 ; 4 change of Pitch per step (-128-+127) in section 3 ; 5 number of steps in section 1 (0-255) ; 6 number of steps in section 2 (0-255) ; 7 number of steps in section 3 (0-255) ; 8 change of amplitude per step during attack phase (-127 to +127) ; 9 change of amplitude per step during decay phase (-127 to +127) ; 10 change of amplitude per step during sustain phase (-127 to +127) ; 11 change of amplitude per step during release phase (-127 to +127) ; 12 target level at end of attack phase (0-126) ; 13 target level at end of decay phase (0-126) ;Y=0 on entry E8AE SBC #&01 ;set up appropriate displacement to storage area E8B0 ASL ;A=(A-1)*16 or 15 E8B1 ASL ; E8B2 ASL ; E8B3 ASL ; E8B4 ORA #&0F ; E8B6 TAX ;X=A E8B7 LDA #&00 ;A=0 E8B9 LDY #&10 ;Y=&10 E8BB CPY #&0E ;is Y>=14?? E8BD BCS &E8C1 ;yes then E8C1 E8BF LDA (&F0),Y ;else get byte from parameter block E8C1 STA &08C0,X ;and store it in appropriate area E8C4 DEX ;decrement X E8C5 DEY ;Decrement Y E8C6 BNE &E8BB ;if not 0 then do it again E8C8 RTS ;else exit ;note that envelope number is NOT transferred ; E8C9 LDA (&F0),Y ;get byte E8CB CMP #&10 ;is it greater than 15, if so set carry E8CD AND #&03 ;and 3 to clear bits 2-7 E8CF INY ;increment Y E8D0 RTS ;and exit ************************************************************************* * * * OSWORD 03 ENTRY POINT * * * * read interval timer * * * ************************************************************************* F0/1 points to block to store data E8D1 LDX #&0F ;X=&F displacement from clock to timer E8D3 BNE &E8D8 ;jump to E8D8 ************************************************************************* * * * OSWORD 01 ENTRY POINT * * * * read system clock * * * ************************************************************************* F0/1 points to block to store data E8D5 LDX &0283 ;X=current system clock store pointer E8D8 LDY #&04 ;Y=4 E8DA LDA &028D,X ;read byte E8DD STA (&F0),Y ;store it in parameter block E8DF INX ;X=x+1 E8E0 DEY ;Y=Y-1 E8E1 BPL &E8DA ;if Y>0 then do it again E8E3 RTS ;else exit ************************************************************************* * * * OSWORD 04 ENTRY POINT * * * * write interval timer * * * ************************************************************************* F0/1 points to block to store data E8E4 LDA #&0F ;offset between clock and timer E8E6 BNE &E8EE ;jump to E8EE ALWAYS!! ************************************************************************* * * * OSWORD 02 ENTRY POINT * * * * write system clock * * * ************************************************************************* F0/1 points to block to store data E8E8 LDA &0283 ;get current clock store pointer E8EB EOR #&0F ;and invert to get inactive timer E8ED CLC ;clear carry E8EE PHA ;store A E8EF TAX ;X=A E8F0 LDY #&04 ;Y=4 E8F2 LDA (&F0),Y ;and transfer all 5 bytes E8F4 STA &028D,X ;to the clock or timer E8F7 INX ; E8F8 DEY ; E8F9 BPL &E8F2 ;if Y>0 then E8F2 E8FB PLA ;get back stack E8FC BCS &E8E3 ;if set (write to timer) E8E3 exit E8FE STA &0283 ;write back current clock store E901 RTS ;and exit ************************************************************************* * * * OSWORD 00 ENTRY POINT * * * * read line from current input to memory * * * ************************************************************************* ;F0/1 points to parameter block ; +0/1 buffer address for input ; +2 Maximum line length ; +3 minimum acceptable ASCII value ; +4 maximum acceptable ASCII value E902 LDY #&04 ;Y=4 E904 LDA (&F0),Y ;transfer bytes 4,3,2 to 2B3-2B5 E906 STA &02B1,Y ; E909 DEY ;decrement Y E90A CPY #&02 ;until Y=1 E90C BCS &E904 ; E90E LDA (&F0),Y ;get address of input buffer E910 STA &E9 ;store it in &E9 as temporary buffer E912 DEY ;decrement Y E913 STY &0269 ;Y=0 store in print line counter for paged mode E916 LDA (&F0),Y ;get lo byte of address E918 STA &E8 ;and store in &E8 E91A CLI ;allow interrupts E91B BCC &E924 ;Jump to E924 E91D LDA #&07 ;A=7 E91F DEY ;decrement Y E920 INY ;increment Y E921 JSR OSWRCH ;and call OSWRCH E924 JSR OSRDCH ;else read character from input stream E927 BCS &E972 ;if carry set then illegal character or other error ;exit via E972 E929 TAX ;X=A E92A LDA &027C ;A=&27C get character destination status E92D ROR ;put VDU driver bit in carry E92E ROR ;if this is 1 VDU driver is disabled E92F TXA ;X=A E930 BCS &E937 ;if Carry set E937 E932 LDX &026A ;get number of items in VDU queque E935 BNE &E921 ;if not 0 output character and loop round again E937 CMP #&7F ;if character is not delete E939 BNE &E942 ;goto E942 E93B CPY #&00 ;else is Y=0 E93D BEQ &E924 ;and goto E924 E93F DEY ;decrement Y E940 BCS &E921 ;and if carry set E921 to output it E942 CMP #&15 ;is it delete line &21 E944 BNE &E953 ;if not E953 E946 TYA ;else Y=A, if its 0 we are still reading first ;character E947 BEQ &E924 ;so E924 E949 LDA #&7F ;else output DELETES E94B JSR OSWRCH ;until Y=0 E94E DEY ; E94F BNE &E94B ; E951 BEQ &E924 ;then read character again E953 STA (&E8),Y ;store character in designated buffer E955 CMP #&0D ;is it CR? E957 BEQ &E96C ;if so E96C E959 CPY &02B3 ;else check the line length E95C BCS &E91D ;if = or greater loop to ring bell E95E CMP &02B4 ;check minimum character E961 BCC &E91F ;if less than minimum backspace E963 CMP &02B5 ;check maximum character E966 BEQ &E920 ;if equal E920 E968 BCC &E920 ;or less E920 E96A BCS &E91F ;then JUMP E91F E96C JSR OSNEWL ;output CR/LF E96F JSR &E57E ;call Econet vector E972 LDA &FF ;A=ESCAPE FLAG E974 ROL ;put bit 7 into carry E975 RTS ;and exit routine ************************************************************************* * * * OSBYTE 05 ENTRY POINT * * * * SELECT PRINTER TYPE * * * ************************************************************************* E976 CLI ;allow interrupts briefly E977 SEI ;bar interrupts E978 BIT &FF ;check if ESCAPE is pending E97A BMI &E9AC ;if it is E9AC E97C BIT &02D2 ;else check bit 7 buffer 3 (printer) E97F BPL &E976 ;if not empty bit 7=0 E976 E981 JSR &E1A4 ;check for user defined routine E984 LDY #&00 ;Y=0 E986 STY &F1 ;F1=0 ************************************************************************* * * * OSBYTE 01 ENTRY POINT * * * * READ/WRITE USER FLAG (&281) * * * * AND * * * * OSBYTE 06 ENTRY POINT * * * * SET PRINTER IGNORE CHARACTER * * * ************************************************************************* ; A contains osbyte number E988 ORA #&F0 ;A=osbyte +&F0 E98A BNE &E99A ;JUMP to E99A ************************************************************************* * * * OSBYTE 0C ENTRY POINT * * * * SET KEYBOARD AUTOREPEAT RATE * * * ************************************************************************* E98C BNE &E995 ;if &F0<>0 goto E995 E98E LDX #&32 ;if X=0 in original call then X=32 E990 STX &0254 ;to set keyboard autorepeat delay ram copy E993 LDX #&08 ;X=8 ************************************************************************* * * * OSBYTE 0B ENTRY POINT * * * * SET KEYBOARD AUTOREPEAT DELAY * * * ************************************************************************* E995 ADC #&CF ;A=A+&D0 (carry set) ************************************************************************* * * * OSBYTE 03 ENTRY POINT * * * * SELECT OUTPUT STREAM * * * * AND * * * * * * OSBYTE 04 ENTRY POINT * * * * ENABLE/DISABLE CURSOR EDITING * * * ************************************************************************* E997 CLC ;c,ear carry E998 ADC #&E9 ;A=A+&E9 E99A STX &F0 ;store X ************************************************************************* * * * OSBYTE A6-FF ENTRY POINT * * * * READ/ WRITE SYSTEM VARIABLE OSBYTE NO. +&190 * * * ************************************************************************* E99C TAY ;Y=A E99D LDA &0190,Y ;i.e. A=&190 +osbyte call! E9A0 TAX ;preserve this E9A1 AND &F1 ;new value = OLD value AND Y EOR X! E9A3 EOR &F0 ; E9A5 STA &0190,Y ;store it E9A8 LDA &0191,Y ;get value of next byte into A E9AB TAY ;Y=A E9AC RTS ;and exit ******* SERIAL BAUD RATE LOOK UP TABLE ************************************ E9AD DB &64 ; % 01100100 75 E9AE DB &7F ; % 01111111 150 E9AF DB &5B ; % 01011011 300 E9B0 DB &6D ; % 01101101 1200 E9B1 DB &C9 ; % 11001001 2400 E9B2 DB &F6 ; % 11110110 4800 E9B3 DB &D2 ; % 11010010 9600 E9B4 DB &E4 ; % 11100100 19200 E9B5 DB &40 ; % 01000000 ************************************************************************* * * * OSBYTE &13 ENTRY POINT * * * * Wait for VSync * * * ************************************************************************* E9B6 LDA &0240 ;read vertical sync counter E9B9 CLI ;allow interrupts briefly E9BA SEI ;bar interrupts E9BB CMP &0240 ;has it changed? E9BE BEQ &E9B9 ;no then E9B9 ; falls through and reads VDU variable X ************************************************************************* * * * OSBYTE 160 ENTRY POINT * * * * READ VDU VARIABLE * * * ************************************************************************* ;X contains the variable number ;0 =lefthand column in pixels current graphics window ;2 =Bottom row in pixels current graphics window ;4 =Right hand column in pixels current graphics window ;6 =Top row in pixels current graphics window ;8 =lefthand column in absolute characters current text window ;9 =Bottom row in absolute characters current text window ;10 =Right hand column in absolute characters current text window ;11 =Top row in absolute characters current text window ;12-15 current graphics origin in external coordinates ;16-19 current graphics cursor in external coordina4es ;20-23 old graphics cursor in internal coordinates ;24 current text cursor in X and Y E9C0 LDY &0301,X ;get VDU variable hi E9C3 LDA &0300,X ;low E9C6 TAX ;X=low byte E9C7 RTS ;and exit ************************************************************************* * * * OSBYTE 18 ENTRY POINT * * * * RESET SOFT KEYS * * * ************************************************************************* E9C8 LDA #&10 ;set consistency flag E9CA STA &0284 ; E9CD LDX #&00 ;X=0 E9CF STA &0B00,X ;and wipe clean E9D2 INX ;soft key buffer E9D3 BNE &E9CF ;until X=0 again E9D5 STX &0284 ;zero consistency flag E9D8 RTS ;and exit ************************************************************************* * * * OSBYTE &76 (118) SET LEDs to Keyboard Status * * * ************************************************************************* ;osbyte entry with carry set ;called from &CB0E, &CAE3, &DB8B E9D9 PHP ;PUSH P E9DA SEI ;DISABLE INTERUPTS E9DB LDA #&40 ;switch on CAPS and SHIFT lock lights E9DD JSR &E9EA ;via subroutine E9E0 BMI &E9E7 ;if ESCAPE exists (M set) E9E7 E9E2 CLC ;else clear V and C E9E3 CLV ;before calling main keyboard routine to E9E4 JSR &F068 ;switch on lights as required E9E7 PLP ;get back flags E9E8 ROL ;and rotate carry into bit 0 E9E9 RTS ;Return to calling routine ; ***************** Turn on keyboard lights and Test Escape flag ************ ;called from &E1FE, &E9DD ; E9EA BCC &E9F5 ;if carry clear E9EC LDY #&07 ;switch on shift lock light E9EE STY &FE40 ; E9F1 DEY ;Y=6 E9F2 STY &FE40 ;switch on Caps lock light E9F5 BIT &FF ;set minus flag if bit 7 of &00FF is set indicating E9F7 RTS ;that ESCAPE condition exists, then return ; ****************** Write A to SYSTEM VIA register B ************************* ;called from &CB6D, &CB73 E9F8 PHP ;push flags E9F9 SEI ;disable interupts E9FA STA &FE40 ;write register B from Accumulator E9FD PLP ;get back flags E9FE RTS ;and exit ; ************************************************************************* *