Correct some bugs in the emulator and tweak the readme
This commit is contained in:
parent
85495426b2
commit
e626369a16
2 changed files with 17 additions and 14 deletions
11
emulator.pas
11
emulator.pas
|
@ -13,9 +13,9 @@ program Emulator;
|
||||||
|
|
||||||
uses SysUtils, Crt{$ifdef modem}, BaseUnix, Sockets{$endif}{$ifdef status}{$ifndef modem}, BaseUnix{$endif}{$endif};
|
uses SysUtils, Crt{$ifdef modem}, BaseUnix, Sockets{$endif}{$ifdef status}{$ifndef modem}, BaseUnix{$endif}{$endif};
|
||||||
|
|
||||||
type
|
|
||||||
{$ifdef tape}
|
{$ifdef tape}
|
||||||
//Tape file path and reset state
|
//Tape file path and reset state
|
||||||
|
type
|
||||||
Tape = record
|
Tape = record
|
||||||
Path: shortstring;
|
Path: shortstring;
|
||||||
Reset: boolean;
|
Reset: boolean;
|
||||||
|
@ -24,6 +24,7 @@ type
|
||||||
{$endif}
|
{$endif}
|
||||||
{$ifdef modem}
|
{$ifdef modem}
|
||||||
//Modem connection state
|
//Modem connection state
|
||||||
|
type
|
||||||
Connection = record
|
Connection = record
|
||||||
Call: boolean;
|
Call: boolean;
|
||||||
Answer: boolean;
|
Answer: boolean;
|
||||||
|
@ -87,9 +88,11 @@ var
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
//Ignore signal
|
//Ignore signal
|
||||||
|
{$ifdef modem}
|
||||||
procedure DoSig (Sig: cint); cdecl;
|
procedure DoSig (Sig: cint); cdecl;
|
||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
//Terminal output
|
//Terminal output
|
||||||
procedure Output;
|
procedure Output;
|
||||||
|
@ -179,7 +182,7 @@ begin
|
||||||
//Create a socket
|
//Create a socket
|
||||||
ServerSocket := fpSocket (AF_INET, SOCK_STREAM, 0);
|
ServerSocket := fpSocket (AF_INET, SOCK_STREAM, 0);
|
||||||
if ServerSocket <> -1 then begin
|
if ServerSocket <> -1 then begin
|
||||||
//Connect
|
//Call
|
||||||
ServerAddr.sin_family := AF_INET;
|
ServerAddr.sin_family := AF_INET;
|
||||||
ServerAddr.sin_addr.s_addr := htonl (ModemConn.Addr);
|
ServerAddr.sin_addr.s_addr := htonl (ModemConn.Addr);
|
||||||
ServerAddr.sin_port := htons (ModemConn.Port);
|
ServerAddr.sin_port := htons (ModemConn.Port);
|
||||||
|
@ -189,7 +192,7 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
//Answer
|
//Listen and answer
|
||||||
if ModemConn.Answer then if Answering = false then begin
|
if ModemConn.Answer then if Answering = false then begin
|
||||||
//Create a socket
|
//Create a socket
|
||||||
ListenSocket := fpSocket (AF_INET, SOCK_STREAM, 0);
|
ListenSocket := fpSocket (AF_INET, SOCK_STREAM, 0);
|
||||||
|
@ -200,7 +203,7 @@ begin
|
||||||
ServerAddr.sin_port := htons (ModemConn.Port);
|
ServerAddr.sin_port := htons (ModemConn.Port);
|
||||||
if fpBind (ListenSocket, @ServerAddr, Sizeof (ServerAddr)) <> -1 then begin
|
if fpBind (ListenSocket, @ServerAddr, Sizeof (ServerAddr)) <> -1 then begin
|
||||||
if fpListen (ListenSocket, 1) <> -1 then begin
|
if fpListen (ListenSocket, 1) <> -1 then begin
|
||||||
//Accept
|
//Answer
|
||||||
ClientAddrSize := sizeof (ClientAddr);
|
ClientAddrSize := sizeof (ClientAddr);
|
||||||
ClientSocket := fpAccept (ListenSocket, @ClientAddr, @ClientAddrSize) ;
|
ClientSocket := fpAccept (ListenSocket, @ClientAddr, @ClientAddrSize) ;
|
||||||
if ClientSocket <> -1 then begin
|
if ClientSocket <> -1 then begin
|
||||||
|
|
|
@ -133,10 +133,10 @@ arguments -0 and -1 respectively. The disc system uses hard sectored
|
||||||
single-sided discs with 77 tracks of 32 sectors of 137 bytes, or 337568
|
single-sided discs with 77 tracks of 32 sectors of 137 bytes, or 337568
|
||||||
bytes in total: the disc files must be of this size. The modem is
|
bytes in total: the disc files must be of this size. The modem is
|
||||||
controlled by the program modemctl: the option -c is used to call an IP
|
controlled by the program modemctl: the option -c is used to call an IP
|
||||||
address and port, -a to set the modem ready for answering calls to a
|
address and port, -a to get ready for answering a call to a loopback or
|
||||||
loopback or local IP address and port, and -h to hang. Hanging manually
|
local IP address and port, and -h to hang. Hanging manually is not
|
||||||
is not necessary when making or answering a new call or switching
|
necessary when making or getting ready to answer a new call, switching
|
||||||
between calling and answering.
|
between calling and answering, or shutting down the emulator.
|
||||||
|
|
||||||
The floppy disc system uses two ports: command at FFFB and data at FFFC.
|
The floppy disc system uses two ports: command at FFFB and data at FFFC.
|
||||||
Only the low nibble of the command port is used, consisting of a
|
Only the low nibble of the command port is used, consisting of a
|
||||||
|
|
Loading…
Reference in a new issue