Skip to content

Commit dbcbd25

Browse files
authored
Merge pull request #136 from ejaquay/config-acia-base
Config acia base
2 parents 0aa90a6 + 9fd56e1 commit dbcbd25

File tree

7 files changed

+176
-78
lines changed

7 files changed

+176
-78
lines changed

acia/ReadMe.txt

Lines changed: 86 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,84 @@ Issues
1111
------
1212
1) Baud rates are not very accurate.
1313
2) No hardware flow control other than RxF and TxE signals
14-
15-
Todo
16-
----
17-
> Means to unload DLL when Vcc exits / crashes
18-
> Proper detection of serial port "modem" events when reading:
19-
Break, ring, CTS, DSR, RX and DX changes, etc.
20-
> Implement DCD DSR flow control.
14+
3) DLL does not exit if Vcc crashes. (Issue with all Vcc Dll's)
15+
4) No detection of serial port "modem" events when reading:
16+
Break, ring, CTS, DSR, RX and DX changes, etc.
2117

2218
Would be nice
2319
-------------
2420
1) Support for second sc6551 device
2521

26-
Acia Quick tutorial
27-
-------------------
28-
29-
To use acia.dll insert it in the cartridge slot or a MPI slot. This
30-
will cause "Acia Config" to be added to the Cartridge menu. Clicking
31-
on it allows selection of the acia communication modes: Console,
32-
File read, File write, TCPIP (client), and COMx (PC serial port). The
33-
Name and Port fields are used to set parameters for the modes. A
34-
text mode check box when checked causes acia.dll to do CR <-> CRLF
35-
translations when in file modes.
36-
37-
The sc6551 emulation is controlled by four port addresses, 0xFF68
38-
thru 0xFF6B. The CPU controls the sc6551 by writing to these
39-
addresses and gets status and data from the sc6551 by reading them.
40-
A sc6551 datasheet will explain these in detail - what follows is
22+
Acia Quick Start
23+
----------------
24+
To use acia.dll insert it in the cartridge slot or a MPI slot.
25+
This will cause "Acia Config" to be added to the Cartridge menu.
26+
Clicking on this menu item allows selection of one of the acia
27+
modes: Console, File read, File write, TCPIP (client), and COMx.
28+
The Name and Port fields are used to set parameters for modes
29+
that require them. The text mode check box when checked causes
30+
acia.dll to do CR <-> CRLF translations when using the file
31+
read and write modes. The default mode is CONSOLE.
32+
33+
For a quick test leave the ACIA config mode set to console
34+
and enter and run the following basic program. (You can cut
35+
and paste using Vcc Edit -> Paste Basic Code)
36+
37+
10 POKE &HFF6A,1
38+
20 IF (PEEK(&HFF69) AND 8)=0 THEN 20
39+
30 PRINT CHR$(PEEK(&HFF68));
40+
40 GOTO20
41+
42+
The Vcc console should come up. The console is a CMD type window
43+
that is connected to the ACIA. Anything typed in the console
44+
will be read and printed by the basic program. To close the
45+
console POKE &FF6A,0 or press F5 from the Vcc window.
46+
47+
The following program does the opposite, characters typed in the
48+
Vcc window are written to the console and CR writes CRLF:
49+
50+
10 POKE &HFF6A,1
51+
20 K$=INKEY$: IF K$="" THEN 20
52+
30 C=ASC(K$)
53+
40 IF (PEEK(&HFF69) AND 16)=0 THEN 40
54+
50 POKE &HFF68,C
55+
60 IF C<>13 THEN 20
56+
70 C=10: GOTO 40
57+
58+
Console mode is most useful when using Os9 which is described later.
59+
60+
Radio Shack Deluxe RS232 program Pak
61+
-------------------------------------
62+
63+
If the file "rs232.rom" is in the Vcc execution directory it will
64+
be automatically loaded when acia.dll is selected but not started.
65+
To start it do "EXEC &HE010" from RSDOS command prompt. The rom
66+
is a copy of the 4K rom from the Radio Shack Deluxe RS232 program
67+
Pack. If a different ROM is used it must be 4096 bytes long. Note
68+
that if acia.dll is in a MPI slot but not selected it can still be
69+
used but the pack rom will not be accessible. To exec the rom
70+
type EXEC&HE010 at the basic prompt. Note that the pak currently
71+
has trouble with the "goto basic" function on Vcc which limits its
72+
usefulness. Suggestions for a solution would be appreciated.
73+
74+
SC6551 Operation
75+
----------------
76+
77+
The sc6551 emulation is controlled one of two blocks of port addresses,
78+
0xFF68-0xFF6B or 0xFF68-0xFF6F, the block used is selected by a Acia
79+
config dialog Radio button. The CPU controls the sc6551 by writing
80+
to these addresses and gets status and data from the sc6551 by reading
81+
them. A sc6551 datasheet will explain these in detail - what follows is
4182
a brief explaination of the most important bits to acia.dll.
4283

