Correct some bugs in the emulator and tweak the readme

This commit is contained in:
CrazyEttin 2022-10-03 00:57:36 +03:00
parent 85495426b2
commit e626369a16
2 changed files with 17 additions and 14 deletions

View File

@ -13,17 +13,18 @@ program Emulator;
uses SysUtils, Crt{$ifdef modem}, BaseUnix, Sockets{$endif}{$ifdef status}{$ifndef modem}, BaseUnix{$endif}{$endif};
{$ifdef tape}
//Tape file path and reset state
type
{$ifdef tape}
//Tape file path and reset state
Tape = record
Path: shortstring;
Reset: boolean;
Pos: integer;
end;
{$endif}
{$ifdef modem}
//Modem connection state
{$endif}
{$ifdef modem}
//Modem connection state
type
Connection = record
Call: boolean;
Answer: boolean;
@ -31,7 +32,7 @@ type
Port: word;
Hang: boolean;
end;
{$endif}
{$endif}
const
//The last address of RAM
@ -87,9 +88,11 @@ var
{$endif}
//Ignore signal
{$ifdef modem}
procedure DoSig (Sig: cint); cdecl;
begin
end;
{$endif}
//Terminal output
procedure Output;
@ -179,7 +182,7 @@ begin
//Create a socket
ServerSocket := fpSocket (AF_INET, SOCK_STREAM, 0);
if ServerSocket <> -1 then begin
//Connect
//Call
ServerAddr.sin_family := AF_INET;
ServerAddr.sin_addr.s_addr := htonl (ModemConn.Addr);
ServerAddr.sin_port := htons (ModemConn.Port);
@ -189,7 +192,7 @@ begin
end;
end;
end;
//Answer
//Listen and answer
if ModemConn.Answer then if Answering = false then begin
//Create a socket
ListenSocket := fpSocket (AF_INET, SOCK_STREAM, 0);
@ -198,9 +201,9 @@ begin
ServerAddr.sin_family := AF_INET;
ServerAddr.sin_addr.s_addr := htonl (ModemConn.Addr);
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
//Accept
//Answer
ClientAddrSize := sizeof (ClientAddr);
ClientSocket := fpAccept (ListenSocket, @ClientAddr, @ClientAddrSize) ;
if ClientSocket <> -1 then begin

View File

@ -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
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
address and port, -a to set the modem ready for answering calls to a
loopback or local IP address and port, and -h to hang. Hanging manually
is not necessary when making or answering a new call or switching
between calling and answering.
address and port, -a to get ready for answering a call to a loopback or
local IP address and port, and -h to hang. Hanging manually is not
necessary when making or getting ready to answer a new call, switching
between calling and answering, or shutting down the emulator.
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