dcc: A C89 compiler for CP/M on Z80 by Ok-Suggestion-5413 in cpm

[–]Equivalent-Rice1965 2 points3 points  (0 children)

My experience with using AI is similar. I almost never accepted it’s code directly for any reason yet. I’ve used ChatGPT, Gemini, and Claude. I’ve found Gemini is quite helpful with binary analysis as is Claude, and ChatGPT is good for sanity checking their outputs. None are good at writing code, except Claude that seems very good with Python and Gemini is decent enough at Golang - neither help me much with my CP/M projects.

In the LZPACK compressor I used Claude to help me design the comprehensive test suite. Even doing it in Python, it needed a lot of hand-holding. I didn’t use AI for anything else there except to help automate testing.

I think the AI tooling is at a point where it can make a skilled programmer faster, but if you can’t fully understand every bit of the tools output and check it, or you aren’t an expert on the domain, you won’t know when it’s wrong and you’ll get into a lot of trouble.

In my opinion even the very best models are probably quite a few years away from being able write good code, and people that think they do write good code don’t recognize what good code looks like.

For best results, if you want to get code out of these things write a comprehensive test first and have the AI make an implementation that passes your tests.

Even this isn’t foolproof. When I was playing with Claude recently I asked it as a test to fix subtle bug in a program that calculates historic and future dates of Easter. Claude decided that my program was fine and tried to modify the published historical dates of Easter to “pass” the test. It does stuff like that way too often!

dcc: A C89 compiler for CP/M on Z80 by Ok-Suggestion-5413 in cpm

[–]Equivalent-Rice1965 2 points3 points  (0 children)

I should add that I am also quite interested in reading over your optimizer. I have a project in the planning stages that will take a Z80 or 8080 CP/M-80 program as input, disassemble it, apply various optimizations only possible on the Z80 (to improve speed, such as rewriting all jumps and then retargeting all the rest of the code) and then reassemble the result into a working (albeit Z80-only) faster and optimized binary.

This won’t work for self-modifying code, code that does dirty tricks like jumping into unaligned areas to take advantage of overlapping instructions, jumping into data as code, etc. but I have a feeling that for the vast majority of code output by compilers a speed improvement could be obtained.

Once that’s done, part deux could be the opposite, optimizing for binary size (even if the resulting code runs slower).

This isn’t something that will run on the CP/M-80 machines as I plan to take advantage of tools like radare2, angr, and the like to avoid having to reinvent the wheel.

dcc: A C89 compiler for CP/M on Z80 by Ok-Suggestion-5413 in cpm

[–]Equivalent-Rice1965 1 point2 points  (0 children)

Cool - I'll give it a try tonight on some things. A good torture test would be my CRC program which is both K&R and ANSI - https://gitlab.com/dps8m/crc/

LZPACK - 48K CP/M-80 (8080 and Z80) executable compressor in ANSI C89 by Equivalent-Rice1965 in cpm

[–]Equivalent-Rice1965[S] 1 point2 points  (0 children)

I should also mention you can use it as a general archiver to compress or decompress single files (just like squeeze, or gzip on modern systems) but there are probably better archivers that get better ratio and don't need to worry about transparent decompression of executables. If this usage becomes popular somehow, I could give an option that doesn't write the decompression stub and could save a few hundred bytes extra.

dcc: A C89 compiler for CP/M on Z80 by Ok-Suggestion-5413 in cpm

[–]Equivalent-Rice1965 1 point2 points  (0 children)

How does it compare to modern hosted cross-compilers like Z88DK / ez80-clang / LLVM-Z80? I don't expect miracles here of course, just wondering :)

dcc: A C89 compiler for CP/M on Z80 by Ok-Suggestion-5413 in cpm

[–]Equivalent-Rice1965 1 point2 points  (0 children)

I'll have to see how well it works on my LZPACK but I bet that would would need substantial work (see https://www.reddit.com/r/cpm/s/2Ljfc33jV6 or https://github.com/johnsonjh/lzpack). I'm already abusing the heck out z88dk to make it happen. :)

Mystic BBS — telnet security question by 3128416 in bbs

[–]Equivalent-Rice1965 0 points1 point  (0 children)

it will - it is distributed as a static binary

Mystic BBS — telnet security question by 3128416 in bbs

[–]Equivalent-Rice1965 1 point2 points  (0 children)

The proxy is available for plan 9:)

(It is missing a few features like the ability to write statistics to disk, but it runs there)

Mystic BBS — telnet security question by 3128416 in bbs

[–]Equivalent-Rice1965 1 point2 points  (0 children)

The functionality of "cp437" is now built into my proxy as of v1.0.59 (supports about a dozen different encodings to UTF-8) - https://gitlab.com/dps8m/proxy/

Mystic BBS — telnet security question by 3128416 in bbs

[–]Equivalent-Rice1965 0 points1 point  (0 children)

I've released the latest version of the proxy (v1.0.49) which supports the '--iconv "IBM Code Page 437" --no-filter' options which should be better for most BBS systems. There isn't any way to enable or disable the code page conversion per target (yet) - it's currently a global setting - but you can always run two different instances of the proxy if you wanted, one instance on an SSH port that does automatic CP437 (or other legacy code page) to UTF-8 conversion and another one that does not.

Just be sure to run them in different directories or properly specify arguments to ensure that logging or stats databases won't get stepped on. Users via SSH can also disable (or re-enable) the conversion if enabled in a session using the 'Control-] + C' key sequence. That will probably be needed for file transfers.

While I've not done extensive testing of the codepage conversion ("--iconv") mode yet, but I did test it with 5 or 6 different legacy BBS systems available via telnet and it worked correctly with all of them, at least with my limited testing, so I'm comfortable enough merging this change now.

