Terminal program for MailStation devices
1; vim:syntax=z8a:ts=8:sw=8
2
3 .equ VERSION, #0x4
4
5 ; these are defined in addrs-*, either of which is linked into the
6 ; build based on where we're running from
7 .globl RUN_ADDR
8 .globl RUN_DEVICE
9 .globl RUN_PAGE
10 .globl SLOT_ADDR
11 .globl SLOT_DEVICE
12 .globl SLOT_PAGE
13
14 ; per-firmware version port shadow variables
15 .globl p2shadow
16 .globl p3shadow
17 .globl p28shadow
18
19 ; functions
20 .equ get_keycode_from_buffer,#0x0a9a
21 .equ lcd_buf_to_screen, #0x2473
22
23 ; lcd bit storage buffer, copied with lcd_buf_to_screen
24 .equ lcd_buf, #0xc010
25 .equ lcd_buf_end, #lcd_buf + ((LCD_WIDTH * LCD_HEIGHT) / 8) - 1
26
27 ; circular char[] buffer offset by *_modem_buf_pos
28 .equ _modem_buf, #0xf600
29 .equ _modem_buf_pos, #0xf700
30 .equ _modem_buf_read_pos, #0xf702
31
32 .equ _obuf, #0xf500
33 .equ _obuf_pos, #0xf704
34
35 ; some random dataflash location (0x18000) that looked empty
36 .equ settings_page, #6
37 .equ settings_sector, #0 ; sectors are 256 bytes
38
39 ; some constants from mailstion.h
40 .equ LCD_WIDTH, #160 * 2 ; 320
41 .equ LCD_HEIGHT, #128
42 .equ LCD_COL_GROUPS, #20
43 .equ LCD_COL_GROUP_WIDTH, #8
44 .equ FONT_WIDTH, #5
45 .equ FONT_HEIGHT, #8
46 .equ LCD_COLS, #LCD_WIDTH / FONT_WIDTH ; 64
47 .equ LCD_ROWS, #LCD_HEIGHT / FONT_HEIGHT ; 16
48 .equ TEXT_ROWS, #LCD_ROWS - 1 ; 15
49
50 .equ DEVICE_RAM, #0x01
51 .equ DEVICE_LCD_LEFT, #0x02
52 .equ DEVICE_DATAFLASH, #0x03
53 .equ DEVICE_LCD_RIGHT, #0x04
54 .equ DEVICE_MODEM, #0x05
55
56 ; addressing the LCD once it's loaded in SLOT_ADDR
57 .equ LCD_START, #SLOT_ADDR + 0x0038
58
59 .equ ATTR_BIT_CURSOR, #0
60 .equ ATTR_BIT_REVERSE, #1
61 .equ ATTR_BIT_BOLD, #2
62 .equ ATTR_BIT_UNDERLINE, #3
63
64 .equ ATTR_CURSOR, #(1 << ATTR_CURSOR)
65 .equ ATTR_REVERSE, #(1 << ATTR_REVERSE)
66 .equ ATTR_BOLD, #(1 << ATTR_BOLD)
67 .equ ATTR_UNDERLINE, #(1 << ATTR_UNDERLINE)
68
69 .equ MODEM_DEFAULT_SPEED, #14400
70 .equ ESC, #0x1b
71 .equ XON, #0x11
72 .equ XOFF, #0x13
73
74 ; be sure to keep these in sync with mailstation.h
75 .equ SOURCE_WIFI, #0
76 .equ SOURCE_MODEM, #1
77 .equ SOURCE_LPT, #2
78 .equ SOURCE_ECHO, #3
79 .equ SOURCE_LAST, #4
80
81 .globl _saved_cursorx
82 .globl _saved_cursory
83 .globl _delay
84
85 ; settings
86 .globl _setting_modem_speed
87 .globl _setting_default_source
88
89 .globl _modem_buf
90 .globl _modem_buf_pos
91 .globl _modem_buf_read_pos
92 .globl _modem_curmsr
93 .globl _modem_flowing
94
95 .globl _obuf
96 .globl _obuf_pos
97
98 ; debug variables
99 .globl _debug0
100 .globl _debug1