Home » Archimedes archive » Acorn User » AU 1997-05 B.adf » Regulars » StarInfo/clouds/Brown/c/sat

StarInfo/clouds/Brown/c/sat

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1997-05 B.adf » Regulars
Filename: StarInfo/clouds/Brown/c/sat
Read OK:
File size: 01E0 bytes
Load address: 0000
Exec address: 0000
File contents
#include "kernel.h"
#include "swis.h"
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include "sat.h"

satinfo sat_data;

void sat_initialise(void)
{
  sat_data.screenbase=sat_getscreenbase();
  sat_data.screenbuffer=1;
}


void vdustr(int a, ...)
{
  va_list ap;
  int b=0;

  writec(a);

  va_start(ap, a);
  while ((b=va_arg(ap, int))!=-1) writec(b);
  va_end(ap);
}

void writec(int n)
{
  _kernel_swi_regs in;
    in.r[0]=n;
  _kernel_swi(OS_WriteC, &in, &in);
}
00000000  23 69 6e 63 6c 75 64 65  20 22 6b 65 72 6e 65 6c  |#include "kernel|
00000010  2e 68 22 0a 23 69 6e 63  6c 75 64 65 20 22 73 77  |.h".#include "sw|
00000020  69 73 2e 68 22 0a 23 69  6e 63 6c 75 64 65 20 3c  |is.h".#include <|
00000030  73 74 64 6c 69 62 2e 68  3e 0a 23 69 6e 63 6c 75  |stdlib.h>.#inclu|
00000040  64 65 20 3c 73 74 64 61  72 67 2e 68 3e 0a 23 69  |de <stdarg.h>.#i|
00000050  6e 63 6c 75 64 65 20 3c  73 74 64 69 6f 2e 68 3e  |nclude <stdio.h>|
00000060  0a 23 69 6e 63 6c 75 64  65 20 22 73 61 74 2e 68  |.#include "sat.h|
00000070  22 0a 0a 73 61 74 69 6e  66 6f 20 73 61 74 5f 64  |"..satinfo sat_d|
00000080  61 74 61 3b 0a 0a 76 6f  69 64 20 73 61 74 5f 69  |ata;..void sat_i|
00000090  6e 69 74 69 61 6c 69 73  65 28 76 6f 69 64 29 0a  |nitialise(void).|
000000a0  7b 0a 20 20 73 61 74 5f  64 61 74 61 2e 73 63 72  |{.  sat_data.scr|
000000b0  65 65 6e 62 61 73 65 3d  73 61 74 5f 67 65 74 73  |eenbase=sat_gets|
000000c0  63 72 65 65 6e 62 61 73  65 28 29 3b 0a 20 20 73  |creenbase();.  s|
000000d0  61 74 5f 64 61 74 61 2e  73 63 72 65 65 6e 62 75  |at_data.screenbu|
000000e0  66 66 65 72 3d 31 3b 0a  7d 0a 0a 0a 76 6f 69 64  |ffer=1;.}...void|
000000f0  20 76 64 75 73 74 72 28  69 6e 74 20 61 2c 20 2e  | vdustr(int a, .|
00000100  2e 2e 29 0a 7b 0a 20 20  76 61 5f 6c 69 73 74 20  |..).{.  va_list |
00000110  61 70 3b 0a 20 20 69 6e  74 20 62 3d 30 3b 0a 0a  |ap;.  int b=0;..|
00000120  20 20 77 72 69 74 65 63  28 61 29 3b 0a 0a 20 20  |  writec(a);..  |
00000130  76 61 5f 73 74 61 72 74  28 61 70 2c 20 61 29 3b  |va_start(ap, a);|
00000140  0a 20 20 77 68 69 6c 65  20 28 28 62 3d 76 61 5f  |.  while ((b=va_|
00000150  61 72 67 28 61 70 2c 20  69 6e 74 29 29 21 3d 2d  |arg(ap, int))!=-|
00000160  31 29 20 77 72 69 74 65  63 28 62 29 3b 0a 20 20  |1) writec(b);.  |
00000170  76 61 5f 65 6e 64 28 61  70 29 3b 0a 7d 0a 0a 76  |va_end(ap);.}..v|
00000180  6f 69 64 20 77 72 69 74  65 63 28 69 6e 74 20 6e  |oid writec(int n|
00000190  29 0a 7b 0a 20 20 5f 6b  65 72 6e 65 6c 5f 73 77  |).{.  _kernel_sw|
000001a0  69 5f 72 65 67 73 20 69  6e 3b 0a 20 20 20 20 69  |i_regs in;.    i|
000001b0  6e 2e 72 5b 30 5d 3d 6e  3b 0a 20 20 5f 6b 65 72  |n.r[0]=n;.  _ker|
000001c0  6e 65 6c 5f 73 77 69 28  4f 53 5f 57 72 69 74 65  |nel_swi(OS_Write|
000001d0  43 2c 20 26 69 6e 2c 20  26 69 6e 29 3b 0a 7d 0a  |C, &in, &in);.}.|
000001e0