[Coco] SYSCALL syntax for BASIC09

L. Curtis Boyle curtisboyle at sasktel.net
Thu May 7 15:27:32 EDT 2020


You can use Hexadecimal or decimal, whichever you are more comfortable with (I prefer hex when using Syscall, as the system call numbers listed in the Technical Reference part of the OS-9 manual are also in hex - saves me translating them). Your line 3 is adding making it a string first; you don’t need that, just make a BYTE value for the system call number. I also probably wouldn’t use ‘a’ as the name; you are also using ‘a’ in the TYPE statement (representing the 6(8/3)09 A register, so that could get confusing. I would change line 3 to something like: DIM callnum:BYTE.
Doing that, line 6 would change to ‘callnum=$A’. In BASIC09, the ‘$’ indicates hex (like ‘&H’ does in Extended Color BASIC). You could also do that line in decimal, with ‘callnum=10’, although it’s harder to look up the system call in the manual then (as mentioned above, they are all listed in hex).
The only other change you would need then is line 15, which becomes 'RUN syscall(callnum,regs)’. You have regs.x set correctly (although on the Coco, the rest of time slice is actually based on 1/60th of second - Vertical Sync).

Of course, you don’t need the system call number as a variable, either - you could skip line 3 and 6, and change 15 to simply be ‘RUN syscall($a,regs)’ (or ‘RUN syscall(10,regs)’).


L. Curtis Boyle
curtisboyle at sasktel.net



> On May 7, 2020, at 12:58 PM, coco at jechar.ca wrote:
> 
> 
> I have a manual that describes OS9 Syscalls
> but it does not explain how to use them
> with Basic09.
> 
> I will show a shoret listing below with
> line numbers added for reference and ???
> indicateing the problem lines then I will
> explain what the problem is with each line.
> 
> 01   PROCEDURE politekey
> 02   TYPE registers=cc,a,b,dp:BYTE;x,y,u:INTEGER
> 03???DIM A:STRING[2]
> 04   DIM regs:registers
> 05   PARAM key:STRING[1]
> 06???A$="0A"
> 07   RUN GFX2("CURXY",0,0)
> 08   LOOP
> 09     RUN INKEY(key)
> 10     (* Exit LOOP/ENDLOOP on key press  *)
> 11     EXITIF key<>"" THEN
> 12     ENDEXIT
> 13     (* F$Sleep call - rest of 100ms time slice. )
> 14     regs.x= 1
> 15     RUN syscall(A,regs)
> 16     RUN GFX2("CURXY",0,0)
> 17     PRINT " ";
> 18   ENDLOOP
> 19   END
> 
> So here In line Number 3 I do not know if I should use a two character string "0A"
> or a single byte Hex value A and if the latter do I declarew A$ as BYTE or Integer.
> 
> In line Number 6 Should I have A="0A" or A=10 ?
> 
> Or Is my error someware else.
> 
> Charlie
> 
> -- 
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
> 



More information about the Coco mailing list