43-
0xFF68 is the data register. A write to the address will transmit
84+
0xFF68 (0xFF6C) is the data register. A write to the address will transmit
4485
a byte of data and a read will receive a byte of data.
4586

46-
0xFF69 is the status byte. The CPU reads this port to determine
87+
0xFF69 (0xFF6D) is the status byte. The CPU reads this port to determine
4788
the status of the sc6551. Bits 0, 1, and 2 of the status byte are
48-
unused error indicators. Bit 3 indicates that a data byte is ready
49-
to read. Bit 4 indicates that the sc6551 is ready to transmit a byte.
50-
Bits 5 and 6 are modem and data set ready bits, and Bit 7 indicates the
89+
error indicators. Bit 3 indicates that a data byte is ready to read.
90+
Bit 4 indicates that the sc6551 is ready to transmit a byte. Bits
91+
5 and 6 are modem and data set ready bits, and Bit 7 indicates the
5192
sc6551 has asserted and IRQ. Acia.dll does not set the error bits and
5293
bits 5 and 6 are always clear to indicate mode and data ready states.
5394

@@ -57,16 +98,16 @@ writing to the data register, and when it wants to recieve data it must
5798
first check that bit 3 (RxF) is set before reading the data register.
5899

59100
Acia.dll will assert an IRQ and set status bit 7 when data becomes ready
60-
to read if Bit 1 of the command register (0xFF6A) is clear. The coco can
101+
to read if Bit 1 of the command register (0xFF6A (0xFF6E)) is clear. The coco can
61102
use the interrupt to reduce input polling.
62103

63-
0xFF6A is the command register. Bit 0 of the command register is the
104+
0xFF6A (0xFF6E) is the command register. Bit 0 of the command register is the
64105
DTR bit. This bit enables or disables the sc6551. If this bit is set
65106
by the coco CPU then communications are active (open) and if it is
66107
cleared communications are inactive (closed). Other command register
67108
bits set IRQ behavior and parity. Refer to data sheet for details.
68109

69-
0xFF6B is the control register. Bits 0-3 of the control register set
110+
0xFF6B (0xFF6F) is the control register. Bits 0-3 of the control register set
70111
the baud rate according to the following table. Datasheet rates that
71112
are not supported by acia.dll have replaced by the next higher value.
72113
Acia.dll uses screen sync signal to time the input speeds. These
@@ -83,7 +124,7 @@ the rates are invalid.
83124
6 300 14 9600
84125
7 600 15 19200
85126

86-
Bits 5 and 6 of 0xFF6B set the data length and Bit 7 sets the number
127+
Bits 5 and 6 of 0xFF6B (0xFF6F) set the data length and Bit 7 sets the number
87128
of stop bits. B5-6: 00=8 01=7 10=6 11=5 len. B7 0=1, 1=2 stops.
88129

89130
Basic programs can enable acia by poking 1 to &HFF6A and disable it by
@@ -122,11 +163,13 @@ RS232.ROM
122163

123164
If the file "rs232.rom" is in the Vcc execution directory it will
124165
be automatically loaded when acia.dll is selected but not started.
166+
(make sure Autostart Cart in Misc Config dialog is unchecked)
125167
To start it do "EXEC &HE010" from RSDOS command prompt. The rom
126168
is a copy of the 4K rom from the Radio Shack Deluxe RS232 program
127-
Pack. If a different ROM is used it must be 4096 bytes long. Note
128-
that if acia.dll is in a MPI slot but not selected it can still be
129-
used but the pack rom will not be accessible.
169+
Pack. The RS232 rom is only usefull if FF68 (RS-232 Pak) is selected
170+
in the config dialog. If a different ROM is used it must be 4096
171+
bytes long. Note that if acia.dll is in a MPI slot but not selected
172+
it can still be used but the pack rom will not be accessible.
130173

