Osmium BASIC - Commodore 64 spoof

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Osmium Programming
Posts: 14
Joined: 16 Oct 2017 20:15

Osmium BASIC - Commodore 64 spoof

#1 Post by Osmium Programming » 30 Jan 2018 21:30

I've been working on this one for a bit, and at v1.8, I'm deciding to post it to dostips, even though it's already up on osmiumsoft.wordpress.com/programs/basic
Any feedback would be much appreciated!

Source code:

Code: Select all

::osmiumsoft.wordpress.com
::Do not claim this program as your own. If you have a revised version, please give credit or contact osmiumsoftwareofficial@gmail.com

@echo off
cd 8

:line
title Osmium BASIC
mode 50,18
color 1f
setlocal enabledelayedexpansion
set ram=64
set bytesfree=38911
set line=
set drive=
set programname=
cls
echo.
echo         **** OSMIUM BASIC CMD V1.8 ****
echo.
echo      %ram%K RAM SYSTEM %bytesfree% BASIC BYTES FREE
echo.
:linegoto
set line=
set print=
echo READY.
set /p line=
if not defined line goto linegoto
set line=%line:|=%
if not defined line goto linegoto
set line=%line:"=@%
if not defined line goto linegoto
if /i "%line%" =="INFO" (
echo.
if /i not "%drive%" =="CASSETTE" if defined programname echo PROGRAM LOADED: "%programname%",%drive%
if /i "%drive%" =="CASSETTE" if defined programname echo PROGRAM LOADED: "%programname%"
if not defined programname echo PROGRAM LOADED: N/A
echo BASIC CMD V1.8
echo.
goto linegoto
)
if /i "%line%" =="HRT" (
cls
echo.
goto linegoto
)
if /i "%line%" =="OPEN /?" (
echo.
echo SYNTAX: OPEN [DRIVE]/CASSETTE
echo.
echo SUBSTITUTE [DRIVE] FOR A DRIVE NUMBER (A NUMBER
echo FROM 8-15 WHICH REPRESENTS THE FOLDERS INSIDE
echo THE OSMIUM BASIC FOLDER^)
echo.
echo USE 'CASSETTE' WHEN FORMATTING THE CASSETTE
echo FOLDER
echo.
goto linegoto
)
if /i "%line%" =="LOAD /?" (
echo.
echo SYNTAX 1: LOAD "[PROGRAM]",[DRIVE]
echo SYNTAX 2: LOAD "[PROGRAM]"
echo.
echo SUBSTITUTE [PROGRAM] FOR THE PROGRAM NAME AND
echo [DRIVE] FOR A DRIVE NUMBER (A NUMBER FROM 8-15
echo WHICH REPRESENTS THE FOLDERS INSIDE THE OSMIUM
echo BASIC FOLDER^)
echo.
echo USE THE FIRST SYNTAX FOR LOADING FROM A DRIVE,
echo AND THE SECOND FOR LOADING FROM CASSETTE (A
echo FOLDER INSIDE THE OSMIUM BASIC FOLDER THAT
echo SIMULATES THE C64'S CASSETTE COMPATABILITY^)
echo.
goto linegoto
)
for /f  %%a in ("%line%") do (
if /i "%%a" =="LOAD" goto load
if /i "%%a" =="OPEN" goto open
)
if /i "%line%" =="RESET" goto line
if /i "%line%" =="RUN" goto run
if /i "%line%" =="LIST" goto list
if /i "%line%" =="END" exit
if /i "%line%" =="SETUP" goto setup
if /i "%line%" =="REPAIR" goto repair
if /i "%line%" =="HELP" (
echo.
echo INFO   - DISPLAYS SYSTEM INFO
echo HRT    - CLEARS THE SCREEN
echo RESET  - RESETS THE INTERFACE AND BASIC VARIABLES
echo LOAD   - LOADS A PROGRAM FROM THE CASSETTE FOLDER
echo  LOAD /? - DISPLAYS HELP ABOUT THIS COMMAND
echo OPEN   - FORMATS A DRIVE
echo  OPEN /? - DISPLAYS HELP ABOUT THIS COMMAND
echo RUN    - RUNS A LOADED PROGRAM
echo REPAIR - REPAIRS THE OSMIUM BASIC FOLDER
echo SETUP  - RUNS THE FOLDER SETUP FOR INSTALLATION
echo LIST   - DISPLAYS THE LOADED PROGRAM'S CODE
echo HELP   - DISPLAYS THIS MENU
echo END    - QUITS THE PROGRAM
echo.
goto linegoto
)
echo.
echo ?SYNTAX  ERROR
goto linegoto

:load
set line=%line:.bat=%
set line2=%line: =%
if /i "%line2%" =="LOAD" (
echo.
echo ?SYNTAX  ERROR
goto linegoto
)
set drive=
set programname=
for /f "tokens=2 delims=," %%a in ("%line%") do (
cd ..
if exist "%%a" (
set drive=%%a
goto load2
)
echo.
echo ?SYNTAX  ERROR
goto linegoto
)
for /f "tokens=2 delims=@" %%a in ("%line%") do (
if "%%a" =="$" goto listcassette
cd ..
cd CASSETTE
if not exist "%%a.bat" (
echo.
echo ?FILE NOT FOUND  ERROR
goto linegoto
)
set programname=%%a
set drive=CASSETTE
echo.
goto linegoto
)
echo.
echo ?SYNTAX  ERROR
goto linegoto

:load2
for /f "tokens=2 delims=@" %%b in ("%line%") do (
if "%%b" =="$" goto listload
call :128check
cd "%drive%"
if not exist "%%b.bat" (
echo.
echo ?FILE NOT FOUND  ERROR
goto linegoto
)
set programname=%%b
echo.
goto linegoto
)
echo.
echo ?SYNTAX  ERROR
goto linegoto

:open
set line2=%line: =%
if /i "%line2%" =="OPEN" (
echo.
echo ?SYNTAX  ERROR
set line2=
goto linegoto
)
set line2=
for /f "tokens=2" %%a in ("%line%") do (
cd ..
if exist "%%a" (
rd /s /q "%%a" >nul
md "%%a"
cd 8
echo.
goto linegoto
)
echo.
echo ?SYNTAX  ERROR
cd 8
goto linegoto
)
cd 8
echo.
goto linegoto

:run
if not defined drive if not defined programname (
echo.
echo ?FILE NOT FOUND  ERROR
goto linegoto
)
cd ..
cd %drive%
if not "%programname%" =="*" call "%programname%"
color 1f
mode 50,18
if "%programname%" =="*" (
echo.
echo ?SPOOF NOT C64 ENOUGH  ERROR
set programname=
set drive=
goto linegoto
)
echo.
goto linegoto

:list
if not defined drive if not defined programname (
echo.
echo ?FILE NOT FOUND  ERROR
goto linegoto
)
cd ..
cd "%drive%"
if exist "%programname%.bat" (
echo.
type "%programname%.bat"
echo.
goto linegoto
) else (
echo.
echo ?FILE NOT FOUND  ERROR
goto linegoto
)
goto linegoto

:listcassette
cd ..
cd CASSETTE
echo.
echo CONTENTS OF CASSETTE
dir /b
cd ..
cd 8
echo.
goto linegoto

:listload
cd "%drive%"
echo.
echo CONTENTS OF DRIVE "%drive%"
dir /b
cd ..
cd 8
echo.
goto linegoto

:repair
(cd) > temp.basic
< temp.basic (
set /p directory=
)
del /s /q temp.basic >nul
cd ..
if not exist 8 cd %directory%
if not exist 8 mkdir 8
if not exist 9 mkdir 9
if not exist 10 mkdir 10
if not exist 11 mkdir 11
if not exist 12 mkdir 12
if not exist 13 mkdir 13
if not exist 14 mkdir 14
if not exist 15 mkdir 15
if not exist CASSETTE mkdir CASSETTE
cd 8
echo.
goto linegoto

:setup
mkdir "Osmium BASIC"
cd "Osmium BASIC"
mkdir 8
mkdir 9
mkdir 10
mkdir 11
mkdir 12
mkdir 13
mkdir 14
mkdir 15
mkdir CASSETTE
cd 8
echo.
echo ?MOVE THIS FILE TO THE OSMIUM BASIC FOLDER
goto linegoto

:128check
for /f "tokens=3 delims=," %%c in ("%line%") do (
if "%%c" =="128" color 8a
exit /b
)
Last edited by Osmium Programming on 23 Feb 2018 18:01, edited 1 time in total.

Osmium Programming
Posts: 14
Joined: 16 Oct 2017 20:15

Re: Osmium BASIC - Commodore 64 spoof

#2 Post by Osmium Programming » 30 Jan 2018 21:31

To install it properly, run the command SETUP once inside the program, then move Osmium BASIC into the newly created folder.

Post Reply