[Coco] _os9 call from C still not Virqing
Walter Zambotti
zambotti at iinet.net.au
Tue Apr 14 03:29:08 EDT 2020
The solution is there must be Virq callback registration between the
open and the get counter.
Like so:
* open /Nil
lda #UPDAT defined as 3 in OS9Defs
leax DvcName,pc
os9 I$Open
sta <PathNmbr
* setup signal trap for sig #$80
lda #$80 * signal
leax SigTrap,ps * pointer to SigTrap function
os9 F$Icpt
* Trigger callbacks. Make VRN driver generate call backs every 300 Virq/Frames (5 seconds)
lda <PathNmbr
ldb #$81 * Set Stat Virq to generate signal (#$80)
ldy #1 * set Virq Code to Path
ldx #300 * repeat Virq callback (signal #$80) every 300 Virqs (5 secs)
os9 I$SetStt
* Query VRN driver how many Virqs have occurred
lda <PathNmbr
ldb #$80 get Virq total
os9 I$GetStt
You must trigger the call backs. Even if you don't intend to use the call backs.
However with this feature you can get the driver to inform the program when a Virq has occurred.
So all working now!
Walter
On 2020-04-13 09:53, Walter Zambotti wrote:
> Hi guys
>
> trying to get this Virq counter in VRN working from C.
>
> Looking at the asm code for tstfs2 I see this :
>
> DvcName fcc '/Nil'
>
> lda #UPDAT defined as 3 in OS9Defs
> leax DvcName,pc
> os9 I$Open
>
> lda <PathNmbr
> ldb #$80 get Virq total
> os9 I$GetSttt
>
> So my code looks like this :
>
> int nilp = open("/Nil", 3);
> if (nilp == -1) printf("Can't open Nil\n");
> struct registers regs;
> regs.rg_a = nilp;
> regs_rg_b = 0x80;
> if (_os9(I_GETSTT, ®s) == -1) printf ("Can't stat Virq total %d\n",
> regs.rg_b & 0xFF);
>
> And my code is always failing at the _os9 call with error:
>
> 240: UNIT ERROR—The specified device unit does not exist.
>
> Not sure if I'm doing this correctly!
>
> Any ideas?
>
> Walter
>
>
>
More information about the Coco
mailing list