Commit Graph

24 Commits

Author SHA1 Message Date
dingusdev
2f326a8199 Compile fix for CharIO in VS2022
For some reason, it wouldn't define the symbol when trying to compile with Clang.
2024-03-07 20:57:40 -07:00
joevt
1e587b0848 chario: Move static variable to class. 2024-03-07 07:48:11 -07:00
joevt
97727e0d1e escc: Return NULL if nothing to read. 2024-03-07 07:47:41 -07:00
joevt
723eab59d6 escc: Include port name in log messages. 2024-03-07 07:40:30 -07:00
joevt
1421ccc81e escc: Add dma stub. 2024-03-07 07:30:06 -07:00
dingusdev
fb9b6886fa Add stdio for Windows serial 2024-02-20 18:05:11 -07:00
joevt
1b221bc0bd Fix compiler warnings: never executed. 2023-01-11 01:17:12 -08:00
joevt
5294a8b71c Fix compiler warnings: unused variables. 2023-01-11 01:17:12 -08:00
joevt
64fec88436 Fix compiler warnings: cast loses precision.
Use explicit cast when converting large integer types to smaller integer types when it is known that the most significant bytes are not required.
For pcidevice, check the ROM file size before casting to int. We'll allow expansion ROM sizes up to 4MB but usually they are 64K, sometimes 128K, rarely 256K.
for machinefactory, change the type to size_t so that it can correctly get the size of files that are larger than 4GB; it already checks the file size is 4MB before we need to cast to uint32_t.
For floppyimg, check the image size before casting to int. For raw images, only allow files up to 2MB. For DiskCopy42 images, it already checks the file size, so do the cast after that.
2023-01-11 01:17:12 -08:00
joevt
1c1300ce5a Add nvedit
setenv doesn't allow entering strings that include multiple lines which is useful for nvramrc.

nvedit uses CTRL-C to end editing, like Open Firmware. It does not support deleting characters from a line or editing previous lines or any other special keys. It doesn't have nvstore or nvquit or nvrecover commands. Basically, you should edit your nvramrc in a text editor, then copy and paste into the debugger.
2022-08-22 17:21:58 -07:00
joevt
67b7c86755 serial backend socket fixes
- increase delay to 800 consecutive characters (reduces times when Open Firmware throws away pasted text)
- don't log the first sock read error (when accept hasn't been called yet) but do log sock read error if accept was called successfully already.
2022-08-22 17:16:22 -07:00
joevt
3b4f40635a Register offsets should be logged as hex
- decimal values are confusing (can't tell if 12 means 12 or 18)
- most specs show hex values for register offsets.
2022-08-22 17:16:22 -07:00
joevt
650c2c88dd Add socket type for serial_backend
With the option --serial_backend=socket, input and output to a serial port will use a SOCK_STREAM type UNIX domain socket. This allows you to do Open Firmware in one window, while the first window can be used for dingusppc debugger.

Other fixes:

- Added SIGTERM handler so that if the user force quits dingusppc, the terminal settings are properly restored. A user needs to force quit when --serial_backend=stdio and Open Firmware is taking input from ttya. If terminal settings are not restored, then running dingusppc after a force quit will cause Control-C to not work when --serial_backend is not stdio.

- Added a couple numbers to rcv_char_available - 15 is the number of consecutive characters that can processed. 400 is the total number of calls to rcv_char_available after 15 consecutive characters have been read before additional characters can be read. This delay in processing additional characters allows pasting arbitrarily large amounts of text into Open Firmware. A real serial port terminal app might have a text pacing option to limit the number of output characters per second but that is not an option since the emulator is not limiting character data to a baud rate.

Related Notes:

The socket file is created when dingusppc starts.
The socket file is named dingusppcsocket and is created in the current working directory (usually where the executable is located and where the dingusppc.log, nvram.bin, and pram.bin files are created).
The socket file is not visible in the Finder. You can see it in the terminal using the ls command.
The socket file can be used with the following command in a new terminal window:
socat UNIX-CLIENT:dingussocket -,cs8,parenb=0,echo=0,icanon=0,isig=0,icrnl=0
When dingusppc quits, the socat command ends.

Other notes:

The dingusppc --debugger option causes dingusppc to enter the debugger before Open Firmware outputs anything. You can connect to the socket while dingusppc is in the debugger. Then enter the go command to leave the debugger and start Open Firmware. However, since the startup sound takes a long time, you can probably connect to the socket before Open Firmware starts even without the --debugger option. It's like with a real Power Mac - you have a few seconds to hold Command-Option-O-F except in this case you have a few seconds to press the up arrow and press enter (for executing the last command from the terminal command history) and if you do it too late you'll still get into Open Firmware if auto-boot? was previously set to false using the dingusppc debugger which is actually the only way to get into Open Firmware since a keyboard is currently not emulated?).

To set ttya as the input and output device in Open Firmware, you can use the setenv command in the dingusppc debugger. The device path needs to be longer than the current device path (because code for handling shortening of the paths is currently not implemented). For example, ttya can replace kbd for the input-device, but to replace screen for the output-device you need to add some extra characters like this: ttya,11 (I think the number is for baud but we're not using a real serial port so baud doesn't matter).

Future ideas:

- Have dingusppc execute the socat command for you so that it opens a terminal window before Open Firmware starts.
- Add another --serial_backend for the printer port (ttyb) since now we have more than one type of serial backend. If both serial ports use socket backend, then a different name for the second socket is required.
- Have an option to make dingusppc block until something connects to the socket (this means calling accept after listen instead of after select).
- Test compatibility with serial port socket created by Parallels Desktop virtual machines in macOS.
- Find a solution that works with Windows.
- Test with Linux.
- Create a serial_backend type for tty devices. I suppose maybe socat can pipe the file socket to tty but a direct connection might be easier to setup.
- Allow using a socket created by some other app (for example, socat UNIX-LISTEN). This means dingusppc will assume the client role and will call connect instead of accept.
2022-08-14 16:36:52 -07:00
Maxim Poliakovski
7fc28baf96 escc: self-registration with the device registry. 2022-07-18 20:27:34 +02:00
Maxim Poliakovski
1d6f296d10 chario: working Windows CharIo backend. 2022-06-12 17:55:34 +02:00
dingusdev
fd3ff7b703 Initial attempt at terminal support for Windows 2022-05-22 17:46:40 -07:00
Maxim Poliakovski
06001a778f GCC compilation fixes. 2022-05-21 15:10:40 +02:00
Maxim Poliakovski
d928d3ff55 CharIoStdin: disable SIGINT generation with Ctrl-C. 2022-05-21 14:51:28 +02:00
Maxim Poliakovski
4c9001901e ESCC: connect NULL and STDIO backends. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
da25e72668 Fix ESCC register addressing. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
4de10898ea Improve ESCC stub to bypass LocalTalk. 2022-02-26 10:57:13 +01:00
Maxim Poliakovski
205b5a4956 escc: implement reset commands. 2022-02-26 10:57:13 +01:00
Maxim Poliakovski
c946693450 escc: unify compatible and MacRISC addressing. 2022-02-26 10:57:13 +01:00
Maxim Poliakovski
cb946e41b5 Initial ESCC emulation. 2021-10-25 22:19:45 +02:00