Example program for the Cidco MailStation Z80 computer
1# MailStation Example Program
2
3This is an example program to get you started writing code for the
4[Cidco MailStation](https://jcs.org/2019/05/03/mailstation)
5Z80 computer.
6
7The code in `lib/` sets up the C run-time (`crt0`) and gives you a `putchar`
8routine that draws on the screen with a 5x8 font.
9
10`main()` prints "Hello, World" and then loops forever echoing any keys typed on
11the keyboard out to the screen.
12This is where your code should go to do something more useful.
13
14## Building
15
16Install
17[SDCC](http://sdcc.sourceforge.net/),
18Ruby,
19and if on a non-BSD platform, a BSD Make (bmake).
20
21Once installed, issue `make` (or `bmake`):
22
23 $ make obj
24 $ make
25
26This will produce a file `obj/hello.bin` for uploading to the MailStation.
27
28By default, the linker sets up the program to be running from RAM (loaded via
29[WSLoader](https://jcs.org/wifistation/loader)) at `0x4000`.
30If loading to Data Flash, set `LOC` to `flash` (and clean first):
31
32 $ make LOC=flash clean all
33
34## Running
35
36Run Loader/WSLoader on the MailStation and then upload `obj/hello.bin` to it
37via a parallel LapLink cable or a
38[WiFiStation](https://jcs.org/wifistation).
39
40## Extending
41
42If your code extends beyond `main.c`, add your source `.c` files to the `SRCS`
43variable in `Makefile`, and any assembly files to `ASM_SRCS`.
44
45You'll probably also want to change the `PROG` variable to be something
46meaningful.
47
48## License (ISC)
49
50Copyright (c) 2019-2021 joshua stein <jcs@jcs.org>
51
52Permission to use, copy, modify, and distribute this software for any
53purpose with or without fee is hereby granted, provided that the above
54copyright notice and this permission notice appear in all copies.
55
56THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
57WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
58MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
59ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
60WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
61ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
62OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.