On 30 October 2012 09:15, Jarratt RMA <robert.jarratt at ntlworld.com> wrote:
It has been many years since I wrote any VAX-Pascal
and I find myself
needing to write an AST. I have looked around in various documentation
but can't find any examples. The AST I want to write is in response to
the completion of a QIO. The QIO call looks like this:
Stat := $QIO(0, Channel, IO$_WRITEVBLK, , %IMMED SendCompleted, 0, Buf, Len);
And the AST itself looks like this (no body at the moment, just want
to make it work first):
[ASYNCHRONOUS] PROCEDURE SendCompleted( P : UNSIGNED);
BEGIN
END;
When I run the code though I get a runtime error:
%SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual
address=00000000, PC
=000008C1, PSL=03C00000
%TRACE-F-TRACEBACK, symbolic stack dump follows
module name routine name line rel PC abs PC
DMC11SEND SENDCOMPLETED 67 00000009 000008C1
801D58F3 801D58F3
0001E893 0001E893
DMC11SEND SEND 77 00000070 00000938
DMC11SEND DMC11SEND 111 00000179 000006BD
I am not sure what I have done wrong, anyone know?
Thanks
Rob
A little further investigation shows that VAX-Pascal passes parameters
by reference even if the parameter is passed by value. I know this
because if I change the AST Parameter in the QIO call to some other
number then the access violation occurs at the address with that
number. The bit I don't know how to work out is how to get the
parameter to be really treated as a value. I have tried the
[IMMEDIATE] attribute but it says that is only allowed on external
routines. So I am not quite sure how to resolve this. I found an
unsatisfactory trick which was to declare a global variable and pass
it to the QIO's AST parameter using %REF, but I don't like this
solution.
Any ideas?
Thanks
Rob