;
;       SYNTHESE VOCALE
;       ---------------
;
; By XAVSNAP(2014)
; ZX81+CARTE synthese vocale VTR.
; CARTE MAGECO
;


@WID=+16417
@ALLSTART=+16704
@TXTSTART=+18401

ORG +16514

;*******************
;* CLERGEOT (C) 84 *
;*******************
;    CARTE VTR DE
;  SYNTHESE  VOCALE
;-------------------
@INI
       LD A,+128
       OUT +63,A
       CALL RECHE
       CALL PLAY
       RET



@RECHE 
; GET WORD ID
       LD HL,WID
       LD A,(HL)
       LD HL,TXTSTART
       DEC A
       CP 0
       JR Z RE2
       LD B,A
       LD C,0
       
@RE1 
       LD A,(HL)
       BIT 7,A
       INC HL
       JR Z RE1
       DJNZ RE1

@RE2 
       LD A,(HL)
       LD B,A
       AND +127
       RST 10
       LD A,B
       BIT 7,A
       INC HL
       JR Z RE2
       RET

@PLAY
; GET ALLOPHONE ID
       LD HL,WID
       LD A,(HL)
       LD HL,ALLSTART
       DEC A
       CP 0
       JR Z RE12
       LD B,A
       LD C,0

       
@RE11 
       LD A,(HL)
       BIT 7,A
       INC HL
       JR Z RE11
       DJNZ RE11

@RE12 
       LD A,(HL)
       BIT 7,A
       RET NZ
       OUT +63,A
       CALL TIME
       INC HL
       JR RE12


@TIME 
       IN A,+63       
       CP +254
       JP Z TIME
       RET
@ARTIC 
       LD A,0
       OUT +63,A
       RET
