[Info-vax] BASIC and AST routines

Dave Froble davef at tsoft-inc.com
Wed Nov 17 20:18:57 EST 2021


On 11/17/2021 6:14 PM, John Doppke wrote:
> So I've been playing with writing AST routines (stubbornly) in BASIC.  They work ok, but I've found I have to declare the routine as having 5 'standard' parameters - "function long AST long (p1, p2, p3, p4, p5)".  I'm not sure what the 5 parameters are, but doing anything with them is usually a bad idea.  I communicate with my main program using common or event flags.
>
> Now I need an AST for a call that requires a parameter - SMG$ENABLE_UNSOLICITED_INPUT.  I've tried adding a parameter in my usual list in different ways but I can't get it to work.  Every time it's called I get a reserved opcode exception.  (A DCLAST call with my AST works ok).
>
> Can anyone shed some light on what the parameters are that BASIC is getting?  I'll probably end up writing this one in MACRO, but I want to understand what is happening.
>
> -John
>

 From the 7.3 docs:

Table 8–3 AST Arguments for VAX Systems and Alpha Systems
VAX System Arguments Alpha System Arguments
AST parameter AST parameter
R0 R0
R1 R1
PC PC
PSL PS
Registers R0 and R1, the program counter (PC), and the processor status
longword (PSL) on VAX systems, or processor status (PS) on Alpha systems were
saved when the process was interrupted by delivery of the AST.
The AST parameter is an argument passed to the AST service routine so that
it can identify the event that caused the AST. When you call a system service
requesting an AST, or when you call the SYS$DCLAST system service, you
can supply a value for the AST parameter. If you do not specify a value, the
parameter defaults to 0.

Not formatted so well, but the important data is there.

You get to pass a longword to the AST routine.  The other 4 parameters appear to 
be set by the OS, or whatever.  Not by you!  I don't know what you'd do with R0, 
R1, PC, and PLS/PS.

Other communications would be via global data, a COMMON block, a PSECT, and 
whatever.

As an example, something I've done, set a timer on some I/O.  When the AST 
fires, you want to do something because of the timeout.  I pass the channel # 
for the I/O and have the AST cancel the I/O on that channel and return.  That 
causes I/O completion in the code that set the timer.

I've not used SMG, so I'm not much help in what you're doing.  But I'd guess the 
"SMG$ENABLE_UNSOLICITED_INPUT" would be an external value, and the use of an 
INCLUDE statement would make it available, or, in global data shared with the 
calling code.

Apologies if I've not understood your question.

-- 
David Froble                       Tel: 724-529-0450
Dave Froble Enterprises, Inc.      E-Mail: davef at tsoft-inc.com
DFE Ultralights, Inc.
170 Grimplin Road
Vanderbilt, PA  15486



More information about the Info-vax mailing list