131174
Communications Modes
132175
--------------------
@@ -154,6 +197,7 @@ Console mode can be useful when using (Nitr)Os9 and the t2 device
154197
and associated sc6551 driver. t2 and sc6551 must both be loaded at
155198
boot (in the boot track) to work properly. The t2 device can also
156199
be used for testing purposes, which is why it was originally created.
200+
Note that the stock t2 driver assumes the Acia Address is FF68.
157201

158202
Caution: There can only be one console associated with Vcc. Conflicts
159203
will occur is the console is used for other purposes, such as for
@@ -169,10 +213,10 @@ quit=05 bse=08 bell=07 type=80 baud=06 xon=11 xoff=13
169213
Some of these settings are not honored by the sc6551 driver.
170214
Xon, Xoff, and baud xmode settings seem to have no effect.
171215

172-
The basic idea is to match standard text window settings. Acia.dll
173-
will translate OS9 text screen control codes to the proper console
174-
functions. Colors default to white on black. Only colors 0-7 are
175-
supported.
216+
The console uses standard OS9 text window settings. Acia.dll
217+
will translate many OS9 text screen control codes to do the
218+
proper console functions. Colors default to white on black.
219+
Only colors 0-7 are supported.
176220

177221
To launch a shell simply do: shell i=/t2 and the console
178222
will come up. Typing "ex" in the console window causes the
@@ -210,6 +254,7 @@ I did a brief check of uemacs. It seems to work okay except I find
210254
the lack of support of arrow keys annoying and I am too used to
211255
vi's use of hjkl for cursor position to adapt to emacs.
212256

257+
213258
File Read and File Write Modes
214259
------------------------------
215260

@@ -245,7 +290,7 @@ output in a os9 file and copy that to /t2, for example:
245290
When using other programs to read or write files it is important
246291
to note that setting DTR opens the file and clearing DTR closes
247292
it. The NitrOS9 driver takes care of this but many terminal
248-
programs do not. DTR is controlled by bit 0 in 0xFF6A.
293+
programs do not. DTR is controlled by bit 0 in 0xFF6A (0xFF6E).
249294

250295
TCPIP Mode
251296
----------
@@ -254,7 +299,7 @@ TCPIP mode causes acia to do a client connection to a tcpip server.
254299
After selecting TCPIP radio button on the Acia config dialog the
255300
server hostname or IP address should be entered in the Name field
256301
(default is localhost) and the server port in the Port field. Setting
257-
bit 0 in 0xFF6A opens the connection and clearing it closes it.
302+
bit 0 in 0xFF6A (0xFF6E) opens the connection and clearing it closes it.
258303

259304
Testing tcpip mode was done using netcat on Linux as a server.
260305
On Linux ' nc -l -p 48000' 48000 is the port number I am using.
@@ -279,6 +324,5 @@ in windows along with putty. com0com is used to 'wire' two psuedo
279324
port COM20 and COM21 together. I used acia.dll to connect to COM20
280325
and PuTTy to connect to COM21. This allowed me to simulate connecting
281326
with a terminal. Also tested with a USRobotics faxmodem via a Radio
282-
Shack USB to serial adapter and the legacy USBSER driver, which was a
283-
PIA to setup in Windows 10.
327+
Shack USB to serial adapter and the legacy USBSER driver.
284328

