Tools for working with Cidco Mailstations
1;
2; Based off of spew.asm from Cyrano Jones on the mailstation Yahoo Group.
3;
4; Originally written to be assembled with AS80, converted to SDCC ASZ80 syntax.
5;
6
7 .module codedump
8
9 .area _DATA
10 .area _HEADER (ABS)
11 .org 0x4000 ; This is *always* #4000, regardless of
12 ; what page you use.
13
14 jp eventhandler
15
16 .dw (icons) ; icon location (in this page)
17 .dw (caption)
18 .dw (dunno)
19dunno:
20 .db #0
21xpos:
22 .dw #0
23ypos:
24 .dw #0
25caption:
26 .dw #0x0001 ; ?????
27 .dw (endcap - caption - 6) ; end of chars
28 .dw #0x0006 ; offset to first char
29 .ascii "Code Dump" ; the caption string
30endcap:
31
32icons:
33 .dw #0 ; size icon0
34 .dw (icon0 - icons) ; offset to icon0
35 .dw #0 ; size icon1
36 .dw (icon1 - icons) ; offset to icon1 (0x00b5)
37icon0:
38 .dw #0 ; icon width
39 .db #0 ; icon height
40icon1:
41 .dw #0 ; icon width
42 .db #0 ; icon height
43
44
45 .equ bsendbyte, #0x802D ; raises busy & sends byte.
46 ; We use the existing sendbyte from
47 ; original update code. This means
48 ; codeflash page #01 needs to be banked
49 ; in to slot8000 before calling bsendbyte.
50
51 .equ done, #0x0000 ; Gotta go somewhere when done, we reboot.
52 ; Mailstation will call eventhandler 3
53 ; or 4 times when you select the new
54 ; application, and we only want to exec
55 ; once, so we do not return at end, we
56 ; reboot after first "event".
57
58eventhandler:
59 xor a ; set slot8000device = codeflash (0)
60 out (8), a
61
62 ld bc, #0x4000 ; b=count=64 pages, c=currentpage=0
63
64pgloop:
65 ld hl, #0x8000 ; start at begining of each page
66
67byteloop:
68 ld a, c ; bank currentpage into slot8000
69 out (7), a
70
71 ld a, (hl) ; get byte[i]
72
73 push hl
74 push bc
75
76 ld h, a ; h is byte
77
78 ld a, #1 ; bank bsendbyte into slot8000
79 out (7), a
80 call bsendbyte ; send byte(H)
81
82 pop bc
83 pop hl
84
85 inc hl ; i++ (next byte)
86 ld a, h
87 cp #0xC0
88 jr nz, byteloop ; jump if i < #C000
89
90 inc c ; currentpage++ (next page)
91 djnz pgloop
92
93 jp done