
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.cocopedia.com/wiki/index.php?action=history&amp;feed=atom&amp;title=SysCall.asm_Level_1</id>
	<title>SysCall.asm Level 1 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.cocopedia.com/wiki/index.php?action=history&amp;feed=atom&amp;title=SysCall.asm_Level_1"/>
	<link rel="alternate" type="text/html" href="https://www.cocopedia.com/wiki/index.php?title=SysCall.asm_Level_1&amp;action=history"/>
	<updated>2026-05-01T17:06:59Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://www.cocopedia.com/wiki/index.php?title=SysCall.asm_Level_1&amp;diff=7455&amp;oldid=prev</id>
		<title>Polluks: Categories</title>
		<link rel="alternate" type="text/html" href="https://www.cocopedia.com/wiki/index.php?title=SysCall.asm_Level_1&amp;diff=7455&amp;oldid=prev"/>
		<updated>2015-09-11T11:20:14Z</updated>

		<summary type="html">&lt;p&gt;Categories&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 07:20, 11 September 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l103&quot;&gt;Line 103:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 103:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;            emod&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;            emod&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  SyCalEnd equ   *&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  SyCalEnd equ   *&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Programming]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:OS-9]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Polluks</name></author>
	</entry>
	<entry>
		<id>https://www.cocopedia.com/wiki/index.php?title=SysCall.asm_Level_1&amp;diff=6606&amp;oldid=prev</id>
		<title>Wayne: Created page with &quot; ***************************************  * SYSCALL - a powerful subroutine for use with Basic09  * A special thanks to Robert Doggett for writing this routine.  *  * Basic09 ...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.cocopedia.com/wiki/index.php?title=SysCall.asm_Level_1&amp;diff=6606&amp;oldid=prev"/>
		<updated>2013-11-29T20:43:15Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot; ***************************************  * SYSCALL - a powerful subroutine for use with Basic09  * A special thanks to Robert Doggett for writing this routine.  *  * Basic09 ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt; ***************************************&lt;br /&gt;
 * SYSCALL - a powerful subroutine for use with Basic09&lt;br /&gt;
 * A special thanks to Robert Doggett for writing this routine.&lt;br /&gt;
 *&lt;br /&gt;
 * Basic09 calling suquence:&lt;br /&gt;
 * TYPE Registers=CC,A,B,DP:BYTE; X,Y,U:INTEGER&lt;br /&gt;
 * DIM regs:Registers&lt;br /&gt;
 *&lt;br /&gt;
 * There is no DIM statement for code, which must be a BYTE or INTEGER value,&lt;br /&gt;
 * and a non-DIM&amp;#039;d variable in Basic09 is either a type REAL or, with a $ as the&lt;br /&gt;
 * last character of the name, a 32-character STRING.&lt;br /&gt;
 * DIM code:BYTE&lt;br /&gt;
 *&lt;br /&gt;
 * RUN SysCall(code,registers)&lt;br /&gt;
 *&lt;br /&gt;
 * SysCall will allow you to execute ANY OS-9 System call from&lt;br /&gt;
 * your Basic09 programs. BE WARNED!!! SysCall can be VERY&lt;br /&gt;
 * dangerous, since it permits you to do things you may not want&lt;br /&gt;
 * done during program execution (like format disks, write&lt;br /&gt;
 * thousands of bytea all at once, and so on). However, it can&lt;br /&gt;
 * also be very useful, IF you know what you are doing.&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: This version of SysCall will cause a Basic09 runtime&lt;br /&gt;
 * error to occur if your system call returns an error. This can&lt;br /&gt;
 * be easily overcome, as noted below. If you do this, you&lt;br /&gt;
 * must check &amp;quot;regs.CC&amp;quot; to see if a system error has occurred.&lt;br /&gt;
 *&lt;br /&gt;
 * Here is an example of one possible use you may have for SysCall&lt;br /&gt;
 *&lt;br /&gt;
 * PROCEDURE filesize&lt;br /&gt;
 * TYPE Registers=CC,A,B,DP:BYTE; X,Y,U:INTEGER&lt;br /&gt;
 * DIM regs:Registers&lt;br /&gt;
 * DIM path,callcode:BYTE \(* or INTEGER *)&lt;br /&gt;
 * OPEN #path,&amp;quot;test&amp;quot;:READ&lt;br /&gt;
 * regs.A:=path&lt;br /&gt;
 * regs.B:=2 \(* I$GetStt code *)&lt;br /&gt;
 * RUN SysCall(callcode,regs)&lt;br /&gt;
 * CLOSE #path&lt;br /&gt;
 * PRINT USING &amp;quot;filesize = 0&amp;#039;,2(h4)&amp;quot;,regs.X; regs.U&lt;br /&gt;
 &lt;br /&gt;
           USE  /d0/defs/os9defs&lt;br /&gt;
           opt  1&lt;br /&gt;
 &lt;br /&gt;
 TYPE      set  SBRTN+ONJCT&lt;br /&gt;
 REVS      set  REENT+1&lt;br /&gt;
           mod  SyCalEnd,SyCalNam,TYPE,REVS,SyCalEnt,0&lt;br /&gt;
 SyCalNam  fcs  &amp;quot;SysCall&amp;quot;&lt;br /&gt;
           fcb  2             edition number&lt;br /&gt;
 &lt;br /&gt;
 E$Paras   equ  56 Basic09&amp;#039;s  parameter error code&lt;br /&gt;
 M.OS9     equ  $103F         OS-9 system call machine code&lt;br /&gt;
 M.RTS     equ  $39           rts machine code&lt;br /&gt;
 &lt;br /&gt;
           org  0             stacked variable&lt;br /&gt;
 Return    rmb  2             Return address&lt;br /&gt;
 PCount    rmb  2             number of params passed&lt;br /&gt;
 Function  rmb  4             OS-9 function code&lt;br /&gt;
 Regs      rmb  4             Register image&lt;br /&gt;
 &lt;br /&gt;
 SyCalEnt  ldd  PCount,s      Get parameter count&lt;br /&gt;
           cmpd #2 exactly    2 parameters?&lt;br /&gt;
           bne  ParamErr      abort if not&lt;br /&gt;
           ldd  Regs+2,s      check size of register image&lt;br /&gt;
           cmpd #10exactly    10 bytes?&lt;br /&gt;
           bne  ParamErr      abort if not&lt;br /&gt;
           ldd  [Function,S]  get os-9 function code&lt;br /&gt;
           ldx  Function+2,S  get size of function param&lt;br /&gt;
           leax -1,XINTEGER?&lt;br /&gt;
           bne  ParamErr      abort if not&lt;br /&gt;
           tfr  B,A&lt;br /&gt;
 &lt;br /&gt;
 * Now you build your OS9 call and return from subroutine on&lt;br /&gt;
 * stack (A)=OS9 function call&lt;br /&gt;
 &lt;br /&gt;
 SysCall   ldb  #M.RTS        get &amp;quot;rts&amp;quot; machine code&lt;br /&gt;
           pshs D&lt;br /&gt;
           ldd  #M.OS9        get OS-9 machine code&lt;br /&gt;
           pshs D&lt;br /&gt;
           ldu  Regs+4,S      get register image ptr&lt;br /&gt;
           ldd  R$D,U         initialize regs for system call&lt;br /&gt;
           ldx  R$X,U&lt;br /&gt;
           ldy  R$Y,U&lt;br /&gt;
           ldu  R$U,U&lt;br /&gt;
           jsr  0,S           execute system call&lt;br /&gt;
           pshs CC,Usave CC,U&lt;br /&gt;
           ldu  Regs+7,S&lt;br /&gt;
           leau R$U,U&lt;br /&gt;
           pshu A,B,DP,X,Y    return unpdatd regs to caller&lt;br /&gt;
           puls A,X get CC,U&lt;br /&gt;
           sta  ,-U&lt;br /&gt;
           stx  R$U,U&lt;br /&gt;
           leas 4,S           discard OS-9 call subroutine&lt;br /&gt;
 &lt;br /&gt;
 * If you want to eliminate the possibility of a runtime error&lt;br /&gt;
 * remove the comment designator (*) from the next line&lt;br /&gt;
 &lt;br /&gt;
 * clrb&lt;br /&gt;
           rts&lt;br /&gt;
 ParamErr  comb               return carry set&lt;br /&gt;
           ldb  #E$Param      Parameter error&lt;br /&gt;
           rts&lt;br /&gt;
 &lt;br /&gt;
           emod&lt;br /&gt;
 SyCalEnd equ   *&lt;/div&gt;</summary>
		<author><name>Wayne</name></author>
	</entry>
</feed>