acia/acia.c

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static char IniSect[MAX_LOADSTRING]; // Ini file section
4848
// Some strings for config dialog
4949
char *IOModeTxt[] = {"RW","R","W"};
5050
char *ComTypeTxt[] = {"CONS","FILE","TCP","COM"};
51-
51+
5252
static unsigned char Rom[8191];
5353
static void (*PakSetCart)(unsigned char)=NULL;
5454
unsigned char LoadExtRom(char *);
@@ -214,6 +214,8 @@ void LoadConfig(void)
214214
COM_CONSOLE,IniFile);
215215
AciaComMode=GetPrivateProfileInt("Acia","AciaComMode",
216216
COM_MODE_DUPLEX,IniFile);
217+
AciaBasePort=GetPrivateProfileInt("Acia","AciaBasePort",
218+
BASE_PORT_RS232,IniFile);
217219
AciaTcpPort=GetPrivateProfileInt("Acia","AciaTcpPort",48000,IniFile);
218220
AciaTextMode=GetPrivateProfileInt("Acia","AciaTextMode",0,IniFile);
219221
GetPrivateProfileString("Acia","AciaComPort","COM3",
@@ -252,6 +254,8 @@ void LoadConfig(void)
252254
void SaveConfig(void)
253255
{
254256
char txt[16];
257+
sprintf(txt,"%d",AciaBasePort);
258+
WritePrivateProfileString("Acia","AciaBasePort",txt,IniFile);
255259
sprintf(txt,"%d",AciaComType);
256260
WritePrivateProfileString("Acia","AciaComType",txt,IniFile);
257261
sprintf(txt,"%d",AciaComMode);
@@ -300,6 +304,23 @@ LRESULT CALLBACK ConfigDlg(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam)
300304

301305
SetWindowPos(hDlg, HWND_TOP, 10, 10, 0, 0, SWP_NOSIZE);
302306

307+
// Set Button as per Base Port
308+
switch (AciaBasePort) {
309+
case BASE_PORT_RS232:
310+
CheckDlgButton(hDlg,IDC_T_RS232,BST_CHECKED);
311+
CheckDlgButton(hDlg,IDC_T_MODEM,BST_UNCHECKED);
312+
break;
313+
case BASE_PORT_MODEM:
314+
CheckDlgButton(hDlg,IDC_T_RS232,BST_UNCHECKED);
315+
CheckDlgButton(hDlg,IDC_T_MODEM,BST_CHECKED);
316+
break;
317+
default:
318+
CheckDlgButton(hDlg,IDC_T_RS232,BST_CHECKED);
319+
CheckDlgButton(hDlg,IDC_T_MODEM,BST_UNCHECKED);
320+
AciaBasePort = BASE_PORT_RS232;
321+
break;
322+
}
323+
303324
// Set Radio Button as per com type
304325
switch (AciaComType) {
305326

@@ -359,9 +380,21 @@ LRESULT CALLBACK ConfigDlg(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam)
359380

360381
case WM_COMMAND:
361382

362-
// Close sc6551 before changing com type
383+
363384
button = LOWORD(wParam);
364385
switch (button) {
386+
387+
// Close sc6551 before changing base port or com type
388+
case IDC_T_RS232:
389+
sc6551_close();
390+
AciaBasePort = BASE_PORT_RS232;
391+
break;
392+
393+
case IDC_T_MODEM:
394+
sc6551_close();
395+
AciaBasePort = BASE_PORT_MODEM;
396+
break;
397+
365398
case IDC_T_CONS:
366399
EnableWindow(GetDlgItem(hDlg,IDC_PORT),FALSE);
367400
EnableWindow(GetDlgItem(hDlg,IDC_NAME),FALSE);

acia/acia.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
// Text mode EOF character
4040
#define EOFCHR 0x1B
4141

42+
// Base Ports
43+
#define BASE_PORT_RS232 0x68
44+
#define BASE_PORT_MODEM 0x6C
45+
4246
// Communications type and mode enumerations
4347
enum com_type {
4448
COM_CONSOLE,
@@ -59,6 +63,7 @@ HANDLE hStopInput;
5963
HANDLE hStopOutput;
6064

6165
// Config globals
66+
int AciaBasePort; // Base port for sc6651 (0x68 or 0x6C)
6267
int AciaComType; // Console,file,tcpip,wincom
6368
int AciaComMode; // Duplex,read,write
6469
int AciaTextMode; // CR and EOF translations 0=none 1=text

acia/acia.rc

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
2525
// TEXTINCLUDE
2626
//
2727

28-
1 TEXTINCLUDE
28+
1 TEXTINCLUDE
2929
BEGIN
3030
"resource.\0"
3131
END
3232

33-
2 TEXTINCLUDE
33+
2 TEXTINCLUDE
3434
BEGIN
3535
"#include ""afxres.h""\r\n"
3636
"\0"
3737
END
3838

39-
3 TEXTINCLUDE
39+
3 TEXTINCLUDE
4040
BEGIN
4141
"\r\n"
4242
"\0"
@@ -50,27 +50,40 @@ END
5050
// Dialog
5151
//
5252

53-
IDD_PROPPAGE DIALOGEX 0, 0, 170, 170
53+
IDD_PROPPAGE DIALOGEX 0, 0, 202, 185
5454
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION
5555
CAPTION "Acia Interface"
5656
FONT 8, "MS Sans Serif", 0, 0, 0x0
5757
BEGIN
58-
CONTROL "CONSOLE", IDC_T_CONS, "Button",BS_AUTORADIOBUTTON,16,16,55,12
59-
CONTROL "FILE READ", IDC_T_FILE_R,"Button",BS_AUTORADIOBUTTON,16,30,55,12
60-
CONTROL "FILE WRITE",IDC_T_FILE_W,"Button",BS_AUTORADIOBUTTON,16,44,55,12
61-
CONTROL "TCPIP", IDC_T_TCP, "Button",BS_AUTORADIOBUTTON,15,58,55,12
62-
CONTROL "COMx", IDC_T_COM, "Button",BS_AUTORADIOBUTTON,16,72,55,12
63-
64-
LTEXT "Name:", IDC_STATIC,14,90,20,11
65-
EDITTEXT IDC_NAME,40,88,110,12,ES_AUTOHSCROLL | ES_LEFT
66-
LTEXT "Port:",IDC_STATIC,14,104, 20,11
67-
EDITTEXT IDC_PORT,40,102, 36,12,ES_AUTOHSCROLL | ES_NUMBER
68-
69-
CONTROL "Text Mode",IDC_TXTMODE,"Button",BS_AUTOCHECKBOX,18,118,50,12
70-
71-
DEFPUSHBUTTON "Ok", IDOK, 14,140,45,19
72-
PUSHBUTTON "APPLY", IDAPPLY, 62,140,45,19
73-
PUSHBUTTON "Cancel",IDCANCEL,110,140,45,19
58+
GROUPBOX "Type",IDC_STATIC,8,8,90,84,BS_CENTER
59+
CONTROL "CONSOLE", IDC_T_CONS, "Button",BS_AUTORADIOBUTTON|WS_GROUP,
60+
16,18,75,12
61+
CONTROL "FILE READ", IDC_T_FILE_R,"Button",BS_AUTORADIOBUTTON,
62+
16,31,75,12
63+
CONTROL "FILE WRITE",IDC_T_FILE_W,"Button",BS_AUTORADIOBUTTON,
64+
16,46,75,12
65+
CONTROL "TCPIP", IDC_T_TCP, "Button",BS_AUTORADIOBUTTON,
66+
16,60,75,12
67+
CONTROL "COMx", IDC_T_COM, "Button",BS_AUTORADIOBUTTON,
68+
16,74,75,12
69+
70+
GROUPBOX "Acia Address",IDC_STATIC,104,18,90,51,BS_CENTER
71+
CONTROL "FF68 (RS-232 Pak)",IDC_T_RS232,"Button",BS_AUTORADIOBUTTON|WS_GROUP,
72+
108,31,75,12
73+
CONTROL "FF6C (Modem Pak)", IDC_T_MODEM,"Button",BS_AUTORADIOBUTTON,
74+
108,46,75,12
75+
76+
LTEXT "Name:", IDC_STATIC,14,102, 20, 11
77+
EDITTEXT IDC_NAME, 40,100, 120,12,ES_AUTOHSCROLL|ES_LEFT
78+
LTEXT "Port:",IDC_STATIC, 14,120, 20, 11
79+
EDITTEXT IDC_PORT, 40,118, 20, 12,ES_AUTOHSCROLL|ES_NUMBER
80+
81+
CONTROL "Text Mode",IDC_TXTMODE,"Button",BS_AUTOCHECKBOX,
82+
18,136,50,12
83+
84+
DEFPUSHBUTTON "Ok", IDOK, 23,155,45,20
85+
PUSHBUTTON "APPLY", IDAPPLY, 75,155,45,20
86+
PUSHBUTTON "Cancel",IDCANCEL,128,155,45,20
7487
END
7588

7689
/////////////////////////////////////////////////////////////////////////////

acia/resource.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
#define IDC_T_TCP 1023
1919
#define IDC_T_COM 1024
2020

21+
#define IDC_T_RS232 1030
22+
#define IDC_T_MODEM 1031
23+
2124
// Next default values for new objects
2225
//
2326
#ifdef APSTUDIO_INVOKED

0 commit comments

Comments
 (0)