-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhowto.txt
188 lines (134 loc) · 3.86 KB
/
howto.txt
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
How to install
am9511 is meant to be installed into an emulator. Here, we integrate
am9511 into Zxcc and RunCPM.
Integrating into Zxcc
=====================
We use zxcc here as an example:
https://www.seasip.info/Unix/Zxcc/
I use zxcc to cross compile HI-TECH C, and do "light testing".
zxcc will run mbasic
: fred@tara bin $; zxcc mbasic
BASIC-80 Rev. 5.21
[CP/M Version]
Copyright 1977-1981 (C) by Microsoft
Created: 28-Jul-81
39480 Bytes free
Ok
and I want to use MBASIC as a test harness. So, zxcc becomes the
first target. First, download and build zxcc, and make sure that
it works.
In directory zxcc-0.5.7/bin
Add files
am9511.c
am9511.h
ansi.h
floatcnv.c
flaatcnv.h
ova.c
ova.h
types.h
from the am9511 project.
Modify the Makefile:
- add "-lm" to LIBS
- add "am9511.$(OBJEXT) ova.$(OBJEXT) floatcnv.$(OBJEXT)" to
am_zxcc_OBJECTS
- add -I. to CPPFLAGS (? may not be needed)
Edit zxcc.c
Replace:
unsigned int in() { return 0; }
unsigned int out() { return 0; }
with
/* support AM9511
*
* The interface is very simple -- if interrupts are not used.
*
* Note the values for AM_STATUS and AM_DATA are to support
* rc2014 (planeta.com)
*/
void *am9511 = NULL;
#define AM_STATUS 0x43
#define AM_DATA 0x42
unsigned int in(tstates,a,v) {
unsigned int r = 0;
if (am9511 == NULL)
am9511 = am_create(AM_STATUS, AM_DATA);
if (v == AM_DATA)
r = am_pop(am9511);
else if (v == AM_STATUS)
r = am_status(am9511);
return r;
}
unsigned int out(tstates,a,v,a2) {
if (am9511 == NULL)
am9511 = am_create(AM_STATUS, AM_DATA);
if (v == AM_DATA)
am_push(am9511, a2);
else if (v == AM_STATUS)
am_command(am_9511, a2);
return 0;
}
And, add
#include "am9511.h"
to the top of the file
"make" and "make install"
Now, zxcc should have the AM9511 emulator, as ports 66 and 67.
See AM9511.BAS for an MBASIC program that is the start of a test.
As am9511 matures, additional instructions on incorporating into
other emulators should be given. Not ready yet... so be careful.
Please note that there is an error in Zxcc -- in edops.h opcodes
0xed 0x70 and 0xed 0x71 are wrong: replace with
instr(0x70,8);
{unsigned char x;input(x);
store(hl,x);
}
endinstr;
instr(0x71,8);
{unsigned char x=fetch(hl);
tstates+=out(tstates,b,c,x);
}
endinstr;
Note that this has NO effect on running zxc, etc. Just using Zxcc
as an emulator driving i/o devices like am9511.
Integrating into RunCPM
=======================
https://github.com/MockbaTheBorg/RunCPM
Download, build, and test RunCPM. After this --
Add files
am9511.c
am9511.h
ansi.h
floatcnv.c
flaatcnv.h
ova.c
ova.h
to RunCPM-master/RunCPM
Edit cpu.h:
Add #include "am9511.h" at the top
Find cpu_in and cpu_out (Functions needed by the soft CPU implementation) and
replace with: (Note port assignments 0x43 and 0x42 are for rc2014 / planeta.com
compatibilty)
/* AM9511 */
#define AM_STATUS 0x43
#define AM_DATA 0x42
void *am9511 = NULL;
void cpu_out(const uint32 Port, const uint32 Value) {
if (am9511 == NULL) am9511 = am_create(AM_STATUS, AM_DATA);
if (Port == AM_DATA) am_push(am9511, Value);
else if (Port == AM_STATUS) am_command(am9511, Value);
else _Bios();
}
uint32 cpu_in(const uint32 Port) {
if (am9511 == NULL) am9511 = am_create(AM_STATUS, AM_DATA);
if (Port == AM_DATA) return am_pop(am9511);
else if (Port == AM_STATUS) return am_status(am9511);
_Bdos();
return(HIGH_REGISTER(AF));
}
Rebuild (make posix build). RunCPM should now include am9511 at ports 66
and 67.
For both Zxcc and RunCPM, MBASIC can be used with AM9511.BAS
planeta.com can be used to test am9511 under RunCPM or Zxcc.
https://github.com/feilipu/planets
for the source code for planeta.com and planet32.com planeta.com is
compiled with z88dk for AM9511A, planet32.com is compiled for ieee
32 bit float.