1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
#if 0
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/io.h>
#include <fcntl.h>
#include <unistd.h>
#endif
#include <stdio.h>
#include <dos.h>
// gcc -O
// important because of inb, outb
/*
dumps data sent form sharp pc1401 into file
at sharp the following program must be started after
this dos program was started
simple dos utility
first arg (filename of file to be written) must be specified
ct eprop needed
changing to parallel port should be easy
nearly all sharp pocket pc's system roms should be readable
this way.
for some early pocket pc's it would be neccessary to load
this program into memory.
(they don't have poke/peek/call instructions,
so this program can't be typed in)
adapter sharp - cteprommer
1
2 6v
3 gnd 8 bit textool gnd pin 20
4 f0 data--> 8 bit textool data 0 pin 17
5 f1 handshake --> 8 bit textool data 1 pin 18
6 save
7 load
8 ib7 <--handshake 8 bit textool adress 0 pin 16
9 ib9
10
11
problems with the handshake in at the sharp
so I didn't use the handshake in the sharp side
but the pc side must not be interrupted with interrupt
(pure dos needed?)
*/
#define outb(v,adr) outportb(adr,v)
#define inb(adr) inportb(adr)
#if 0
/* this routine dump the memory (start 0)
in an endless loop,
the pc side must be started before this
actual version should be in mess/machine/pocketc.c
*/
1 restore: for i=16384 to 16455:read a: poke i,a: next i
10 call 16384
100 data
#if 1
18,4,//lip xl
2,0,//lia 0 startaddress low
219,//exam
18,5,//lip xh
2,0,//lia 0 startaddress high
219,//exam
//400f x:
// dump internal rom
18,5,//lip 4
89,//ldm
218,//exab
18,4,//lip 5
89,//ldm
4,//ix for increasing x
0,0,//lii,0
18,20,//lip 20
53, //
18,20,// lip 20
219,//exam
#else
18,4,//lip xl
2,255,//lia 0
219,//exam
18,5,//lip xh
2,255,//lia 0
219,//exam
//400f x:
// dump external memory
4, //ix
87,// ldd
#endif
218,//exab
0,4,//lii 4
//a:
218,// exab
90,// sl
218,// exab
18,94,// lip 94
96,252,// anma 252
2,2, //lia 2
196,// adcm
95,// outf
//b:
204,//inb
102,128,//tsia 0x80
#if 0
41,4,// jnzm b
#else
// input not working reliable!
// so handshake removed, PC side must run with disabled
// interrupt to not lose data
78,20, //wait 20
#endif
218,// exab
90,// sl
218,// exab
18,94,// lip 94
96,252,//anma 252
2,0,// lia 0
196,//adcm
95,// outf
//c:
204,//inb
102,128,//tsia 0x80
#if 0
57,4,// jzm c
#else
78,20, //wait 20
#endif
65,//deci
41,34,//jnzm a
41,41,//jnzm x:
55,// rtn
// fill up with several 55
// so you don't have to calculate the exact end in the loop
#endif
#define PORT_BASE 0x3e0
int main(int argc, char *argv[])
{
unsigned i,v,j,a;
char buffer[32768];
FILE *out=fopen(argv[1],"wb");
#if 0
ioperm(PORT_BASE,8,1);
nice(-256);
#endif
asm { cli }
outb(0x18,PORT_BASE+3); // VCC ON
outb(0xc0, PORT_BASE+2);
outb(7,PORT_BASE+6); // VPP 12.5, reset off
outb(0,PORT_BASE);
for(j=0;j<0x8000;j++) {
for (i=0,v=0;i<4;i++) {
for(;((a=inb(PORT_BASE+4))&2)==0; ) ;
v=(v<<1)|(a&1);
outb(1,PORT_BASE);
for(;((a=inb(PORT_BASE+4))&2)!=0; ) ;
v=(v<<1)|(a&1);
outb(0,PORT_BASE);
}
buffer[j]=v;
// printf("%.2x\n",v);
}
asm { sti }
fwrite(buffer,2,0x4000,out);
fclose(out);
#if 0
outb(8,PORT_BASE+2); // led off
outb(0,PORT_BASE+3); //VCC off
outb(0,PORT_BASE+6); //VPP off
#endif
return 0;
}
|