home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Boot Disc 8
/
boot-disc-1997-04.iso
/
PDA_Soft
/
Psion
/
sounds
/
SAYNUM.OPL
< prev
next >
Wrap
Text File
|
1993-11-24
|
2KB
|
101 lines
REM SAYNUM v0.3
REM by Roger Burton-West <ubte30e@ucl.ac.uk>
REM copy freely and of your own will
PROC stub:
local n
do
input n
saynum:(gen$(n,40))
until 0
ENDP
PROC saynum:(a$)
num2txt:(a$,-1)
ENDP
PROC num2txt:(nn$,z%)
local a$(15),v%,n$(255),m%
n$=zstrip$:(nn$)
if n$=""
n$="0"
endif
if val(n$)=0 and z%=0
return
endif
if left$(n$,1)="-"
say:("minus")
n$=right$(n$,len(n$)-1)
endif
if loc(n$,".")
num2txt:(left$(n$,loc(n$,".")-1),-1)
say:("point")
n$=mid$(n$,loc(n$,".")+1,255)
v%=1
do
say:(mid$(n$,v%,1))
v%=v%+1
until v%>len(n$)
return
endif
if len(n$)>6
num2txt:(left$(n$,len(n$)-6),0)
say:("000000")
n$=zstrip$:(right$(n$,6))
m%=1
endif
if len(n$)>3
num2txt:(left$(n$,len(n$)-3),0)
say:("000")
n$=zstrip$:(right$(n$,3))
m%=1
endif
if len(n$)>2
num2txt:(left$(n$,len(n$)-2),0)
say:("00")
n$=zstrip$:(right$(n$,2))
m%=1
endif
n$=zstrip$:(n$)
if m%=1 and n$<>""
say:("and")
endif
if n$="" and z%=-1 and m%=0
say:("0")
return
elseif n$=""
return
endif
if val(n$)<21
say:(n$)
else
say:(left$(n$,1)+"0")
if right$(n$,1)<>"0"
say:(right$(n$,1))
endif
endif
ENDP
PROC say:(a$)
playw%:("*"+a$,0,0)
ENDP
PROC zstrip$:(a$)
local b$(255)
b$=a$
while left$(b$,1)="0"
b$=right$(b$,len(b$)-1)
endwh
return b$
ENDP
PROC playw%:(inname$,ticks%,vol%)
LOCAL name$(128),p%,ret%
p%=PEEKW($1c)+6
name$=inname$+chr$(0)
ret%=call($1f86,uadd(addr(name$),1),ticks%,vol%)
if peekw(p%) and 1
return ret% or $FF00
endif
ENDP