@echo off setlocal REM ------------------------------------------------------------------ REM Build the vim editor with Spinnaker Power C on a private copy of REM the system disk at ..\reference\POWERc.d81. REM REM The editor is two source files because Power C's compiler reports REM "program too big" when the whole thing is one unit; both objects REM are linked into vim. REM REM Power C is interactive: "cc" asks for the source, compiler and REM object disks, and "link" prompts for object files, the "^" library REM line and the output file name. -keybuf answers all of it; the runs REM of \n are those prompts. -keybuf-delay spaces the answers out: fed REM all at once they land before the later disk prompts appear and are REM lost, which leaves cc waiting for the object disk. REM ------------------------------------------------------------------ set "VICE=C:\Program Files\GTK3VICE-3.10-win64\bin" set "HERE=%~dp0" set "BASE=%HERE%..\reference\POWERc.d81" set "IMG=%HERE%vim.d81" if not exist "%VICE%\x64sc.exe" goto novice if not exist "%BASE%" goto nobody echo === fresh work disk copy /y "%BASE%" "%IMG%" >nul echo === ASCII source -^> PETSCII powershell -NoProfile -ExecutionPolicy Bypass -File "%HERE%to-petscii.ps1" "%HERE%vim.c" "%HERE%vim.pet" if errorlevel 1 goto bad powershell -NoProfile -ExecutionPolicy Bypass -File "%HERE%to-petscii.ps1" "%HERE%vscreen.c" "%HERE%vscreen.pet" if errorlevel 1 goto bad echo === write both sources to the disk for %%f in (vim.c vim.o vscreen.c vscreen.o vim) do "%VICE%\c1541.exe" "%IMG%" -delete %%f >nul 2>&1 "%VICE%\c1541.exe" "%IMG%" -write "%HERE%vim.pet" "vim.c,s" >nul if errorlevel 1 goto bad "%VICE%\c1541.exe" "%IMG%" -write "%HERE%vscreen.pet" "vscreen.c,s" >nul if errorlevel 1 goto bad echo === cc vim.c (a minute or so in warp mode) "%VICE%\x64sc.exe" -8 "%IMG%" -autostart "%IMG%:shell" -autostart-warp -warp -sounddev dummy -keybuf-delay 300 -keybuf "cc vim.c\n\n\n\n\n\n\n\n\n\n\n\n" -limitcycles 600000000 echo === cc vscreen.c "%VICE%\x64sc.exe" -8 "%IMG%" -autostart "%IMG%:shell" -autostart-warp -warp -sounddev dummy -keybuf-delay 300 -keybuf "cc vscreen.c\n\n\n\n\n\n\n\n\n\n\n\n" -limitcycles 600000000 echo === link -s -^> vim "%VICE%\x64sc.exe" -8 "%IMG%" -autostart "%IMG%:shell" -autostart-warp -warp -sounddev dummy -keybuf-delay 300 -keybuf "link -s\nvim.o\nvscreen.o\n^\n\nvim\n\n\n" -limitcycles 600000000 del "%HERE%vim.pet" >nul 2>&1 del "%HERE%vscreen.pet" >nul 2>&1 echo === disk contents "%VICE%\c1541.exe" "%IMG%" -list | findstr /i "vim vscreen" echo. echo Run it with: echo x64sc -autostart "%IMG%:vim" exit /b 0 :novice echo x64sc.exe not found in "%VICE%" exit /b 1 :nobody echo %BASE% not found - is the repository complete? exit /b 1 :bad echo BUILD FAILED exit /b 1