libreoffice basic, asc(x)

Hello!
Please, I am trying to write a macro which woul write an asc(k)

sub x
dim a as integer
a= asc(x)
print a
end sub

This was ment to print numnber: 120

As it did nto work I tried:

sub x
dim a as integer
a%=asc(x)
print a%
end sub

But I got error again.

Please, if someone sees the mistake, and if someone can link ne a good site explaining this!
MANY THAKNS!!!