Tools for working with Cidco Mailstations
at master 95 lines 2.1 kB view raw
1; 2; Based off of spew.asm from Cyrano Jones on the mailstation Yahoo Group, 3; modified to send the 512kb of dataflash instead of 1mb of codeflash. 4; 5; Originally written to be assembled with AS80, converted to SDCC ASZ80 syntax. 6; 7 8 .module datadump 9 10 .area _DATA 11 .area _HEADER (ABS) 12 .org 0x4000 ; This is *always* #4000, regardless of 13 ; what page you use. 14 15 jp eventhandler 16 17 .dw (icons) ; icon location (in this page) 18 .dw (caption) 19 .dw (dunno) 20dunno: 21 .db #0 22xpos: 23 .dw #0 24ypos: 25 .dw #0 26caption: 27 .dw #0x0001 ; ????? 28 .dw (endcap - caption - 6) ; end of chars 29 .dw #0x0006 ; offset to first char 30 .ascii "Data Dump" ; the caption string 31endcap: 32 33icons: 34 .dw #0 ; size icon0 35 .dw (icon0 - icons) ; offset to icon0 36 .dw #0 ; size icon1 37 .dw (icon1 - icons) ; offset to icon1 (0x00b5) 38icon0: 39 .dw #0 ; icon width 40 .db #0 ; icon height 41icon1: 42 .dw #0 ; icon width 43 .db #0 ; icon height 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 ld bc, #0x2000 ; b=count=32 pages, c=currentpage=0 60 61pgloop: 62 ld hl, #0x8000 ; start at begining of each page 63 64byteloop: 65 ld a, #03 ; set slot8000device = dataflash 66 out (8), a 67 68 ld a, c ; set slot8000page to currentpage 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, #00 ; set slot8000device = codeflash 79 out (8), a 80 ld a, #1 ; bank bsendbyte into slot8000 81 out (7), a 82 call bsendbyte ; send byte(H) 83 84 pop bc 85 pop hl 86 87 inc hl ; i++ (next byte) 88 ld a, h 89 cp #0xC0 90 jr nz, byteloop ; jump if i < #C000 91 92 inc c ; currentpage++ (next page) 93 djnz pgloop 94 95 jp done