Example program for the Cidco MailStation Z80 computer
1; vim:syntax=z8a:ts=8:sw=8
2;
3; MailStation example program
4; Copyright (c) 2019-2021 joshua stein <jcs@jcs.org>
5;
6; Permission to use, copy, modify, and distribute this software for any
7; purpose with or without fee is hereby granted, provided that the above
8; copyright notice and this permission notice appear in all copies.
9;
10; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17;
18
19 ; these are defined in addrs-*, either of which is linked into the
20 ; build based on where we're running from
21 .globl RUN_ADDR
22 .globl RUN_DEVICE
23 .globl RUN_PAGE
24 .globl SLOT_ADDR
25 .globl SLOT_DEVICE
26 .globl SLOT_PAGE
27
28 ; per-firmware version port shadow variables
29 .globl p2shadow
30 .globl p3shadow
31 .globl p28shadow
32
33 ; functions
34 .equ get_keycode_from_buffer,#0x0a9a
35 .equ lcd_buf_to_screen, #0x2473
36
37 ; lcd bit storage buffer, copied with lcd_buf_to_screen
38 .equ lcd_buf, #0xc010
39 .equ lcd_buf_end, #lcd_buf + ((LCD_WIDTH * LCD_HEIGHT) / 8) - 1
40
41 .equ LCD_WIDTH, #160 * 2 ; 320
42 .equ LCD_HEIGHT, #128
43 .equ LCD_COL_GROUPS, #20
44 .equ LCD_COL_GROUP_WIDTH, #8
45 .equ FONT_WIDTH, #5
46 .equ FONT_HEIGHT, #8
47 .equ LCD_COLS, #LCD_WIDTH / FONT_WIDTH ; 64
48 .equ LCD_ROWS, #LCD_HEIGHT / FONT_HEIGHT ; 16
49 .equ TEXT_ROWS, #LCD_ROWS - 1 ; 15
50
51 .equ DEVICE_RAM, #0x01
52 .equ DEVICE_LCD_LEFT, #0x02
53 .equ DEVICE_DATAFLASH, #0x03
54 .equ DEVICE_LCD_RIGHT, #0x04
55 .equ DEVICE_MODEM, #0x05
56
57 ; addressing the LCD once it's loaded in SLOT_ADDR
58 .equ LCD_START, #SLOT_ADDR + 0x0038
59
60 .equ ATTR_BIT_CURSOR, #0
61 .equ ATTR_BIT_REVERSE, #1
62 .equ ATTR_BIT_BOLD, #2
63 .equ ATTR_BIT_UNDERLINE, #3
64
65 .equ ATTR_CURSOR, #(1 << ATTR_CURSOR)
66 .equ ATTR_REVERSE, #(1 << ATTR_REVERSE)
67 .equ ATTR_BOLD, #(1 << ATTR_BOLD)
68 .equ ATTR_UNDERLINE, #(1 << ATTR_UNDERLINE)
69
70 .globl _saved_cursorx
71 .globl _saved_cursory
72 .globl _delay
73
74 ; debug variables
75 .globl _debug0
76 .globl _debug1
77 .globl _debug2
78 .globl _debug3
79 .globl _debug4