Tools for working with Cidco Mailstations

add Mem Dump

+135 -14
+13 -2
Makefile
··· 24 24 .endif 25 25 .endif 26 26 27 - all: objdir loader.bin codedump.bin datadump.bin recvdump sendload tribble_getty 27 + all: objdir loader.bin codedump.bin datadump.bin memdump.bin \ 28 + recvdump sendload tribble_getty 28 29 29 30 objdir: 30 31 @mkdir -p ${OBJ} 31 32 32 33 clean: 33 - rm -f *.{map,bin,ihx,lst,rel,sym,lk,noi} recvdump sendload tribble_getty 34 + rm -f *.{map,bin,ihx,lst,rel,sym,lk,noi} recvdump sendload \ 35 + tribble_getty 34 36 35 37 # parallel loader 36 38 loader.rel: loader.asm ··· 60 62 $(SDCC) --no-std-crt0 -o $@ $> 61 63 62 64 datadump.bin: datadump.ihx 65 + hex2bin $> >/dev/null 66 + 67 + memdump.rel: memdump.asm 68 + $(ASZ80) -o $@ $> 69 + 70 + memdump.ihx: memdump.rel 71 + $(SDCC) --no-std-crt0 -o $@ $> 72 + 73 + memdump.bin: memdump.ihx 63 74 hex2bin $> >/dev/null 64 75 65 76 # datadump/codedump receiver
+14
README.md
··· 98 98 its progress as it reads the transmitted data and saves it to `dataflash.bin`. 99 99 You may want to run it twice and compare checksums of the two resulting files. 100 100 101 + ### `memdump.asm` 102 + 103 + Mem Dump is used to read the contents of the current 64Kb of memory. 104 + It does not read additional pages of memory but shows the current layout of 105 + code page 0, the slot `0x4000` and `0x8000` devices, and page 0 of RAM. 106 + 107 + You need to type the hex values of `z80/memdump.bin` into one of the 108 + application slots as detailed above. 109 + 110 + Run `obj/recvdump -mem` to wait for the memory dump to begin. 111 + 112 + Then run the new Mem Dump app on the Mailstation and `recvdump` should show 113 + its progress as it reads the transmitted data and saves it to `mem.bin`. 114 + 101 115 ### Extracting programs from `dataflash` dumps 102 116 103 117 While most of the core functionality of the Mailstation lives on the codeflash
+82
memdump.asm
··· 1 + ; 2 + ; Based off of spew.asm from Cyrano Jones on the mailstation Yahoo Group, 3 + ; modified to send 64kb of memory. 4 + ; 5 + ; Originally written to be assembled with AS80, converted to SDCC ASZ80 syntax. 6 + ; 7 + 8 + .module memdump 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) 20 + dunno: 21 + .db #0 22 + xpos: 23 + .dw #0 24 + ypos: 25 + .dw #0 26 + caption: 27 + .dw #0x0001 ; ????? 28 + .dw (endcap - caption - 6) ; end of chars 29 + .dw #0x0006 ; offset to first char 30 + .ascii "Mem Dump" ; the caption string 31 + endcap: 32 + 33 + icons: 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) 38 + icon0: 39 + .dw #0 ; icon width 40 + .db #0 ; icon height 41 + icon1: 42 + .dw #0 ; icon width 43 + .db #0 ; icon height 44 + 45 + 46 + .equ bsendbyte, #0x802D ; raises busy & sends byte. 47 + ; We use the existing sendbyte from 48 + ; original update code. This means 49 + ; codeflash page #01 needs to be banked 50 + ; in to slot8000 before calling bsendbyte. 51 + 52 + .equ done, #0x0000 ; Gotta go somewhere when done, we reboot. 53 + ; Mailstation will call eventhandler 3 54 + ; or 4 times when you select the new 55 + ; application, and we only want to exec 56 + ; once, so we do not return at end, we 57 + ; reboot after first "event". 58 + 59 + eventhandler: 60 + ld a, #0 ; set slot8000device = codeflash 61 + out (8), a 62 + ld a, #1 ; bank bsendbyte into slot8000 63 + out (7), a 64 + 65 + ld de, #0x0000 66 + byteloop: 67 + ld a, (de) 68 + ld h, a 69 + push de 70 + call bsendbyte ; send byte(H) 71 + pop de 72 + 73 + ld a, d 74 + cp #0xff 75 + jr nz, incde 76 + ld a, e 77 + cp #0xff 78 + jr nz, incde 79 + jp done 80 + incde: 81 + inc de 82 + jr byteloop
+26 -12
util/recvdump.c
··· 2 2 * recvdump 3 3 * based on win32/maildump.cpp by FyberOptic 4 4 * 5 - * usage: recvdump [-data | -code] 5 + * usage: recvdump [-data | -code | -mem] 6 6 * 7 7 * must be run as root to set iopl and use inb/outb 8 8 * ··· 20 20 21 21 #include "tribble.h" 22 22 23 + void 24 + usage(void) 25 + { 26 + printf("usage: %s [-code | -data | -mem]\n", getprogname()); 27 + exit(1); 28 + } 29 + 23 30 int 24 31 main(int argc, char *argv[]) 25 32 { 26 33 FILE *pFile; 27 34 unsigned int received = 0, expected = 0; 28 - unsigned char b; 35 + int b; 29 36 char fn[14]; 30 - int codeflash = 0, dataflash = 0; 37 + int codeflash = 0, dataflash = 0, mem = 0; 31 38 int x; 32 39 33 40 for (x = 1; x < argc; x++) { 34 - if (strncmp((char *)argv[x], "-code", 5) == 0) 41 + if (strncmp((char *)argv[x], "-code", 5) == 0) { 42 + if (dataflash || mem) 43 + usage(); 35 44 codeflash = 1; 36 - else if (strncmp((char *)argv[x], "-data", 5) == 0) 45 + } else if (strncmp((char *)argv[x], "-data", 5) == 0) { 46 + if (codeflash || mem) 47 + usage(); 37 48 dataflash = 1; 38 - else 49 + } else if (strncmp((char *)argv[x], "-mem", 4) == 0) { 50 + if (codeflash || dataflash) 51 + usage(); 52 + mem = 1; 53 + } else 39 54 printf("unknown parameter: %s\n", argv[x]); 40 55 } 41 56 42 - if (codeflash == dataflash) { 43 - printf("usage: %s [-code | -data]\n", argv[0]); 44 - return 1; 45 - } 46 - 47 57 if (codeflash) { 48 58 expected = 1024 * 1024; 49 59 strlcpy(fn, "codeflash.bin", sizeof(fn)); 50 60 } else if (dataflash) { 51 61 expected = 1024 * 512; 52 62 strlcpy(fn, "dataflash.bin", sizeof(fn)); 53 - } 63 + } else if (mem) { 64 + expected = (1024 * 64) - 1; 65 + strlcpy(fn, "mem.bin", sizeof(fn)); 66 + } else 67 + usage(); 54 68 55 69 if (geteuid() != 0) 56 70 errx(1, "must be run as root");