commit 66e488f9b3146e6d861284e92657d5ff13687b7c Author: Scott Duensing Date: Sat Sep 28 18:17:05 2024 -0500 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..48cafe3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*~ +*.BAK +*.bak +*.EXE +*.exe diff --git a/pc/os/BOOTUP.BAT b/pc/os/BOOTUP.BAT new file mode 100644 index 0000000..b535972 --- /dev/null +++ b/pc/os/BOOTUP.BAT @@ -0,0 +1,11 @@ +@echo off +echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» +echo º System Configuration (C) Copyright 1985-2024, Kangaroo Punch Studios º +echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ +echo º Main Processor : 80486 ³ Base Memory Size : 640 KB º +echo º Numeric Processor : None ³ Ext. Memory Size : 14912 KB º +echo º Floppy Drive A : 1.44MB, 3«" ³ Hard Disk C: Type : 47 º +echo º Floppy Drive B : 1.2 MB, 5¬" ³ Hard Disk D: Type : None º +echo º Display Type : VGA or EGA ³ Serial Port(s) : 3F8 º +echo º ROM-BIOS Date : 11/15/24 ³ Parallel Port(s) : 3BC º +echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ diff --git a/pc/os/EDIT.BAT b/pc/os/EDIT.BAT new file mode 100644 index 0000000..253df5b --- /dev/null +++ b/pc/os/EDIT.BAT @@ -0,0 +1 @@ +@c:\snafu\gets\tools\se.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 diff --git a/pc/os/SPLASH.ANS b/pc/os/SPLASH.ANS new file mode 100644 index 0000000..88dff87 --- /dev/null +++ b/pc/os/SPLASH.ANS @@ -0,0 +1,25 @@ +[?7h + + M I C R O S + M I C R O SMiniature PC BIOS + M I C R O S + M I C R O SVersion 1.0 + M I C R O SCopyright 2024 Scott Duensing + M I C R O SKangaroo Punch Studios + + +CPU : Broadcom BCM2711 Quad Cortex-A72 ARM v8 +RAM : 2097152 KB +USB : 2x 3.0 / 2x 2.0 + RADIO : BT 5.0 BLE / 2.4GHz @ 5GHz 802.11ac + VIDEO : 2x 1920x1080 HDMI + + + ARM-to-x86 Translation and DOS provided by DOSBox Staging + + + +* * * PLEASE WAIT * * * + + + \ No newline at end of file diff --git a/pc/os/notes.txt b/pc/os/notes.txt new file mode 100644 index 0000000..c689688 --- /dev/null +++ b/pc/os/notes.txt @@ -0,0 +1,158 @@ +- Things we need to configure: + + Locale + + Keyboard + + Timezone + timedatectl show + timedatectl --no-pager list-timezones + timedatectl set-timezone + + WiFi Region + WiFi SSID + WiFi Passkey + Bluetooth + Hostname + Password + Volume + Audio Internal / HDMI + + +- Change /boot/firmware/cmdline.txt: + +console=serial0,115200 console=tty3 logo.nologo root=PARTUUID=df70021d-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles cfg80211.ieee80211_regdom=US video=HDMI-A-1:640x480M@60,panel_orientation=up + + +- Change /boot/firmware/config.txt (add to end): + +[pi4] +arm_freq=2100 +gpu_freq=750 +over_voltage=6 + +[all] +dtoverlay=audremap,pins_18_19 +disable_splash=1 +disable_touchscreen=1 + + +- Tweak CPU: + +sudo apt-get install cpufrequtils +echo "CPU_DEFAULT_GOVERNOR=\"performance\"" >> /etc/cpu_governor + + +- Hide some text: + +echo > /etc/issue +echo > /etc/motd +cat <<- GETTY > /etc/systemd/system/getty@tty1.service.d/autologin.conf + [Service] + ExecStart= + ExecStart=-/sbin/agetty --skip-login --nonewline --noissue --autologin ${SUDO_USER} --noclear %I $TERM +GETTY +touch .hushlogin +sudo chmod -x /etc/update-motd.d/* + + +- Set config options: + +sudo raspi-config nonint do_update +sudo raspi-config nonint do_hostname tinydos +sudo raspi-config nonint do_boot_behaviour B2 +sudo raspi-config nonint do_boot_wait 0 +sudo raspi-config nonint do_audio 0 # ERRORS! +sudo raspi-config nonint do_blanking 0 +sudo raspi-config nonint do_ssh 0 +sudo raspi-config nonint do_rpi_connect 1 +sudo raspi-config nonint do_vnc 0 +sudo raspi-config nonint do_net_names 0 +sudo raspi-config nonint do_wayland W1 +sudo raspi-config nonint do_overscan_kms 1 0 + + +- Install Samba: + +sudo apt-get install samba samba-common-bin smbclient cifs-utils +cat <<- SAMBA >> /etc/samba/smb.conf + [DOS] + comment = Tiny DOS Files + path = /home/scott/dos + writable = yes + browseable = yes + public = no +SAMBA +(echo "${PASSWORD}"; echo "${PASSWORD}") | sudo smbpasswd -s -a "${SUDO_USER}" +sudo service smbd restart + + +- Install DOSBox Staging: + +sudo apt install flatpak +flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo +flatpak install flathub io.github.dosbox-staging + + +- Configure DOSBox: + +sed -i "s/fullscreen.\s*= false/fullscreen = true/" dos/dosbox-staging.conf +sed -i "s/fullresolution.\s*= desktop/fullresolution = 1920x1080/" dos/dosbox-staging.conf +sed -i "s/startup_verbosity.\s*= auto/startup_verbosity = quiet/" dos/dosbox-staging.conf +sed -i "s/aspect.\s*= auto/aspect = stretch/" dos/dosbox-staging.conf +sed -i "s/integer_scaling.\s*= auto/integer_scaling = off/" dos/dosbox-staging.conf +sed -i "s/viewport.\s*= fit/viewport = 80%/" dos/dosbox-staging.conf +sed -i "s/glshader.\s*= crt_auto/glshader = none/" dos/dosbox-staging.conf +sed -i "s/cycles.\s*= auto/cycles = 40000/" dos/dosbox-staging.conf +sed -i "s/capture_dir.\s*= capture/capture_dir = ~\/dos\/capture/" dos/dosbox-staging.conf +sed -i "s/phonebookfile.\s*= phonebook.txt/phonebookfile = ~\/dos\/phonebook.txt" dos/dosbox-staging.conf +sed -i "s/ipx.\s*= false/ipx = true/" dos/dosbox-staging.conf +cat <<- STARTUP >> dos/dosbox-staging.conf + @echo off + cls + mount c ~/dos/c > NUL + c: + call dos\bootup.bat + autoexec.bat +STARTUP + + +- Start on boot: + +cat <<- "XINIT" > .xinitrc + amixer -q -M sset Master 100% + xrandr --output HDMI-1 --mode "1920x1080" + xrandr --output HDMI-2 --same-as HDMI-1 + flatpak run io.github.dosbox-staging +XINIT + +cat <<- "PROFILE" >> .profile + # DOSBox Staging + if [[ -z \"\${SSH_CLIENT}\" ]]; then + startx -- -quiet -depth 24 + fi +PROFILE + + +- Set up DOS folder: + +mkdir -p dos/c/DOS +mkdir -p dos/capture +ln -s /home/${USER}/.var/app/io.github.dosbox-staging/config/dosbox/dosbox-staging.conf dos/. +cat <<- AUTOEXEC > dos/c/AUTOEXEC.BAT + @echo off + PATH=C:\DOS;Z:\;Y:\DOS + dir +AUTOEXEC +unix2dos dos/c/AUTOEXEC.BAT +echo "@c:\snafu\gets\tools\se.exe %1 %2 %3 %4 %5 %6 %7 %8 %9" > dos/c/DOS/EDIT.BAT +unix2dos dos/c/DOS/EDIT.BAT + + +- Modify Plymouth: + +cd /usr/share/plymouth/themes/pix +sudo mv splash.png splash.png.old +sudo cp ~/splash.png splash.png +sudo sed -i "s/Plymouth.SetUpdateStatusFunction(message_callback);/#Plymouth.SetUpdateStatusFunction(message_callback);/" pix.script +sudo update-initramfs -u diff --git a/pc/os/splash.png b/pc/os/splash.png new file mode 100644 index 0000000..facd4e8 Binary files /dev/null and b/pc/os/splash.png differ diff --git a/pc/os/splash.xcf b/pc/os/splash.xcf new file mode 100644 index 0000000..f39ce5f Binary files /dev/null and b/pc/os/splash.xcf differ diff --git a/pc/settings/DIALOG.FRM b/pc/settings/DIALOG.FRM new file mode 100644 index 0000000..4ecd2f7 Binary files /dev/null and b/pc/settings/DIALOG.FRM differ diff --git a/pc/settings/MAIN.FRM b/pc/settings/MAIN.FRM new file mode 100644 index 0000000..6d37880 Binary files /dev/null and b/pc/settings/MAIN.FRM differ diff --git a/pc/settings/MM_SETUP.BAS b/pc/settings/MM_SETUP.BAS new file mode 100644 index 0000000..a2cf4ad --- /dev/null +++ b/pc/settings/MM_SETUP.BAS @@ -0,0 +1,139 @@ +'$FORM frmMain + + +' $INCLUDE: 'MM_SETUP.BI' + + +DECLARE SUB comLine (n, a$(), max) +DECLARE SUB showHelp () +DECLARE SUB startup () + + +CONST magic$ = "KSFGILWZ" + + +' UI Colors. +SCREEN.ControlPanel(DESKTOP_BACKCOLOR) = 1 +SCREEN.ControlPanel(DESKTOP_FORECOLOR) = 7 +SCREEN.ControlPanel(DESKTOP_PATTERN) = 32 + + +' *** DEBUGGING *** +dialogOpen "Setup", "Loading Settings" +loadSettings +dialogClose + +frmMain.Tag = magic$ +frmMain.SHOW + + +'startup + +STATIC SUB comLine (NumArgs AS INTEGER, Args$(), MaxArgs AS INTEGER) + + DIM in + DIM cl$ + DIM l + DIM I + DIM c$ + + NumArgs = 0: in = FALSE + ' Get the command line using the COMMAND$ function + cl$ = COMMAND$ + l = LEN(cl$) + ' Go through the command line a character at a time + FOR I = 1 TO l + c$ = MID$(cl$, I, 1) + ' Test for character being a blank or a tab + IF (c$ <> " " AND c$ <> CHR$(9)) THEN + ' Neither blank nor tab; test if you're already inside + ' an argument + IF NOT in THEN + ' You've found the start of a new argument + ' Test for too many arguments + IF NumArgs = MaxArgs THEN EXIT FOR + NumArgs = NumArgs + 1 + in = TRUE + END IF + ' Add the character to the current argument + Args$(NumArgs) = Args$(NumArgs) + c$ + ELSE + ' Found a blank or a tab. + ' Set "Not in an argument" flag to FALSE + in = FALSE + END IF + NEXT I + +END SUB + +STATIC SUB showHelp () + + PRINT "This isn't helpful yet." + +END SUB + +SUB startup () + + ' + ' Read command line options from passed argument ("\ksfgilwz.$$$"). + ' + ' After arguments are read, delete this file. If it re-appears, read + ' data from Linux out of it and delete it again. + ' + ' For us to send data to Linux, write it to the first argument but change + ' the extension to !!! ("\ksfgilwz.!!!"). Linux will delete it when it + ' has been processed. + ' + ' If we need to execute DOS commands, write them to the second argument + ' ("\ksfgilwz.bat") and exit this program. + ' + + DIM p$(1 TO 10) + DIM a$(1 TO 10) + DIM c$ + DIM n + DIM f + + ' Parse command line. + CALL comLine(n, a$(), 10) + + ' Did we get exactly two arguments? + IF (n <> 1) OR (a$(1) <> magic$) THEN + PRINT "Do not run MM_SETUP directly. Use SETTINGS instead." + END + END IF + + ' Load the actual command line arguments from a file to preserve case. + n = 0 + ON LOCAL ERROR RESUME NEXT + f = FREEFILE + OPEN "C:\" + magic$ + ".$$$" FOR INPUT AS f + IF ERR = 0 THEN + DO WHILE NOT EOF(f) + n = n + 1 + LINE INPUT #f, p$(n) + LOOP + CLOSE f + END IF + ERR = 0 + ON LOCAL ERROR GOTO 0 + + ' Did they send us any arguments? If not, go GUI! + IF (n = 0) THEN + frmMain.Tag = magic$ + frmMain.SHOW + ELSE + ' Process command line arguments. + c$ = RTRIM$(LTRIM$(UCASE$(p$(1)))) + SELECT CASE c$ + CASE "?", "/?", "HELP", "/HELP" + showHelp + CASE ELSE + PRINT "Unknown option "; CHR$(34); c$; CHR$(34); "." + PRINT "Use "; CHR$(34); "SETTINGS HELP"; CHR$(34); " for help." + END 1 + END SELECT + END IF + +END SUB + diff --git a/pc/settings/MM_SETUP.BI b/pc/settings/MM_SETUP.BI new file mode 100644 index 0000000..cb60f50 --- /dev/null +++ b/pc/settings/MM_SETUP.BI @@ -0,0 +1,14 @@ +OPTION EXPLICIT +DEFINT A-Z + +' $INCLUDE: 'CONSTANT.BI' + +DECLARE SUB centerForm (who AS FORM) +DECLARE SUB dialogClose () +DECLARE SUB dialogOpen (titleBar AS STRING, message AS STRING) +DECLARE SUB getList (f AS INTEGER, who AS CONTROL) +DECLARE SUB loadSettings () +DECLARE SUB setList (who AS CONTROL, what AS STRING) + +DECLARE FUNCTION getSetting (f AS INTEGER) AS STRING + diff --git a/pc/settings/MM_SETUP.MAK b/pc/settings/MM_SETUP.MAK new file mode 100644 index 0000000..e236951 --- /dev/null +++ b/pc/settings/MM_SETUP.MAK @@ -0,0 +1,4 @@ +MM_SETUP.BAS +MAIN.FRM +DIALOG.FRM +SHARED.BAS diff --git a/pc/settings/SETTINGS.BAT b/pc/settings/SETTINGS.BAT new file mode 100644 index 0000000..fe9cadb --- /dev/null +++ b/pc/settings/SETTINGS.BAT @@ -0,0 +1,39 @@ +@echo off + +rem VBDOS is stupid and insists that command line arguments be translated +rem to upper case. So we shove them into a file and read them from there. + +rem "ksfgilwz" is random crap I banged into my keyboard. Nobody should have +rem a file with that name. Right? +set MM_RN=ksfgilwz + +rem Specify our settings, batch, and response files. +set MM_SF=C:\%MM_RN%.$$$ +set MM_BF=C:\%MM_RN%.bat +set MM_RF=C:\%MM_RN%.!!! + +if exist %MM_SF% del %MM_SF% +if exist %MM_BF% del %MM_BF% +if exist %MM_RF% del %MM_RF% + +if not "%1"=="" echo %1 >> %MM_SF% +if not "%2"=="" echo %2 >> %MM_SF% +if not "%3"=="" echo %3 >> %MM_SF% +if not "%4"=="" echo %4 >> %MM_SF% +if not "%5"=="" echo %5 >> %MM_SF% +if not "%6"=="" echo %6 >> %MM_SF% +if not "%7"=="" echo %7 >> %MM_SF% +if not "%8"=="" echo %8 >> %MM_SF% +if not "%9"=="" echo %9 >> %MM_SF% + +mm_setup.exe %MM_RN% + +if exist %MM_BF% call %MM_BF% + +if exist %MM_SF% del %MM_SF% +if exist %MM_BF% del %MM_BF% +if exist %MM_RF% del %MM_RF% + +set MM_SF= +set MM_BF= +set MM_RN= diff --git a/pc/settings/SHARED.BAS b/pc/settings/SHARED.BAS new file mode 100644 index 0000000..167dccc --- /dev/null +++ b/pc/settings/SHARED.BAS @@ -0,0 +1,132 @@ +'$FORM frmMain +'$FORM frmDialog + +' $INCLUDE: 'MM_SETUP.BI' + +SUB centerForm (who AS FORM) + + ' Center us on the screen. + who.Left = ((SCREEN.Width - who.Width) / 2) + who.Top = ((SCREEN.Height - who.Height) / 2) + +END SUB + +SUB dialogClose () + + frmDialog.HIDE + UNLOAD frmDialog + +END SUB + +SUB dialogOpen (titleBar AS STRING, message AS STRING) + + frmDialog.Caption = titleBar + frmDialog.lblMessage.Caption = message + frmDialog.SHOW + +END SUB + +SUB getList (f AS INTEGER, who AS CONTROL) + + DIM line$ + + WHILE who.ListCount + who.REMOVEITEM 0 + WEND + + DO + LINE INPUT #f, line$ + IF (line$ = "---") THEN EXIT DO + who.ADDITEM line$ + LOOP WHILE TRUE + + IF (who.ListCount > 0) THEN who.ListIndex = 0 + +END SUB + +FUNCTION getSetting (f AS INTEGER) AS STRING + + ' Load a single line setting from file. + ' If setting is "---" return nothing. + ' If setting is not "---", read until we get "---". + + DIM line$ + + getSetting = "" + + LINE INPUT #f, line$ + IF (line$ = "---") THEN EXIT FUNCTION + + getSetting = line$ + + DO + LINE INPUT #f, line$ + LOOP UNTIL (line$ = "---") + +END FUNCTION + +SUB loadSettings () + + DIM f + DIM line$ + + ' We load all the settings into frmMain, + ' even if it's not going to be displayed. + + frmMain.HIDE + + ON LOCAL ERROR RESUME NEXT + f = FREEFILE + OPEN "GETINFO.OUT" FOR INPUT AS f + IF ERR = 0 THEN + + ON LOCAL ERROR GOTO 0 + + ' Hostname + frmMain.txtHostname.Text = getSetting(f) + + ' IPs + getList f, frmMain.cmbCurrentIPs + + ' Timezone + getList f, frmMain.cmbTimezone + setList frmMain.cmbTimezone, getSetting(f) + + ' WiFi Country + getList f, frmMain.cmbWiFiCountry + setList frmMain.cmbWiFiCountry, getSetting(f) + + ' WiFi Network + getList f, frmMain.cmbWiFiNetwork + setList frmMain.cmbWiFiNetwork, getSetting(f) + + ' Bluetooth + line$ = getSetting(f) + + ' Volume + frmMain.hsbVolume.Value = VAL(getSetting(f)) + + ' Audio Device + getList f, frmMain.cmbAudioDevice + setList frmMain.cmbAudioDevice, getSetting(f) + + CLOSE f + END IF + ERR = 0 + ON LOCAL ERROR GOTO 0 + +END SUB + +SUB setList (who AS CONTROL, what AS STRING) + + DIM x + + FOR x = 0 TO who.ListCount - 1 + IF (LEFT$(who.List(x), LEN(what)) = what) THEN + who.ListIndex = x + EXIT FOR + END IF + NEXT x + +END SUB + diff --git a/pc/settings/getInfo.sh b/pc/settings/getInfo.sh new file mode 100755 index 0000000..38206db --- /dev/null +++ b/pc/settings/getInfo.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +# Fetch all info needed for UI. + +LINE="---" + +# Hostname - txtHostname +hostname +echo "${LINE}" + +# Assigned IP Addresses - cboCurrentIPs +hostname -I | tr " " "\n" | grep -v -e '^[[:space:]]*$' +echo "${LINE}" + +# Available Timezones - cmbTimezone +timedatectl --no-pager list-timezones +echo "${LINE}" + +# Current Timezone +timedatectl show | grep Timezone | sed 's/Timezone=//' +echo "${LINE}" + +# Available WiFi Countries - cboWiFiCountry +grep "^[A-Z][A-Z][[:space:]]" /usr/share/zoneinfo/iso3166.tab | sed 's/\t/ - /' +echo "${LINE}" + +# Current WiFi Country +iw reg get | sed -n "0,/country/s/^country \(.\+\):.*$/\1/p" +echo "${LINE}" + +# Available WiFi Networks - cboWiFiNetwork +sudo iw dev wlan0 scan | grep SSID: | sed "s/[[:space:]]SSID: //" | grep -v -e '^[[:space:]]*$' | uniq +echo "${LINE}" + +# Current WiFi Network +iw wlan0 info | grep ssid | sed "s/[[:space:]]ssid //" +echo "${LINE}" + +# Connected Bluetooth devices +#https://superuser.com/questions/1500383/bluetoothctl-list-connected-devices +#bluetoothctl devices | cut -f2 -d' ' | while read uuid; do bluetoothctl info $uuid; done|grep -e "Device\|Connected\|Name" +echo "${LINE}" + +# Volume - hsbVolume, lblVolumeLevel +XDG_RUNTIME_DIR=/run/user/$UID amixer sget Master | grep 'Right:' | awk -F'[][]' '{ print $2 }' | sed 's/%//' +echo "${LINE}" + +# Get Audio Outputs - cboAudioDevice +aplay -l | grep "^card" | awk -F'[][]' '{ print $2 }' +echo "${LINE}" + +# Current Audio Output +echo "${LINE}"