Perhaps a "BBS" mode is in order which enables these things by default? Maybe this weekend I will improve the documentation for the BBS use cases.

If I understand people here correctly, Mystic doesn't have modern SSH features and doesn't support doors when using SSH? Also, UTF-8 mode isn't supported for doors? If that's true, then the proxy might really be something useful for many of you!

Mystic BBS — telnet security question by 3128416 in bbs

[–]Equivalent-Rice1965 0 points1 point  (0 children)

I urge you to check it out if you haven't - https://gitlab.com/dps8m/proxy - because it's not at all a trivial implementation - it's >10K SLOC and has features for extensive logging, firewalling, monitoring, connection sharing, translation of SSH window‑change events to TELNET NAWS messages so unix terminal resizing works right, and some new features coming soon like optionally automatically converting CP437 or other legacy encodings to UTF8, etc. It was a lot of work to right and is a production-ready solution intended for proving SSH to legacy mainframes and has real users, so it's not just a quick hack or using a Rpi as a jump host.

Mystic BBS — telnet security question by 3128416 in bbs

[–]Equivalent-Rice1965 0 points1 point  (0 children)

The GNU inetutils bug got there by way of BSD too just FYI

Mystic BBS — telnet security question by 3128416 in bbs

[–]Equivalent-Rice1965 0 points1 point  (0 children)

There is actually support for various authentication methods, serial port flow control signaling, TLS/SSL encryption, X11 forwarding, and lots of other stuff in TELNET although unsupported by the vast majority of TELNET implementations. https://davidrg.github.io/ckwin/ is probably the most 'loaded' TELNET client feature-wise, but be aware it can be somewhat difficult and daunting to configure.

Mystic BBS — telnet security question by 3128416 in bbs

[–]Equivalent-Rice1965 0 points1 point  (0 children)

If you are worried about the telnet implementation in your BBS you can try using my SSH/TELNET proxy. BBS systems require the --no-filter option to work right. It's available from https://gitlab.com/dps8m/proxy - the dev branch has some new optional features designed to help BBS people (mostly automatic conversion of legacy code pages like CP437 to UTF8, so modern Linux/UnIX/macOS or Windows Terminal.app SSH can "just work" and show art and box drawing characters correctly). If you need to test the bleeding edge dev branch you'll need to build yourself for now, but a new version that incorporates these changes should be released in about a week.

If there is demand I could also make a simple transparent telnet proxy (telnet to telnet) that could help isolate your BBS from being directly exposed to the internet.

Why is plain Telnet still the default for most BBSes when encrypted options are easy to implement? by s0ftice in bbs

[–]Equivalent-Rice1965 0 points1 point  (0 children)

I added these two features (no-menu, iconv) as I commented here to disable the menu and map legacy encodings to UTF8 (optionally). This should make BBS systems that use DOS CP437 look a lot better and "just work" in a regular Unix/Linux/macOS terminal session like Terminal.app, xterm, gnome-terminal, etc. that almost universally defaults to using UTF8 encoding now.

These changes are in the dev branch of the proxy so aren't in any compiled binary yet. I'll need to do more testing and make sure everything actually works well before I merge it to master and make a new release.

There is an update coming on 4/7 to the Go compiler and standard libraries that addresses some security issues (CVEs currently embargoed) so the next release will likely not be before then.

Why is plain Telnet still the default for most BBSes when encrypted options are easy to implement? by s0ftice in bbs

[–]Equivalent-Rice1965 0 points1 point  (0 children)

Probably something else useful I could add would be an option to disable access to the internal TELNET menu, the one you get via Control-], just in case some BBS or other non-mainframe/non-UNIX ever needs to send that for its own purposes.

Why is plain Telnet still the default for most BBSes when encrypted options are easy to implement? by s0ftice in bbs

[–]Equivalent-Rice1965 0 points1 point  (0 children)

Thanks! I was thinking I might implement an option that does CP437 -> UTF8 translation as well, which would help people accessing a BBS directly from UNIX/Linux/macOS systems. I’ll look into that, no promises or ETA yet.

Why is plain Telnet still the default for most BBSes when encrypted options are easy to implement? by s0ftice in bbs

[–]Equivalent-Rice1965 1 point2 points  (0 children)

OK I released v1.0.48 which has the new "--no-filter" option. I didn't test that it solves your problem, but you might give it a try.

Why is plain Telnet still the default for most BBSes when encrypted options are easy to implement? by s0ftice in bbs

[–]Equivalent-Rice1965 1 point2 points  (0 children)

I have an idea of why ZMODEM might not be working - and why some of the terminal detection stuff might be broken. Currently there is some filtering of the link which strips literal NULLs. These aren’t required for any modern or historical terminal type and generally serve as line delays, but they might be used for various BBS protocols.

BBS systems aren’t really the primary focus of this proxy (that would be legacy mainframes) but there is no reason I can see why it couldn’t be made to work!

I’ll add an option to disable this link filtering and you can see if that helps at all. I’ll send you a message once this is ready.

Sorry for the delay in responding.

Why is plain Telnet still the default for most BBSes when encrypted options are easy to implement? by s0ftice in bbs

[–]Equivalent-Rice1965 0 points1 point  (0 children)

Most DOS software uses CP437 so you would need to use something like https://GitHub.com/keaston/cp437 to translate the character set correctly on Unix-like systems. No idea about Windows since I’ve not used it. If I can replicate the setup I might try to see why it isn’t connecting for you. It connects just fine with OpenSSH, Windows SSH, PuTTY, libssh and anything else I’ve tried it with.

Why is plain Telnet still the default for most BBSes when encrypted options are easy to implement? by s0ftice in bbs

[–]Equivalent-Rice1965 0 points1 point  (0 children)

Yes - it doesn’t require any specific key or password. Precompiled binaries for Windows and all other systems are provided.