A rubbs-based telnet server that drops every caller into a simulated PC: it POSTs, boots, loads SERMO-DOS, and lands at a C:\> prompt. Built-in DOS commands (VER/DATE/TIME/ECHO/MEM/DIR/CLS/HELP/EXIT) behave; anything else is routed to Sermo::Oracle as a question — the hook for a future LLM. Built on rubbs' configurable BBS::FakeOS engine; the whole OS lives in lib/sermo/dos.rb as a FakeOS.define block, so new character-mode OSes are added as config files, not engine changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
120 lines
4.7 KiB
Ruby
120 lines
4.7 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'bbs'
|
|
require 'time'
|
|
require_relative 'oracle'
|
|
|
|
module Sermo
|
|
# An MS-DOS-flavoured machine for SERMO-BBS: pretend you sat down at an old
|
|
# PC, watched it POST and boot, and landed at a C:\> prompt. Built-in DOS
|
|
# commands behave; anything else is treated as a question and handed to
|
|
# Sermo::Oracle (the conversational core).
|
|
#
|
|
# This whole OS is data: to add another character-mode OS later, write a new
|
|
# BBS::FakeOS.define block in its own file — no engine changes needed.
|
|
DOS = BBS::FakeOS.define do
|
|
name 'SERMO-DOS'
|
|
prompt 'C:\\>'
|
|
|
|
# Classic light-grey-on-black console palette.
|
|
colors text: "\e[0;37m",
|
|
bright: "\e[1;37m",
|
|
accent: "\e[1;32m",
|
|
error: "\e[1;31m",
|
|
dim: "\e[1;30m"
|
|
|
|
# ── Power-on self test → boot ──────────────────────────────────────────────
|
|
boot do
|
|
cls
|
|
print 'Award Modular BIOS v4.51PG, An Energy Star Ally', delay: 0.3
|
|
print 'Copyright (C) 1984-98, Award Software, Inc.', newline: 2, delay: 0.3
|
|
print 'Main Processor : Intel 80486DX2 @ 66 MHz', delay: 0.2
|
|
memtest 16_384, step: 4096, delay: 0.05
|
|
print '', delay: 0.2
|
|
print 'Detecting IDE Primary Master ... SERMO HDD 504MB', delay: 0.3
|
|
print 'Detecting IDE Primary Slave ... None', delay: 0.2
|
|
print 'Detecting Floppy Drive A: ... 1.44M, 3.5 in.', newline: 2, delay: 0.3
|
|
print 'Verifying DMI Pool Data ...........', delay: 0.5
|
|
print 'Starting MS-DOS...', newline: 2, delay: 0.8
|
|
|
|
print 'HIMEM is testing extended memory...done.', delay: 0.3
|
|
print 'C:\\> LOADHIGH SMARTDRV.EXE', delay: 0.3
|
|
print 'C:\\> MSCDEX.EXE /D:SERMO0', newline: 2, delay: 0.4
|
|
|
|
cls
|
|
big_banner 'SERMO DOS', font: 'standard'
|
|
print 'SERMO-DOS Version 6.22 (c) 1994-2026 Teletype Games', delay: 0.1
|
|
print ''
|
|
end
|
|
|
|
# Shown once, after boot, before the first prompt.
|
|
ready do
|
|
puts 'Type HELP for a list of commands — or just type a question and ask.'
|
|
puts ''
|
|
end
|
|
|
|
# ── Built-in commands ───────────────────────────────────────────────────────
|
|
command 'ver', help: 'Display the SERMO-DOS version' do |_args, io|
|
|
io.puts 'SERMO-DOS Version 6.22'
|
|
end
|
|
|
|
command 'cls', help: 'Clear the screen' do |_args, io|
|
|
io.cls
|
|
end
|
|
|
|
command 'date', help: 'Display the current date' do |_args, io|
|
|
io.puts Time.now.strftime('Current date is %a %m-%d-%Y')
|
|
end
|
|
|
|
command 'time', help: 'Display the current time' do |_args, io|
|
|
io.puts Time.now.strftime('Current time is %H:%M:%S')
|
|
end
|
|
|
|
command 'echo', help: 'Display a message' do |args, io|
|
|
io.puts(args.empty? ? 'ECHO is on.' : args)
|
|
end
|
|
|
|
command 'mem', help: 'Display memory usage' do |_args, io|
|
|
io.puts ' 655360 bytes total conventional memory'
|
|
io.puts ' 655360 bytes available to MS-DOS'
|
|
io.puts ' 643072 largest executable program size'
|
|
io.puts ' 15728640 bytes total contiguous extended memory'
|
|
end
|
|
|
|
command 'dir', help: 'List the directory' do |_args, io|
|
|
io.puts ' Volume in drive C is SERMO'
|
|
io.puts ' Directory of C:\\'
|
|
io.puts ''
|
|
io.puts 'COMMAND COM 54 645 06-05-26 6:22a'
|
|
io.puts 'SERMO SYS 12 080 06-05-26 6:22a'
|
|
io.puts 'AUTOEXEC BAT 128 06-05-26 6:22a'
|
|
io.puts 'CONFIG SYS 256 06-05-26 6:22a'
|
|
io.puts ' 4 file(s) 67 109 bytes'
|
|
io.puts ' 503 312 384 bytes free'
|
|
end
|
|
|
|
command 'help', '?', help: 'Show this help' do |_args, io|
|
|
io.puts 'Supported commands:'
|
|
io.puts ''
|
|
io.puts ' VER DATE TIME ECHO MEM'
|
|
io.puts ' DIR CLS HELP EXIT'
|
|
io.puts ''
|
|
io.puts 'Anything else you type is treated as a question and answered.'
|
|
end
|
|
|
|
command 'exit', 'quit', 'logoff', help: 'Disconnect' do |_args, io|
|
|
io.puts 'Goodbye.'
|
|
io.halt
|
|
end
|
|
|
|
# ── Everything else is a conversation ────────────────────────────────────────
|
|
on_unknown do |input, io|
|
|
io.newline
|
|
Sermo::Oracle.answer(input, io.ctx).each_line do |line|
|
|
io.puts " #{line.chomp}", style: :bright
|
|
end
|
|
io.newline
|
|
end
|
|
end
|
|
end
|