├── .timestamps ├── CONTRIB.md ├── DEMOS └── Demo.bat ├── EXAMPLES ├── EX00.BAT ├── EX01.BAT ├── EX02.BAT ├── EX03.BAT ├── EX04.BAT ├── EX05.BAT ├── EX06.BAT ├── EX07.BAT ├── EX08.BAT ├── EX09.BAT ├── EX10.BAT ├── EX11.BAT ├── EX12.BAT ├── EX13.BAT └── README.txt ├── INDEX.md ├── LICENSE ├── LICENSE.BSD ├── LICENSE.GPL ├── LICENSE.MIT ├── README.md ├── README.txt ├── ROADMAP.txt ├── SOURCE ├── APPINFO.LSM ├── COMMON.INC ├── DEBUG.INC ├── DEMOPARS.ASM ├── DSKTLS.INC ├── EXEC.INC ├── FIND.INC ├── INT64.INC ├── MACHINES.INC ├── PARSER.INC ├── SWITCHES.INC ├── TABLES.INC ├── TRANSLAT.INC ├── V8-BIOS.INC ├── V8-DATA.INC ├── V8-DEBUG.INC ├── V8-DOS.INC ├── V8-FINAL.INC ├── V8-GRPHX.INC ├── V8-HELP.INC ├── V8-MACRO.INC ├── V8-PREP.INC ├── V8-STRUC.INC ├── V8-VBIOS.INC ├── VASK.ASM ├── VCHKBOX.ASM ├── VCHOICE.ASM ├── VCLS.ASM ├── VCURSOR.ASM ├── VDELAY.ASM ├── VDELETE.ASM ├── VEACH.ASM ├── VECHO.ASM ├── VERRLVL.ASM ├── VFDUTIL.ASM ├── VFONT.ASM ├── VFRAME.ASM ├── VGOTOXY.ASM ├── VINFO.ASM ├── VINSERT.ASM ├── VLINE.ASM ├── VMATH.ASM ├── VMODE.ASM ├── VPAUSE.ASM ├── VPCSPKR.ASM ├── VPROGRES.ASM ├── VREADKEY.ASM ├── VSTR.ASM ├── VTEST.ASM ├── VVER.ASM └── VVIEW.ASM ├── VNLSTEST ├── CP857.V8F ├── CP858.V8F ├── CP866.V8F └── VNLSTEST.BAT ├── mkClean.bat ├── mkV8.bat ├── mkv8.sh └── release.sh /CONTRIB.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Thank you for you interest to improve this project. If your contribution is 4 | accepted, it will be bound by the multi-open source license of the project. 5 | For more information, see the [LICENSE](LICENSE) file. 6 | 7 | ### Contributing Language Translations 8 | 9 | Please do not submit langauges translations directly to this project. The 10 | language files *(if any)* that may be in this source tree are **NOT** included 11 | in the software releases. If any exist in this project, they are for development 12 | purposes only. When a version of this project is built and released, all 13 | language files are pulled directly from the versions in the 14 | [FD-NLS](https://github.com/shidel/fd-nls) project. If you wish to provide an 15 | additional language translation or make corrections to an existing one, please 16 | update the corresponding files in the [FD-NLS](https://github.com/shidel/fd-nls) 17 | project. -------------------------------------------------------------------------------- /DEMOS/Demo.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem Please note, the only reason this demo uses very poor and 3 | rem inconsistent command-line formatting, is to demonstrate the flexibility 4 | rem of the V8Power Tools option parsing. 5 | 6 | if exist DEMOS\NUL cd DEMOS 7 | if exist ..\BIN\VCLS.COM goto LetsGo 8 | if exist ..\VCLS.COM goto LetsGo 9 | 10 | :MissingTools 11 | echo Unable to locate V8Power Tools. 12 | echo You may need to build them using the mkV8.bat script. 13 | goto Done 14 | 15 | :LetsGo 16 | cd .. 17 | if exist BIN\VCLS.COM cd BIN 18 | 19 | rem DosBOX Test 20 | set DBTEST=y 21 | echo. | set /p DBTEST= 22 | if "%DBTEST%" == "y" goto DosBOX 23 | vcursor | set /p MYCURSOR= 24 | goto NotDosBOX 25 | :DosBOX 26 | set MYCURSOR=small 27 | :NotDosBOX 28 | vcursor hide 29 | 30 | :StartUp 31 | vcls /fGray /bBlue /c 0xb0 32 | rem Title Bar 33 | vgotoxy /x1/y1 34 | vcls /b Gray /f Black EOL 35 | vgotoxy /x 28 /y 1 36 | vecho /s- /f Black "Something " /fRed '1.0' /fBlack " Installation" 37 | 38 | rem Temporary bottom menu bar 39 | vgotoxy eop /x1 40 | vcls /bGray /fBlack /c0 EOL 41 | vgotoxy eop sor 42 | vecho /s- /n "Previous " /fWhite "(" /fRed "Alt+P" /fWhite ")" 43 | vgotoxy right 44 | vecho /n "|" 45 | vgotoxy right 46 | vecho /s- /n "Next " /fWhite "(" /fRed "Alt+N" /fWhite ")" 47 | vgotoxy /x68 48 | vecho /s- /n "Quit " /fWhite "(" /fRed "Alt+Q" /fWhite ")" 49 | 50 | vframe /bBlue /fGray /x16 /y7 /w48 /h11 Hidden Shadow 51 | vframe /x18 /y7 /w44 /h11 DoubleSides 52 | vcls /L /fYellow 53 | vecho 54 | vecho /fLightGreen " What would you like to see?" 55 | vline Hidden Dumb 56 | 57 | :TryAgain 58 | vecho /fLightCyan " X." /fYellow "Progress and Multi-Window Demo " 59 | vecho /fLightGreen " 5)" /fYellow "Display Locations and Writing Demo " 60 | vecho /fLightGreen " b:" /fYellow "Cursor Movement Demo " 61 | vecho 62 | vgotoxy /l /x8 63 | vecho /n /fWhite " 0" /fGray - /fLightRed "Return to " 64 | vecho /n /fLightMagenta "DOS " 65 | 66 | vchoice auto /d100/t15/fWhite/bRed 67 | 68 | if errorlevel 4 goto AllDone 69 | if ERRORLEVEL 3 goto PartC 70 | if errorlevel 2 goto PartB 71 | if errorlevel 1 goto PartA 72 | 73 | rem goto TryAgain 74 | goto NextPart 75 | :PartA 76 | vcls /fGray /bBlue /c 0xb0 /y2/h23 77 | 78 | rem make top left frame and put some text there 79 | vframe /bGray /fBlue /x4 /y5 /w35 /h10 Single Shadow 80 | vcls /L /fBlack 81 | vecho "Top Left frame." 82 | 83 | rem make top right frame and put some text there 84 | vframe /bGray /fRed /x42 /y5 /w35 /h10 Double Shadow 85 | vcls /L /fBlack 86 | vecho "Top Right frame." 87 | vpcspkr 200:200 200 200:200 200 200:200 200 88 | vpcspkr 150:100 100 250:100 100 200:200 200 89 | vpcspkr 150:100 100 250:100 100 200:200 200 0 90 | 91 | rem Progress bar frame 92 | vframe /bBlue /fLightCyan /x6 /y18 /w70 /h3 Hidden Shadow 93 | vprogres 0 left 94 | 95 | rem back to Top Left Frame 96 | vgotoxy /g /x5 /y6 97 | vgotoxy /l eot next next 98 | vecho /fRed "Blah, Blah, Blah." 99 | vdelay 500 100 | vgotoxy /x7 /y19 101 | vprogres 1 left 102 | 103 | rem back to Top Left Frame 104 | vgotoxy /g /x43 /y6 105 | vgotoxy /l eot next next 106 | vecho /fBlue "Blah, Blah, Blah." 107 | vdelay 500 108 | vgotoxy /x7 /y19 109 | vprogres 2 left 110 | 111 | rem back and forth a bit 112 | vgotoxy /x 5 /y 6 /l eot next next 113 | vecho /fBlue "More, More, More." 114 | vdelay 250 115 | vgotoxy /x7 /y19 116 | vprogres 3 left 117 | 118 | vgotoxy /x43/y6 /l eot next next 119 | vecho /fRed "More, More, More." 120 | vdelay 250 121 | vgotoxy /x7 /y19 122 | vprogres 4 left 123 | 124 | vgotoxy /x5/y6/l eot next next 125 | vecho /fRed "More, More, More." 126 | vdelay 250 127 | vgotoxy /x7 /y19 128 | vprogres 5 right 129 | vgotoxy /x43/y6/l eot next next 130 | vecho /fBlue "More, More, More." 131 | vdelay 250 132 | vgotoxy /x7 /y19 133 | vprogres 6 right 134 | vgotoxy /x5/y6/l eot next next 135 | vecho /fBlue "More, More, More." 136 | vdelay 250 137 | vgotoxy /x7 /y19 138 | vprogres 7 right 139 | vgotoxy /x43/y6/l eot next next 140 | vecho /fRed "More, More, More." 141 | vdelay 250 142 | vgotoxy /x7 /y19 143 | vprogres 8 right 144 | vgotoxy /x5/y6/l eot next next 145 | vecho /fRed "More, More, More." 146 | vdelay 250 147 | vgotoxy /x7 /y19 148 | vprogres 9 right 149 | vgotoxy /x43/y6/l eot next next 150 | vecho /fBlue "More, More, More." 151 | vdelay 250 152 | vgotoxy /x7 /y19 153 | vprogres 10 right 154 | vgotoxy /x5/y6/l eot next next 155 | vecho /fBlue "More, More, More." 156 | vdelay 250 157 | vgotoxy /x7 /y19 158 | vprogres 11 159 | vgotoxy /x43/y6/l eot next next 160 | vecho /fRed "More, More, More." 161 | vdelay 250 162 | vgotoxy /x7 /y19 163 | vprogres 12 164 | vgotoxy /x5/y6/l eot next next 165 | vecho /fRed "More, More, More." 166 | vdelay 250 167 | vgotoxy /x7 /y19 168 | vprogres 15 169 | vgotoxy /x43/y6/l eot next next 170 | vecho /fBlue "More, More, More." 171 | 172 | vgotoxy /x7 /y19 173 | vprogres 49 174 | vdelay 500 175 | vgotoxy /x7 /y19 176 | vprogres 50 177 | vdelay 500 178 | vgotoxy /x7 /y19 179 | vprogres 51 180 | vdelay 500 181 | vgotoxy /x7 /y19 182 | vprogres 52 183 | vdelay 500 184 | 185 | vgotoxy /x5/y6/l eot 186 | vecho 187 | vecho 188 | vecho /fBlue "Faster, faster and faster." 189 | vgotoxy /x43/y6/l eot 190 | vecho 191 | vecho 192 | vecho /fRed "Faster, faster and faster." 193 | vgotoxy /x5/y6/l eot next next 194 | vecho /fRed "Faster, faster and faster." 195 | vgotoxy /x43/y6/l eot next next 196 | vecho /fBlue "Faster, faster and faster." 197 | vgotoxy /x5/y6/l eot next next 198 | vecho /fBlue "Faster, faster and faster." 199 | vgotoxy /x43/y6/l eot next next 200 | vecho /fRed "Faster, faster and faster." 201 | vgotoxy /x5/y6/l eot next next 202 | vecho /fRed "Faster, faster and faster." 203 | vgotoxy /x43/y6/l eot next next 204 | vecho /fBlue "Faster, faster and faster." 205 | vgotoxy /x5/y6/l eot next next 206 | vecho /fBlue "Faster, faster and faster." 207 | vgotoxy /x43/y6/l eot next next 208 | vecho /fRed "Faster, faster and faster." 209 | vgotoxy /x5/y6/l eot next next 210 | vecho /fRed "Faster, faster and faster." 211 | vgotoxy /x43/y6/l eot next next 212 | vecho /fBlue "Faster, faster and faster." 213 | 214 | vgotoxy /x7 /y19 215 | vprogres 98 216 | vdelay 1000 217 | vgotoxy /x7 /y19 218 | vprogres 99 219 | vdelay 1000 220 | vgotoxy /x7 /y19 221 | vprogres 100 222 | vdelay 3000 223 | 224 | vgotoxy /x5/y6 225 | vcls /l/fBlue 226 | vecho "Now I will write " /fRed "V8Power Tools!" 227 | vecho /n /fBlue "in the other box " 228 | vecho /fBlack 10,000 /fBlue " times." 229 | vgotoxy /x43/y6/l 230 | vcls /l/fRed 231 | vdelay 2000 232 | vecho /fRed /r10000 "V8Power Tools! " 233 | vgotoxy /x5/y6/l eot next 234 | vecho 235 | vecho 236 | vecho /fRed "Pretty neat, eh?" 237 | vdelay 2000 238 | 239 | goto NextPart 240 | 241 | :PartB 242 | vcls /b Red /f White 243 | vdelay 500 244 | 245 | vcls /b Green /f LightCyan 246 | vdelay 500 247 | vcls /b Blue /f Yellow 248 | vgotoxy /x20 /y20 249 | vecho /n "You have just experienced a blue screen. " 250 | vdelay 3000 251 | vecho /fGray "(" /fWhite "Of Life!" /fgray ')' 252 | vdelay 2000 253 | vframe /bGray /fBlack /x10/y5/w60/h8 Single 254 | vecho /fRed "There is a box on it!" 255 | vdelay 2000 256 | vecho /fBlue "You can write text to it!" 257 | vdelay 2000 258 | vecho /n /fBlue "and more text!" 259 | vdelay 1000 260 | vecho /fRed "and more!" 261 | vdelay 500 262 | vecho /fRed "and more!" 263 | vdelay 500 264 | vecho /fRed "and more!" 265 | vdelay 500 266 | vecho /fBrown "(Oops, I ran out of room. So, I had to scroll a little.)" /fred "and more!" 267 | vdelay 1000 268 | vecho /n /fRed "and more!" 269 | vdelay 1000 270 | vgotoxy /x 30 /y 15 271 | vecho /fRed /bWhite " Or not " 272 | vdelay 2000 273 | vecho "The text goes where you want it to!" 274 | vdelay 1000 275 | vecho "With very little effort." 276 | vdelay 2000 277 | 278 | vcls /b red 279 | vframe /bBlue /fCyan /x20/y10/w40/h6 Double 280 | vecho "This box has double sides box." 281 | vdelay 3000 282 | vframe /bBlue /fYellow /x20/y10/w40/h6 SingleSides 283 | vecho "This box has single sides and double top and bottom edges." 284 | vdelay 3000 285 | vframe /bBlue /fWhite /x20/y10/w40/h6 DoubleSides 286 | vecho "This box has double sides and single top and bottom edges." 287 | vdelay 3000 288 | vframe /bBlue /fLightGreen /x20/y10/w40/h6 Hidden 289 | vecho "This hidden edge box. Great for making text areas with margins." 290 | vdelay 3000 291 | vcls /l 292 | vdelay 2000 293 | vecho "That was a local clear screen." 294 | vdelay 2000 295 | vcls /g 296 | vdelay 1000 297 | vecho "That was a global clear screen." 298 | vdelay 2000 299 | 300 | vcls /bblue 301 | vframe /bGray /fWhite /x10/y5/w60/h15 Double 302 | vecho "This is another box." 303 | vdelay 1000 304 | vgotoxy /l /x 3 /y 3 305 | vecho "This is Local position 3x3." 306 | vdelay 1000 307 | vgotoxy /g /x 3 /y 3 308 | vecho "This is global position 3x3." 309 | vdelay 3000 310 | 311 | vcls /bblue 312 | vframe /bGray /fWhite /x15/y1/w10/h4 Double 313 | vframe /bGray /fWhite /x5/y7/w20/h5 Double 314 | vgotoxy /l /x1/y2 315 | vecho "Box characters cause interesting things with the vecho command" 316 | vgotoxy /g/x1/y1 317 | vecho "Box characters cause interesting things with the vecho command" 318 | vdelay 3000 319 | 320 | vcls /b Green /f LightCyan 321 | vecho "This screen is environmentally friendly." 322 | vdelay 2000 323 | 324 | goto NextPart 325 | 326 | :PartC 327 | vcursor Full 328 | vcls /bblue /fwhite 329 | 330 | vframe /bGray /fBlack /x5/y5/w70/h15 Single 331 | 332 | vcls /l 333 | vgotoxy /x25/y13 334 | vecho /n "First move to start of line." 335 | vgotoxy /l sol 336 | vdelay 2000 337 | 338 | vcls /l 339 | vgotoxy /x25/y13 340 | vecho /n "Now move to end of line." 341 | vgotoxy /l eol 342 | vdelay 2000 343 | 344 | vcls /l 345 | vgotoxy /x25/y13 346 | vecho /n "Next move to start of row." 347 | vgotoxy /l sor 348 | vdelay 2000 349 | 350 | vcls /l 351 | vgotoxy /x25/y13 352 | vecho /n "Now move to end of row." 353 | vgotoxy /l eor 354 | vdelay 2000 355 | 356 | vcls /l 357 | vgotoxy /x25/y13 358 | vecho "Now move to start of page." 359 | vgotoxy /l sop 360 | vdelay 2000 361 | 362 | vcls /l 363 | vgotoxy /x25/y13 364 | vecho "Now move to end of page." 365 | vgotoxy /l eop 366 | vdelay 2000 367 | 368 | vcls /l 369 | vgotoxy /x25/y12 370 | vecho "Now move to start of text" 371 | vgotoxy /x25/y14 372 | vecho "(then -1)." 373 | vgotoxy /l sot previous 374 | vdelay 2000 375 | 376 | vcls /l 377 | vgotoxy /x25/y12 378 | vecho "Now move to end of text" 379 | vgotoxy /x25/y14 380 | vecho "(then +1)." 381 | vgotoxy /l eot next 382 | vdelay 2000 383 | 384 | vcls /l 385 | vgotoxy /x15/y13 386 | vecho /n "Finally, Lets Just move the cursor around a bit." 387 | vdelay 1000 388 | vgotoxy /l left 389 | vdelay 200 390 | vgotoxy /l left 391 | vdelay 200 392 | vgotoxy /l left 393 | vdelay 200 394 | vgotoxy /l left 395 | vdelay 200 396 | vgotoxy /l left 397 | vdelay 200 398 | vgotoxy /l left 399 | vdelay 200 400 | vgotoxy /l left 401 | vdelay 200 402 | vgotoxy /l left 403 | vdelay 200 404 | 405 | vgotoxy /l up 406 | vdelay 200 407 | vgotoxy /l up 408 | vdelay 200 409 | vgotoxy /l up 410 | vdelay 200 411 | vgotoxy /l up 412 | vdelay 200 413 | vgotoxy /l up 414 | vdelay 200 415 | vgotoxy /l up 416 | vdelay 200 417 | 418 | vgotoxy /l right 419 | vdelay 200 420 | vgotoxy /l right 421 | vdelay 200 422 | vgotoxy /l right 423 | vdelay 200 424 | vgotoxy /l right 425 | vdelay 200 426 | vgotoxy /l right 427 | vdelay 200 428 | vgotoxy /l right 429 | vdelay 200 430 | vgotoxy /l right 431 | vdelay 200 432 | vgotoxy /l right 433 | vdelay 200 434 | 435 | vgotoxy /l down 436 | vdelay 200 437 | vgotoxy /l down 438 | vdelay 200 439 | vgotoxy /l down 440 | vdelay 200 441 | vgotoxy /l down 442 | vdelay 200 443 | vgotoxy /l down 444 | vdelay 200 445 | vgotoxy /l down 446 | vdelay 200 447 | 448 | vdelay 1000 449 | 450 | vcls /l 451 | vgotoxy /x25/y13 452 | vecho "All done." 453 | vdelay 2000 454 | vcursor hide 455 | goto NextPart 456 | 457 | :NextPart 458 | goto StartUp 459 | 460 | :AllDone 461 | vcls /bBlue 462 | vdelay 1000 463 | 464 | vcls /a0x07 465 | vecho Goodbye... 466 | rem restore the cursor size and shape 467 | vcursor %MYCURSOR% 468 | set MYCURSOR= 469 | set DOSBOX_TEST= 470 | :Done 471 | if not exist DEMOS cd .. 472 | if exist DEMOS cd DEMOS 473 | -------------------------------------------------------------------------------- /EXAMPLES/EX00.BAT: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM Test for Presence of V8Power Tools 4 | 5 | :CheckPresence 6 | verrlvl 255 7 | if errorlevel 255 goto ClearError 8 | 9 | :V8Missing 10 | echo V8Power Tools were not found. 11 | goto DontDoAnything 12 | 13 | :ClearError 14 | verrlvl 0 15 | if errorlevel 1 goto V8Missing 16 | echo V8Power Tools are installed. 17 | 18 | :StartBatch 19 | REM Do Some Stuff Here 20 | 21 | :DontDoAnything 22 | -------------------------------------------------------------------------------- /EXAMPLES/EX01.BAT: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM Test for Presence of V8Power Tools, default DOSBox command shell and 4 | REM the presence of "SET /P" support. 5 | 6 | verrlvl 255 7 | if errorlevel 255 goto ClearError 8 | 9 | :V8Missing 10 | echo V8Power Tools were not found. 11 | goto DontDoAnything 12 | 13 | :ClearError 14 | verrlvl 0 15 | if errorlevel 1 goto V8Missing 16 | 17 | :V8Present 18 | REM Test if running under the standard DOSBox command shell or if any other 19 | REM command shell that does not support SET /P 20 | set SetPCheck=n 21 | echo. | set /p SetPCheck= 22 | if "%SetPCheck%" == "n" goto SetPFailure 23 | echo y| set /p SetPCheck= 24 | if "%SetPCheck%" == "y" goto SetPSupport 25 | 26 | :SetPFailure 27 | echo This Example is running using a commmand shell that does not support "SET /P". 28 | goto StartBatch 29 | 30 | :SetPSupport 31 | echo Advanced "SET /P" functionality supported. 32 | goto StartBatch 33 | 34 | :StartBatch 35 | REM Do Some Stuff Here 36 | 37 | :CleanUpBatch 38 | set SetPCheck= 39 | 40 | :DontDoAnything -------------------------------------------------------------------------------- /EXAMPLES/EX02.BAT: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | verrlvl 255 4 | if errorlevel 255 goto ClearError 5 | 6 | :V8Missing 7 | echo V8Power Tools were not found. 8 | goto DontDoAnything 9 | 10 | :ClearError 11 | verrlvl 0 12 | if errorlevel 1 goto V8Missing 13 | 14 | :V8Present 15 | REM Test if running under the standard DOSBox command shell or if any other 16 | REM command shell that does not support SET /P 17 | set SetPCheck=n 18 | echo. | set /p SetPCheck= 19 | if "%SetPCheck%" == "n" goto SmallCursor 20 | echo y| set /p SetPCheck= 21 | if "%SetPCheck%" == "y" goto SaveCursor 22 | 23 | :SmallCursor 24 | set SavedCursor=small 25 | goto StartBatch 26 | 27 | :SaveCursor 28 | vcursor | set /p SavedCursor= 29 | 30 | :StartBatch 31 | vcursor hide 32 | 33 | REM Do Some Stuff Here 34 | echo Cursor hidden with a 2 second delay 35 | vdelay 2000 36 | 37 | :CleanUpBatch 38 | REM Restore the cursor size and shape. 39 | vcursor %SavedCursor% 40 | set SetPCheck= 41 | set SavedCursor= 42 | 43 | :DontDoAnything -------------------------------------------------------------------------------- /EXAMPLES/EX03.BAT: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | verrlvl 255 4 | if errorlevel 255 goto ClearError 5 | 6 | :V8Missing 7 | echo V8Power Tools were not found. 8 | goto DontDoAnything 9 | 10 | :ClearError 11 | verrlvl 0 12 | if errorlevel 1 goto V8Missing 13 | 14 | :V8Present 15 | set SavedCursor=small 16 | set SetPCheck=n 17 | echo. | set /p SetPCheck= 18 | if "%SetPCheck%" == "n" goto StartBatch 19 | echo y| set /p SetPCheck= 20 | if not "%SetPCheck%" == "y" goto StartBatch 21 | vcursor | set /p SavedCursor= 22 | 23 | :StartBatch 24 | vcursor hide 25 | 26 | REM Clear entire screen and fill with character 0xb0. 27 | REM ASCII values can easily be found using the "vinfo ascii" to display 28 | REM the ascii/hex table. 29 | vcls /fGray /bBlue /c0xb0 30 | 31 | REM Draw the Title Bar 32 | vgotoxy /x1 /y1 33 | vcls /bGray /fBlack EOL 34 | vgotoxy /x22 /y1 35 | vecho /fBlack "Some kind of program" /fRed '1.2.3' /fBlack Installer 36 | 37 | REM Move cursor to end of the page, then column 1. You should use this 38 | REM method to prevent issues if the screen is not using 25 rows of text. 39 | vgotoxy eop /x1 40 | 41 | REM Clear from cursor to end of line using a NULL Character in preparation 42 | REM for buttons and hot-key sequences. 43 | vcls /bGray /fBlack /c0 EOL 44 | 45 | REM Wait for 5 seconds 46 | vdelay 5000 47 | 48 | :CleanUpBatch 49 | REM Clear the screen with DOS default text attribute Light Grey on Black. 50 | vcls /a0x07 51 | 52 | REM Restore the cursor size and shape. 53 | vcursor %SavedCursor% 54 | set SetPCheck= 55 | set SavedCursor= 56 | 57 | :DontDoAnything -------------------------------------------------------------------------------- /EXAMPLES/EX04.BAT: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | verrlvl 255 4 | if errorlevel 255 goto ClearError 5 | 6 | :V8Missing 7 | echo V8Power Tools were not found. 8 | goto DontDoAnything 9 | 10 | :ClearError 11 | verrlvl 0 12 | if errorlevel 1 goto V8Missing 13 | 14 | :V8Present 15 | set SavedCursor=small 16 | set SetPCheck=n 17 | echo. | set /p SetPCheck= 18 | if "%SetPCheck%" == "n" goto StartBatch 19 | echo y| set /p SetPCheck= 20 | if not "%SetPCheck%" == "y" goto StartBatch 21 | vcursor | set /p SavedCursor= 22 | 23 | :StartBatch 24 | vcursor hide 25 | 26 | REM Clear entire screen and fill with character 0xb0. 27 | REM ASCII values can easily be found using the "vinfo ascii" to display 28 | REM the ascii/hex table. 29 | vcls /fCyan /bBlue /c0xb0 30 | 31 | REM Move cursor to end of page, then start of line 32 | vgotoxy eop sol 33 | vecho /n /fWhite "Press a key to continue... " 34 | vpause /fYellow /t10 35 | 36 | :CleanUpBatch 37 | REM Clear the screen with DOS default text attribute Light Grey on Black. 38 | vcls /a0x07 39 | 40 | REM Restore the cursor size and shape. 41 | vcursor %SavedCursor% 42 | set SetPCheck= 43 | set SavedCursor= 44 | 45 | :DontDoAnything -------------------------------------------------------------------------------- /EXAMPLES/EX05.BAT: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | verrlvl 255 4 | if errorlevel 255 goto ClearError 5 | 6 | :V8Missing 7 | echo V8Power Tools were not found. 8 | goto DontDoAnything 9 | 10 | :ClearError 11 | verrlvl 0 12 | if errorlevel 1 goto V8Missing 13 | 14 | :V8Present 15 | set SavedCursor=small 16 | set SetPCheck=n 17 | echo. | set /p SetPCheck= 18 | if "%SetPCheck%" == "n" goto StartBatch 19 | echo y| set /p SetPCheck= 20 | if not "%SetPCheck%" == "y" goto StartBatch 21 | vcursor | set /p SavedCursor= 22 | 23 | :StartBatch 24 | vcursor hide 25 | 26 | REM Clear entire screen and fill with character 0xb0. 27 | REM ASCII values can easily be found using the "vinfo ascii" to display 28 | REM the ascii/hex table. 29 | vcls /fGray /bBlue /c0xb0 30 | 31 | REM Draw a frame to contain our question and choices 32 | vframe /x20 /y7 /h11 /w40 /fBlack /bGray Single Shadow 33 | 34 | REM Cursor is inside frame by default. So, just ask our question. 35 | vecho 36 | vecho /fBlue " Do you like pizza?" 37 | 38 | REM Separate the question from choices. 39 | vline hidden 40 | 41 | REM Display the choices. 42 | REM Note: if you write do many choices, they will begin to scroll off. So, 43 | REM the first choice "Leave me alone" will be missing and technically will 44 | REM not exist and "Absolutely" will become choice 1. 45 | 46 | vecho " Leave me alone." 47 | vecho " Absolutely!" 48 | vecho " Only on "/fGreen "Thursdays." 49 | vecho " Never on " /fRed "Wednesdays." 50 | vecho 51 | vecho " How dare you ask me such a thing!" 52 | 53 | REM vchoice will use the use the current cursor location to detect the 54 | REM area that contains the choices. Since the cursor is still inside the 55 | REM frame and below the line, we can just call vchoice and set it's 56 | REM selected color and default value. 57 | vchoice /fLightGreen /bBlack /t15 /d3 58 | 59 | REM error 100 is always a bad parameter regardless of what tool is called. 60 | if errorlevel 100 goto AbortBatch 61 | 62 | if errorlevel 4 goto CHOICE4 63 | if errorlevel 3 goto CHOICE3 64 | if errorlevel 2 goto CHOICE2 65 | if errorlevel 1 goto CHOICE1 66 | 67 | REM Should never get here. 68 | goto AbortBatch 69 | 70 | :CHOICE4 71 | vcls /fWhite /bBlack 72 | vecho "Choice 4" 73 | vdelay 2000 74 | goto DoneBatch 75 | 76 | :CHOICE3 77 | vcls /fWhite /bBlack 78 | vecho "Choice 3" 79 | vdelay 2000 80 | goto DoneBatch 81 | 82 | :CHOICE2 83 | vcls /fWhite /bBlack 84 | vecho "Choice 2" 85 | vdelay 2000 86 | goto DoneBatch 87 | 88 | :CHOICE1 89 | vcls /fWhite /bBlack 90 | vecho "Choice 1" 91 | vdelay 2000 92 | goto DoneBatch 93 | 94 | :DoneBatch 95 | REM Batch file has completed. 96 | goto CleanUpBatch 97 | 98 | :AbortBatch 99 | REM Abort and cleanup 100 | 101 | :CleanUpBatch 102 | REM Clear the screen with DOS default text attribute Light Grey on Black. 103 | vcls /a0x07 104 | 105 | REM Restore the cursor size and shape. 106 | vcursor %SavedCursor% 107 | set SetPCheck= 108 | set SavedCursor= 109 | 110 | :DontDoAnything -------------------------------------------------------------------------------- /EXAMPLES/EX06.BAT: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | verrlvl 255 4 | if errorlevel 255 goto ClearError 5 | 6 | :V8Missing 7 | echo V8Power Tools were not found. 8 | goto DontDoAnything 9 | 10 | :ClearError 11 | verrlvl 0 12 | if errorlevel 1 goto V8Missing 13 | 14 | :V8Present 15 | set SetPCheck=n 16 | echo. | set /p SetPCheck= 17 | if "%SetPCheck%" == "n" goto SetPFailure 18 | echo y| set /p SetPCheck= 19 | if not "%SetPCheck%" == "y" goto SetPFailure 20 | vcursor | set /p SavedCursor= 21 | goto StartBatch 22 | 23 | :SetPFailure 24 | set SetPCheck= 25 | vecho Unable to run example. /fYellow "SET /P" /fGray support is required. 26 | goto DontDoAnything 27 | 28 | :StartBatch 29 | vcursor hide 30 | 31 | REM Clear entire screen and fill with character 0xb0. 32 | REM ASCII values can easily be found using the "vinfo ascii" to display 33 | REM the ascii/hex table. 34 | vcls /fGray /bBlue /c0xb0 35 | 36 | REM Draw a frame to contain our question and choices 37 | vframe /x20 /y7 /h12 /w40 /fBlack /bGray Double Shadow 38 | 39 | REM Cursor is inside frame by default. So, just ask our question. 40 | vecho 41 | vecho /fBlue " Do you like pizza?" 42 | 43 | REM Separate the question from choices. 44 | vline hidden 45 | 46 | REM Display the choices. 47 | vecho " Leave me alone." 48 | vecho " Absolutely!" 49 | vecho " Only on "/fGreen "Thursdays." 50 | vecho " Never on " /fRed "Wednesdays." 51 | vecho 52 | vecho " How dare you ask me such a thing!" 53 | 54 | REM vchoice will use the use the current cursor location to detect the 55 | REM area that contains the choices. Since the cursor is still inside the 56 | REM frame and below the line, we can just call vchoice and set it's 57 | REM selected color and default value. 58 | vchoice /fLightGreen /bBlack /t15 /d3 /q | set /p MyChoice= 59 | 60 | REM error 100 is always a bad parameter regardless of what tool is called. 61 | if errorlevel 100 goto AbortBatch 62 | 63 | vcls /fGray /bBlack 64 | vecho 'You have chosen "' /bBlue /fYellow "%MyChoice%" /fGray /bBlack /s- '"' 65 | vdelay 2000 66 | 67 | :DoneBatch 68 | REM Batch file has completed. 69 | goto CleanUpBatch 70 | 71 | :AbortBatch 72 | REM Abort and cleanup 73 | 74 | :CleanUpBatch 75 | set MyChoice= 76 | 77 | REM Clear the screen with DOS default text attribute Light Grey on Black. 78 | vcls /a0x07 79 | 80 | REM Restore the cursor size and shape. 81 | vcursor %SavedCursor% 82 | set SetPCheck= 83 | set SavedCursor= 84 | 85 | :DontDoAnything -------------------------------------------------------------------------------- /EXAMPLES/EX07.BAT: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | verrlvl 255 4 | if errorlevel 255 goto ClearError 5 | 6 | :V8Missing 7 | echo V8Power Tools were not found. 8 | goto DontDoAnything 9 | 10 | :ClearError 11 | verrlvl 0 12 | if errorlevel 1 goto V8Missing 13 | 14 | :V8Present 15 | set SetPCheck=n 16 | echo. | set /p SetPCheck= 17 | if "%SetPCheck%" == "n" goto SetPFailure 18 | echo y| set /p SetPCheck= 19 | if not "%SetPCheck%" == "y" goto SetPFailure 20 | vcursor | set /p SavedCursor= 21 | goto StartBatch 22 | 23 | :SetPFailure 24 | set SetPCheck= 25 | vecho Unable to run example. /fYellow "SET /P" /fGray support is required. 26 | goto DontDoAnything 27 | 28 | :StartBatch 29 | vcls 30 | set MyCounter=0 31 | vecho "Counting from 0 to 15" /p 32 | 33 | :LoopBatch 34 | vecho "Number " /bGray /f %MyCounter% "%MyCounter% " /fGray /bBlack 8^) 35 | vmath %MyCounter% + 1 | set /p MyCounter= 36 | if not "%MyCounter%" == "16" goto LoopBatch 37 | 38 | :DoneBatch 39 | vecho 40 | 41 | :CleanUpBatch 42 | set MyCounter= 43 | set SetPCheck= 44 | 45 | :DontDoAnything -------------------------------------------------------------------------------- /EXAMPLES/EX08.BAT: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | verrlvl 255 4 | if errorlevel 255 goto ClearError 5 | 6 | :V8Missing 7 | echo V8Power Tools were not found. 8 | goto DontDoAnything 9 | 10 | :ClearError 11 | verrlvl 0 12 | if errorlevel 1 goto V8Missing 13 | 14 | :V8Present 15 | set SetPCheck=n 16 | echo. | set /p SetPCheck= 17 | if "%SetPCheck%" == "n" goto SetPFailure 18 | echo y| set /p SetPCheck= 19 | if not "%SetPCheck%" == "y" goto SetPFailure 20 | vcursor | set /p SavedCursor= 21 | goto StartBatch 22 | 23 | :SetPFailure 24 | set SetPCheck= 25 | vecho Unable to run example. /fYellow "SET /P" /fGray support is required. 26 | goto DontDoAnything 27 | 28 | :StartBatch 29 | vcursor hide 30 | 31 | REM Clear entire screen and fill with character 0xb0. 32 | REM ASCII values can easily be found using the "vinfo ascii" to display 33 | REM the ascii/hex table. 34 | vcls /fGreen /bBlue /c0xb0 35 | 36 | REM Draw a frame to contain text and such. 37 | vframe /h10 /w40 /c /y 5 /fBlack /bGray Double Shadow 38 | vecho /fRed "Doing Progress" 39 | 40 | REM Draw a frame to contain progress bar. 41 | vframe /w60 /h3 /c /y20 /bBlue /fYellow Hidden Shadow 42 | 43 | set MyProgress=0 44 | 45 | :LoopBatch 46 | REM Goto Global 40x21, Switch to Local, goto Start of Page 47 | vgotoxy /x40 /y21 /l sop 48 | 49 | REM Draw Progress bar of MyProgress 50 | vprogres /fYellow %MyProgress% 51 | 52 | REM goto global 40x6, then local mode, end of text, next position. 53 | vgotoxy /x40 /y6 /l eot next 54 | 55 | REM Write ASCII 0x020 (Space) then conuter value, no CRLF. 56 | vecho /n /fBlue /c 0x20 %MyProgress% 57 | 58 | vmath %MyProgress% + 1 | set /p MyProgress= 59 | if not "%MyProgress%" == "111" goto LoopBatch 60 | 61 | vecho 62 | vecho /fRed "You must always give 110% effort." 63 | 64 | vdelay 3000 65 | 66 | :DoneBatch 67 | REM Batch file has completed. 68 | 69 | :CleanUpBatch 70 | set MyProgress= 71 | vcls /a0x07 72 | vcursor %SavedCursor% 73 | set SetPCheck= 74 | set SavedCursor= 75 | 76 | :DontDoAnything -------------------------------------------------------------------------------- /EXAMPLES/EX09.BAT: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | verrlvl 255 4 | if errorlevel 255 goto ClearError 5 | 6 | :V8Missing 7 | echo V8Power Tools were not found. 8 | goto DontDoAnything 9 | 10 | :ClearError 11 | verrlvl 0 12 | if errorlevel 1 goto V8Missing 13 | 14 | :V8Present 15 | set SetPCheck=n 16 | echo. | set /p SetPCheck= 17 | if "%SetPCheck%" == "n" goto SetPFailure 18 | echo y| set /p SetPCheck= 19 | if not "%SetPCheck%" == "y" goto SetPFailure 20 | vcursor | set /p SavedCursor= 21 | goto StartBatch 22 | 23 | :SetPFailure 24 | set SetPCheck= 25 | vecho Unable to run example. /fYellow "SET /P" /fGray support is required. 26 | goto DontDoAnything 27 | 28 | :StartBatch 29 | vcursor hide 30 | 31 | REM Draw welcome text and 4 blank lines. 32 | vecho /fYellow "Scanning Hard Disk Drives" 33 | vecho 34 | vecho 35 | vecho 36 | vecho 37 | 38 | REM move up 3 lines and store location 39 | vgotoxy up up up /Qy | set /p EX09_LINE= 40 | 41 | REM goto end of page, start of row, then up one line 42 | vgotoxy eop sor up 43 | 44 | REM draw the separator line and return to location 45 | vline 46 | vgotoxy /y %EX09_LINE% 47 | 48 | set EX09_COUNTER=0 49 | 50 | :LoopBatch 51 | REM Save Current Line 52 | vgotoxy /Qy | set /p EX09_LINE= 53 | 54 | REM Update Progress Bar 55 | vgotoxy eop sor 56 | vmath %EX09_COUNTER% * 4 | set /p EX09_AMOUNT= 57 | vprogress /fGreen %EX09_AMOUNT% 58 | 59 | REM Return to screen line 60 | vgotoxy /y %EX09_LINE% 61 | 62 | REM Compute Drive Letter 63 | vmath %EX09_COUNTER% + 65 | set /p EX09_DRIVE= 64 | vstr /c %EX09_DRIVE% | set /p EX09_DRIVE= 65 | 66 | REM Show what we are doing now. 67 | vecho /n /fGray "Scanning Drive " /fYellow %EX09_DRIVE% /fGray "..." 68 | 69 | REM Get the drive status. 70 | vinfo /d %EX09_DRIVE% 71 | 72 | if errorlevel 15 goto NoSuchDrive 73 | if errorlevel 5 goto NotFormatted 74 | if errorlevel 4 goto NetworkDrive 75 | if errorlevel 3 goto DiscDrive 76 | if errorlevel 2 goto FloppyDrive 77 | 78 | vgotoxy /x1 79 | vecho /n /fGray "Drive " /fWhite %EX09_DRIVE% /fGray " appears, " /fGreen "OK" 80 | vecho /fGray "." 81 | goto Continued 82 | 83 | :NoSuchDrive 84 | REM Just Ignore it. 85 | goto Continued 86 | 87 | :NotFormatted 88 | vgotoxy /x1 89 | vecho /n /fGray "Drive " /fWhite %EX09_DRIVE% /fGray " appears, " 90 | vecho /fLightRed "UNFORMATTED" /fGray "." 91 | goto Continued 92 | 93 | :NetworkDrive 94 | vgotoxy /x1 95 | vecho /n /fGray "Drive " /fWhite %EX09_DRIVE% /fGray " is " 96 | vecho /fLightMagenta "Remote" /fGray "." 97 | goto Continued 98 | 99 | :DiscDrive 100 | vgotoxy /x1 101 | vecho /n /fGray "Drive " /fWhite %EX09_DRIVE% /fGray " is a " 102 | vecho /fLightCyan "CD/DVD" /fGray " drive." 103 | goto Continued 104 | 105 | :FloppyDrive 106 | vgotoxy /x1 107 | vecho /n /fGray "Drive " /fWhite %EX09_DRIVE% /fGray " uses " 108 | vecho /fLightBlue "Removable" /fGray " media." 109 | goto Continued 110 | 111 | :Continued 112 | 113 | REM Increment the counter and see if we are done. 114 | vmath %EX09_COUNTER% + 1 | set /p EX09_COUNTER= 115 | if not "%EX09_COUNTER%" == "26" goto LoopBatch 116 | 117 | REM Since VCLS starts knowing entire screen, there is a better way 118 | REM of doing this to clear the vline an vprogres bar. 119 | vgotoxy eop /qX | set /p EX09_WIDTH= 120 | vgotoxy up /qY | set /p EX09_LINE= 121 | 122 | vcls /x1 /y %EX09_LINE% /h2 /w %EX09_WIDTH% /a 0x07 123 | 124 | REM Go to Last text on screen, then start of that line. 125 | vgotoxy eot sol 126 | 127 | REM clear from cursor to end of line. 128 | vcls eol 129 | 130 | vecho 131 | vecho "Scan complete." 132 | 133 | :DoneBatch 134 | REM Batch file has completed. 135 | goto CleanUpBatch 136 | 137 | :AbortBatch 138 | REM Abort and cleanup 139 | 140 | :CleanUpBatch 141 | set EX09_COUNTER= 142 | set EX09_AMOUNT= 143 | set EX09_WIDTH= 144 | set EX09_LINE= 145 | set EX09_DRIVE= 146 | 147 | vcursor %SavedCursor% 148 | set SetPCheck= 149 | set SavedCursor= 150 | 151 | :DontDoAnything 152 | 153 | -------------------------------------------------------------------------------- /EXAMPLES/EX10.BAT: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | verrlvl 255 4 | if errorlevel 255 goto ClearError 5 | 6 | :V8Missing 7 | echo V8Power Tools were not found. 8 | goto DontDoAnything 9 | 10 | :ClearError 11 | verrlvl 0 12 | if errorlevel 1 goto V8Missing 13 | 14 | :V8Present 15 | set SetPCheck=n 16 | echo. | set /p SetPCheck= 17 | if "%SetPCheck%" == "n" goto SetPFailure 18 | echo y| set /p SetPCheck= 19 | if not "%SetPCheck%" == "y" goto SetPFailure 20 | vcursor | set /p SavedCursor= 21 | goto StartBatch 22 | 23 | :SetPFailure 24 | set SetPCheck= 25 | vecho Unable to run example. /fYellow "SET /P" /fGray support is required. 26 | goto DontDoAnything 27 | 28 | :StartBatch 29 | vcursor hide 30 | 31 | REM Clear entire screen and fill with character 0xb0. 32 | REM ASCII values can easily be found using the "vinfo ascii" to display 33 | REM the ascii/hex table. 34 | vcls /fGray /bBlue /c0xb0 35 | 36 | REM Draw a frame to contain our question and choices 37 | vframe /x20 /y7 /h12 /w40 /fBlack /bGray Single Shadow 38 | 39 | REM Cursor is inside frame by default. So, just ask our question. 40 | vecho 41 | vecho /fBlue " Do you like pizza?" 42 | 43 | REM Separate the question from choices. 44 | vline hidden 45 | 46 | vgotoxy /x21/y11 47 | 48 | REM Display the choices. 49 | vecho /fBlack /bGray " Leave me alone." 50 | vecho /fBlack /bGray " Absolutely!" 51 | vecho /fBlack /bGray " Only on "/fGreen "Thursdays." 52 | vecho /fBlack /bGray " Never on " /fRed "Wednesdays." 53 | vecho 54 | vecho /fBlack /bGray " How dare you ask me such a thing!" 55 | 56 | REM Polling should start at 1. 57 | set POLLING=1 58 | :PollingLoop 59 | 60 | REM vchoice will use the use the current cursor location to detect the 61 | REM the background color. So move cursor to end and use that color. 62 | vgotoxy /x40/y11 /l eop 63 | vchoice /fLightGreen /bBlack /t15 /d5 /p %POLLING% 64 | 65 | REM errorlevel 101-199 is a Polling result, not a selection. 66 | if errorlevel 105 goto POLLING105 67 | if errorlevel 104 goto POLLING104 68 | if errorlevel 103 goto POLLING103 69 | if errorlevel 102 goto POLLING102 70 | if errorlevel 101 goto POLLING101 71 | 72 | REM error 100 is always a bad parameter regardless of what tool is called. 73 | if errorlevel 100 goto AbortBatch 74 | 75 | if errorlevel 5 goto CHOICE5 76 | if errorlevel 4 goto CHOICE4 77 | if errorlevel 3 goto CHOICE3 78 | if errorlevel 2 goto CHOICE2 79 | if errorlevel 1 goto CHOICE1 80 | 81 | REM Should never get here. 82 | goto AbortBatch 83 | 84 | :POLLING101 85 | set POLLING=1 86 | vframe /w60/h3/c/y21 /a0x17 hidden shadow 87 | vecho /n /fWhite "Choice 1 - Don't bug me!" 88 | goto PollingLoop 89 | 90 | :POLLING102 91 | set POLLING=2 92 | vframe /w60/h3/c/y21 /a0x17 hidden shadow 93 | vecho /n /fLightCyan "Choice 2 - Awesome, lets eat!" 94 | goto PollingLoop 95 | 96 | :POLLING103 97 | set POLLING=3 98 | vframe /w60/h3/c/y21 /a0x17 hidden shadow 99 | vecho /n /fLightMagenta "Choice 3 - I'm antisocial." 100 | goto PollingLoop 101 | 102 | :POLLING104 103 | set POLLING=4 104 | vframe /w60/h3/c/y21 /a0x17 hidden shadow 105 | vecho /n /fLightGreen "Choice 4 - I'm on a diet." 106 | goto PollingLoop 107 | 108 | :POLLING105 109 | set POLLING=5 110 | vframe /w60/h3/c/y21 /a0x17 hidden shadow 111 | vecho /n /fLightRed "Choice 5 - I'm offended you would ask." 112 | goto PollingLoop 113 | 114 | :CHOICE5 115 | vcls /fWhite /bBlack 116 | vecho "Choice 5" 117 | vdelay 2000 118 | goto DoneBatch 119 | 120 | :CHOICE4 121 | vcls /fWhite /bBlack 122 | vecho "Choice 4" 123 | vdelay 2000 124 | goto DoneBatch 125 | 126 | :CHOICE3 127 | vcls /fWhite /bBlack 128 | vecho "Choice 3" 129 | vdelay 2000 130 | goto DoneBatch 131 | 132 | :CHOICE2 133 | vcls /fWhite /bBlack 134 | vecho "Choice 2" 135 | vdelay 2000 136 | goto DoneBatch 137 | 138 | :CHOICE1 139 | vcls /fWhite /bBlack 140 | vecho "Choice 1" 141 | vdelay 2000 142 | goto DoneBatch 143 | 144 | :DoneBatch 145 | REM Batch file has completed. 146 | goto CleanUpBatch 147 | 148 | :AbortBatch 149 | REM Abort and cleanup 150 | 151 | :CleanUpBatch 152 | vcls /a0x07 153 | vcursor %SavedCursor% 154 | set SetPCheck= 155 | set SavedCursor= 156 | 157 | :DontDoAnything -------------------------------------------------------------------------------- /EXAMPLES/EX11.BAT: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | verrlvl 255 4 | if errorlevel 255 goto ClearError 5 | 6 | :V8Missing 7 | echo V8Power Tools were not found. 8 | goto DontDoAnything 9 | 10 | :ClearError 11 | verrlvl 0 12 | if errorlevel 1 goto V8Missing 13 | 14 | :V8Present 15 | set SetPCheck=n 16 | echo. | set /p SetPCheck= 17 | if "%SetPCheck%" == "n" goto SetPFailure 18 | echo y| set /p SetPCheck= 19 | if not "%SetPCheck%" == "y" goto SetPFailure 20 | vcursor | set /p SavedCursor= 21 | goto StartBatch 22 | 23 | :SetPFailure 24 | set SetPCheck= 25 | vecho Unable to run example. /fYellow "SET /P" /fGray support is required. 26 | goto DontDoAnything 27 | 28 | :StartBatch 29 | set EX11_COUNTER=0x0000 30 | vecho "Running through Vesa Modes" 31 | vecho Press CTRL+C at any time to abort. 32 | vpause /d 2 CTRL-C 33 | if errorlevel 200 goto AbortBatch 34 | 35 | :LoopBatch 36 | vmode C80 37 | vmode vesa | vstr /l %EX11_COUNTER% | set /p EX11_VMODE= 38 | if "%EX11_VMODE%" == "" goto DoneBatch 39 | 40 | vecho /n "Trying Vesa Mode %EX11_VMODE% in " 41 | vpause /d 2 CTRL-C 42 | if errorlevel 200 goto AbortBatch 43 | 44 | vmode %EX11_VMODE% 45 | 46 | vecho /n "This is Vesa Mode %EX11_VMODE%. " 47 | 48 | REM find screen dimensions 49 | vgotoxy eop eor 50 | vgotoxy /Qx | set /P EX11_MAXX= 51 | vgotoxy /Qy | set /P EX11_MAXY= 52 | REM convert from hex to decimal 53 | vmath %EX11_MAXX% | set /P EX11_MAXX= 54 | vmath %EX11_MAXY% | set /P EX11_MAXY= 55 | 56 | vgotoxy /x1 /y2 57 | vecho /fYellow :-) /p /fLightGreen Supports /fGray %EX11_MAXX% x %EX11_MAXY% text. 58 | 59 | vpause /d 2 CTRL-C 60 | if errorlevel 200 goto AbortBatch 61 | 62 | vmath %EX11_COUNTER% + 1 /h | set /p EX11_COUNTER= 63 | if not "%EX11_COUNTER%" == "1000" goto LoopBatch 64 | 65 | :DoneBatch 66 | vmode C80 67 | vecho Done. 68 | goto CleanUpBatch 69 | 70 | :AbortBatch 71 | vmode C80 72 | vecho /fLightRed Aborted! 73 | REM Abort and cleanup 74 | 75 | :CleanUpBatch 76 | set SetPCheck= 77 | set EX11_COUNTER= 78 | set EX11_VMODE= 79 | set EX11_MAXX= 80 | set EX11_MAXY= 81 | 82 | :DontDoAnything -------------------------------------------------------------------------------- /EXAMPLES/EX12.BAT: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | verrlvl 255 4 | if errorlevel 255 goto ClearError 5 | 6 | :V8Missing 7 | echo V8Power Tools were not found. 8 | goto DontDoAnything 9 | 10 | :ClearError 11 | verrlvl 0 12 | if errorlevel 1 goto V8Missing 13 | 14 | :V8Present 15 | goto StartBatch 16 | 17 | * Englishese Stuff * 18 | 19 | HELLO.EN="Hello my friend." 20 | WORK.EN="Doing Stuff with '%1'..." 21 | BYE.EN="Later Dude!" 22 | 23 | * Broken Spanish Stuff * 24 | 25 | HELLO.ES="Buenos dias amigo." 26 | WORK.ES="Hacer cosas con '%1'..." 27 | BYE.ES="Asta la vista!" 28 | 29 | * The Batch file * 30 | :StartBatch 31 | REM Configure the Language/String file to point to ourself. 32 | set MySelf=%0 33 | if not exist %MySelf% set MySelf=%0.BAT 34 | if not exist %MySelf% goto Missing 35 | 36 | set MyLang=%LANG% 37 | if "%MyLang%" == "es" set MyLang=ES 38 | if not "%MyLang%" == "ES" set MyLang=EN 39 | 40 | REM Show the text. 41 | vecho /t %MySelf% HELLO.%MyLang% 42 | vecho /t %MySelf% WORK.%MyLang% "V8Power Tools" 43 | vecho /t %MySelf% BYE.%MyLang% 44 | goto Done 45 | 46 | :Missing 47 | vecho /fRed "Unable to find MySelf." 48 | 49 | :Done 50 | set MySelf= 51 | set MyLang= 52 | -------------------------------------------------------------------------------- /EXAMPLES/EX13.BAT: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem VTEST demo and test verification. 3 | 4 | if not "%_XERR%" == "" goto Test 5 | set _XBAT=CALL %0 6 | set _XERR=0 7 | 8 | REM Tests that return True 9 | 10 | %_XBAT% /z 11 | %_XBAT% /n test 12 | %_XBAT% /n test 13 | %_XBAT% /n 34 14 | %_XBAT% /f EX13.* 15 | %_XBAT% /d *.* 16 | %_XBAT% /v 0x16 17 | %_XBAT% /v 0 18 | %_XBAT% /v -75 19 | 20 | %_XBAT% 0 /eq 0 21 | %_XBAT% 0 /eq -0 22 | %_XBAT% 1 /eq 1 23 | %_XBAT% -1 /eq -1 24 | 25 | %_XBAT% 0 /ne -1 26 | %_XBAT% -1 /ne 0 27 | %_XBAT% -1 /ne -5 28 | %_XBAT% 1 /ne 5 29 | 30 | %_XBAT% 0 /lt 1 31 | %_XBAT% -1 /lt 0 32 | %_XBAT% -5 /lt -1 33 | %_XBAT% 1 /lt 5 34 | 35 | %_XBAT% 0 /le 1 36 | %_XBAT% -1 /le 0 37 | %_XBAT% -5 /le -1 38 | %_XBAT% 1 /le 5 39 | 40 | %_XBAT% 0 /le 0 41 | %_XBAT% 0 /le -0 42 | %_XBAT% 1 /le 1 43 | %_XBAT% -1 /le -1 44 | 45 | %_XBAT% 1 /gt 0 46 | %_XBAT% 0 /gt -1 47 | %_XBAT% -1 /gt -5 48 | %_XBAT% 5 /gt 1 49 | 50 | %_XBAT% 1 /ge 0 51 | %_XBAT% 0 /ge -1 52 | %_XBAT% -1 /ge -5 53 | %_XBAT% 5 /ge 1 54 | 55 | %_XBAT% 0 /ge 0 56 | %_XBAT% 0 /ge -0 57 | %_XBAT% 1 /ge 1 58 | %_XBAT% -1 /ge -1 59 | 60 | 61 | %_XBAT% 1 /ge 0 /ge -1 62 | %_XBAT% -1 /le 0 /le 1 63 | 64 | %_XBAT% /f %0 /or /f %0.bat 65 | 66 | REM Tests that return False 67 | set _XERR=1 68 | 69 | %_XBAT% 70 | %_XBAT% /n 71 | %_XBAT% /v 72 | %_XBAT% /not /z 73 | %_XBAT% /v above 74 | %_XBAT% /c /f ex13.* 75 | %_XBAT% 0 /ge 1 76 | %_XBAT% 1 /le 0 77 | %_XBAT% 0 /ge 1 /ge 2 78 | %_XBAT% 1 /le 0 /le -1 79 | %_XBAT% 0 /ge 1 /ge 0 80 | %_XBAT% 1 /le 0 /le 1 81 | %_XBAT% 5 /ge 1 /ge 5 82 | %_XBAT% -5 /le 0 /le -1 83 | %_XBAT% /f %0 /and /f %0.bat 84 | %_XBAT% /f %0.bat /and /f %0 85 | 86 | 87 | if "%_FAIL%" == "" goto Success 88 | goto Failed 89 | 90 | :Test 91 | set /e _RES=VTEST /tf %1 %2 %3 %4 %5 %6 %7 %8 %9 92 | if "%_XERR%" == "%ERRORLEVEL%" goto Correct 93 | echo WRONG , VTEST %1 %2 %3 %4 %5 %6 %7 %8 %9 94 | set _FAIL=FAILED 95 | goto End 96 | :Correct 97 | echo %_RES% , VTEST %1 %2 %3 %4 %5 %6 %7 %8 %9 98 | goto End 99 | 100 | :Failed 101 | echo At least one test failed. 102 | goto Done 103 | :Success 104 | echo All tests completed successfully. 105 | :Done 106 | set _XBAT= 107 | set _XERR= 108 | set _FAIL= 109 | 110 | :End -------------------------------------------------------------------------------- /EXAMPLES/README.txt: -------------------------------------------------------------------------------- 1 | ******************************************************************************* 2 | V8Power Tools for DOS examples 3 | Copyright 2016 Jerome Shidel 4 | Released under GPL v2.0 License. 5 | ******************************************************************************* 6 | 7 | This Directory contains some basic techniques and examples for using the 8 | V8Power Tools. 9 | 10 | The V8Power Tools must be present in your PATH environment variable or located 11 | in the same directory as these examples to use them. 12 | 13 | As a rule, each example builds on the functionality demonstrated in the previous 14 | example. Examples 01 - 05 should work under most DOS command shells. Example 06 15 | and higher require I.O redirection and "SET /P" support by the shell. Neither of 16 | these are supported by the default command shell provided with DOSBox. 17 | 18 | ------------------------------------------------------------------------------- 19 | 20 | Example 0 (EX00.BAT) 21 | 22 | Simple test to see if V8Power Tools are installed. 23 | 24 | ------------------------------------------------------------------------------- 25 | 26 | Example 1 (EX01.BAT) 27 | 28 | Simple test to determine if the batch file is running under the default DOSBox 29 | command shell or other versions of DOS that don't support "set /p". 30 | 31 | The DOSBox default command shell does not support I/O redirection at present. 32 | This is not a limitation of V8PT. But, it is to be noted that shell does not 33 | support it. Therefore, batch files that run on DOSBox must work around this 34 | limitation. Things like querying the current cursor shape with "vcursor /q" 35 | will function, but there is now way to save it's output. See Example 2 for a 36 | possible workaround to this specific issue. 37 | 38 | If I/O redirection or "SET /P" is still required, you could use an alternate 39 | command shell under DOSBox that supports it. FreeDOS's FreeCOM shell is a good 40 | choice that supports both and can be run inside DOSBox to completely work around 41 | both issues. 42 | 43 | ------------------------------------------------------------------------------- 44 | 45 | Example 2 (EX02.BAT) 46 | 47 | Hiding and restoring the cursor. 48 | 49 | ------------------------------------------------------------------------------- 50 | 51 | Example 3 (EX03.BAT) 52 | 53 | Simple application style screen drawing with a delay and cleared screen on 54 | exit. 55 | 56 | ------------------------------------------------------------------------------- 57 | 58 | Example 4 (EX04.BAT) 59 | 60 | Simple pause with timeout example. 61 | 62 | ------------------------------------------------------------------------------- 63 | 64 | Example 5 (EX05.BAT) 65 | 66 | Simple choice box with intentional to many choices that returns errorlevel 67 | of selected choice. Please note that under DOSBox or under FreeDOS without 68 | a memory manager installed, choices with multiple colors are flattened to 69 | to a single color. 70 | 71 | ------------------------------------------------------------------------------- 72 | 73 | Example 6 (EX06.BAT) 74 | 75 | Simple choice box that returns the text of the selected choice to stdout. 76 | 77 | ------------------------------------------------------------------------------- 78 | 79 | Example 7 (EX07.BAT) 80 | 81 | Simple vmath example of counting to 10. 82 | 83 | ------------------------------------------------------------------------------- 84 | 85 | Example 8 (EX08.BAT) 86 | 87 | Progress bar updating and multi-window example. 88 | 89 | ------------------------------------------------------------------------------- 90 | 91 | Example 9 (EX09.BAT) 92 | 93 | Non-windowed hard disk drive status scanning example with Progress bar. 94 | 95 | ------------------------------------------------------------------------------- 96 | 97 | Example 10 (EX10.BAT) 98 | 99 | Choice Polling example. 100 | 101 | ------------------------------------------------------------------------------- 102 | 103 | Example 11 (EX11.BAT) 104 | 105 | Video and vesa mode demo. 106 | 107 | ------------------------------------------------------------------------------- 108 | 109 | Example 12 (EX10.BAT) 110 | 111 | Portable string lookups and language translations with vecho. As long as 112 | V8Power Tools are present, it should mostly work in nearly all versions of DOS 113 | command shells. 114 | -------------------------------------------------------------------------------- /INDEX.md: -------------------------------------------------------------------------------- 1 | # V8Power 2 | 3 | # V8Power Tools 4 | #### Putting the power of an 8-cylinder engine under the hood of DOS batch files. ###### 5 | Copyright 2015-2025 Jerome Shidel.
6 | Open source, see License file.
7 | 8 | * * * 9 | 10 | The V8Power Tools project is being designed in cooperation with 11 | [Jim Hall](http://www.freedos.org/jhall) for the [FreeDOS™](http://www.freedos.org) 12 | operating system. It is intended to expand the functionality of scripts written 13 | using batch files and to provide them with a better looking user interface with 14 | increased functionality. 15 | 16 | * * * 17 | 18 | ## Compiling V8Power Tools 19 | 20 | ####    Prerequisites ###### 21 | 22 |       8086 or better cpu.
23 |       EGA or better video adapter.
24 |       [FreeDOS™ 1.1](http://www.freedos.org) or higher
25 |       [NASM™ for DOS version 2.14.02](http://wwww.nasm.us) or newer
26 | 27 | ####    Compiling ###### 28 | 29 |       Ensure the NASM directory is in your path spec.
30 |       Download the latest sources from [GitHub](http://github.com/LoopZ/V8Power).
31 |       Run the mkV8.bat script.
32 |       All executibles will be placed in newly 33 | created BIN directory.
34 | 35 | ####    For lazy people, like me ###### 36 | 37 |       Precompiled versions are available at [http://up.lod.bz/V8Power](http://up.lod.bz/V8Power).
38 | 39 | * * * 40 | 41 | ## V8Power Tools Tested Compatibility 42 | 43 | * FreeDOS 1.1+
44 | 45 | Limited compatiblilty of advanced features (no "set /p" batch support): 46 | 47 | * MS-DOS 6.2 and 6.22
48 | * PC-DOS 7.0, 7.01 and 2000
49 | * DR-DOS 7.03
50 | * DOSBox (i/o redirection or querying using stdout will NOT work using the built-in DOSBox shell. However, they work fine in DOSBox when a compatible shell like FreeCOM is used)
51 | * Windows 3.11 Shell
52 | * Windows 98 Shell and Command Line
53 | * Windows XP SP3 Shell (except vcursor)
54 | 55 | * * * 56 | 57 | ## V8Power Tools Usage 58 | 59 | Here is some basic information regarding all utilities and how they operate.
60 | * Options, values and hexidecimal numbers are not case specific **/f white** is the same as **/F wHIte**.
61 | * Hexidecimal numbers may be prefixed with **0x** to prevent them from being treated as base ten. 62 | (Example: 10 and 0x10)
63 | * Spaces are mostly optional. **/B7/f0** is the same as **/B 7 /F 0**. But, not **/ B7 / F0**.
64 | * To use a **/** or spaces in a value, put it in qoutes. Like **"Jack and/or Jill"**.
65 | * Use multiple qoutes to use quotes. Like **"Jack's house"** or **'Say "What?"'**.
66 | * Unless overriden, most utilities use the text attribute at the current cursor location.
67 |
68 | 69 | Here is color table used for all **/A**, **/F** and **/B** switches: 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 |
DecimalHexLabel (Not case specific)
00x00Black
10x01Blue
20x02Green
30x03Cyan
40x04Red
50x05Magenta
60x06Brown
70x07Gray
80x08DarkGray
90x09LightBlue
100x0aLightGreen
110x0bLightCyan
120x0cLightRed
130x0dLightMagenta
140x0eYellow
150x0fWhite
90 | 91 | 92 | # Contributing 93 | 94 | Thank you for you interest to improve this project. 95 | 96 | ### Contributing Language Translations 97 | 98 | Please do not submit langauges translations directly to this project. The 99 | language files *(if any)* that may be in this source tree are **NOT** included 100 | in the software releases. If any exist in this project, they are for development 101 | purposes only. When a version of this project is built and released, all 102 | language files are pulled directly from the versions in the 103 | [FD-NLS](https://github.com/shidel/fd-nls) project. If you wish to provide an 104 | additional language translation or make corrections to an existing one, please 105 | update the corresponding files in the [FD-NLS](https://github.com/shidel/fd-nls) 106 | project. 107 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | V8Power Tools for DOS is an open source project. 2 | Copyright 2016-2025 Jerome Shidel 3 | 4 | The entire work is released under multiple open source licenses simultaneously. 5 | It may be distributed and modified in accordance with any single or multiple 6 | combinations of the open source licenses for which this project is released to 7 | ensure compatibility with other open source licenses. This could mean a 8 | derivative work based on V8Power Tools for DOS may have a more restrictive 9 | open source license than the original work as long as that license is one of 10 | the licenses for which V8Power Tools for DOS is released. 11 | 12 | The current licenses for which V8Power Tools for DOS is released include: 13 | 14 | GNU General Public License (Any version) 15 | BSD 2-Clause License 16 | MIT License 17 | 18 | If an additional open source license is required for compatibility, it will be 19 | considered for addition to the existing licenses for which V8Power Tools for 20 | DOS is released. 21 | -------------------------------------------------------------------------------- /LICENSE.BSD: -------------------------------------------------------------------------------- 1 | Copyright 2016-2025 Jerome Shidel 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are 4 | permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this list of 7 | conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of 10 | conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 13 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 14 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 15 | SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 16 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 17 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 18 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 19 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | -------------------------------------------------------------------------------- /LICENSE.MIT: -------------------------------------------------------------------------------- 1 | Copyright 2016-2023 Jerome Shidel 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # V8Power Tools 2 | #### Putting the power of an 8-cylinder engine under the hood of DOS batch files. ###### 3 | Copyright 2015-2021 Jerome Shidel.
4 | Released under the GPL v2.0 License.
5 | 6 | * * * 7 | 8 | The V8Power Tools project is being designed in cooperation with 9 | [Jim Hall](http://www.freedos.org/jhall) for the [FreeDOS™](http://www.freedos.org) 10 | operating system. It is intended to expand the functionality of scripts written 11 | using batch files and to provide them with a better looking user interface with 12 | increased functionality. 13 | 14 | * * * 15 | 16 | ## Compiling V8Power Tools 17 | 18 | ####    Prerequisites ###### 19 | 20 |       8086 or better cpu.
21 |       EGA or better video adapter.
22 |       [FreeDOS™ 1.1](http://www.freedos.org) or higher
23 |       [NASM™ for DOS version 2.14.02](http://wwww.nasm.us) or newer
24 | 25 | ####    Compiling ###### 26 | 27 |       Ensure the NASM directory is in your path spec.
28 |       Download the latest sources from [GitHub](http://github.com/LoopZ/V8Power).
29 |       Run the mkV8.bat script.
30 |       All executibles will be placed in newly 31 | created BIN directory.
32 | 33 | ####    For lazy people, like me ###### 34 | 35 |       Precompiled versions are available at [http://up.lod.bz/V8Power](http://up.lod.bz/V8Power).
36 | 37 | * * * 38 | 39 | ## V8Power Tools Tested Compatibility 40 | 41 | * FreeDOS 1.1+
42 | 43 | Limited compatiblilty of advanced features (no "set /p" batch support): 44 | 45 | * MS-DOS 6.2 and 6.22
46 | * PC-DOS 7.0, 7.01 and 2000
47 | * DR-DOS 7.03
48 | * DOSBox (i/o redirection or querying using stdout will NOT work using the built-in DOSBox shell. However, they work fine in DOSBox when a compatible shell like FreeCOM is used)
49 | * Windows 3.11 Shell
50 | * Windows 98 Shell and Command Line
51 | * Windows XP SP3 Shell (except vcursor)
52 | 53 | * * * 54 | 55 | ## V8Power Tools Usage 56 | 57 | Here is some basic information regarding all utilities and how they operate.
58 | * Options, values and hexidecimal numbers are not case specific **/f white** is the same as **/F wHIte**.
59 | * Hexidecimal numbers may be prefixed with **0x** to prevent them from being treated as base ten. 60 | (Example: 10 and 0x10)
61 | * Spaces are mostly optional. **/B7/f0** is the same as **/B 7 /F 0**. But, not **/ B7 / F0**.
62 | * To use a **/** or spaces in a value, put it in qoutes. Like **"Jack and/or Jill"**.
63 | * Use multiple qoutes to use quotes. Like **"Jack's house"** or **'Say "What?"'**.
64 | * Unless overriden, most utilities use the text attribute at the current cursor location.
65 |
66 | 67 | Here is color table used for all **/A**, **/F** and **/B** switches: 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 |
DecimalHexLabel (Not case specific)
00x00Black
10x01Blue
20x02Green
30x03Cyan
40x04Red
50x05Magenta
60x06Brown
70x07Gray
80x08DarkGray
90x09LightBlue
100x0aLightGreen
110x0bLightCyan
120x0cLightRed
130x0dLightMagenta
140x0eYellow
150x0fWhite
88 | 89 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | ******************************************************************************* 2 | V8Power Tools 3 | Copyright 2015-2021 Jerome Shidel 4 | Released under GPL v2.0 License. 5 | ******************************************************************************* 6 | 7 | Putting the power of an 8-cylinder engine under the hood of DOS batch files. 8 | 9 | =============================================================================== 10 | 11 | The V8Power Tools project is being designed in cooperation with 12 | Jim Hall for the FreeDOS(TM) (http://www.freedos.org) operating system. It is 13 | intended to expand the functionality of scripts written using batch files and 14 | to provide them with a better looking user interface with increased 15 | functionality. 16 | 17 | =============================================================================== 18 | 19 | Compiling V8Power Tools 20 | 21 | Prerequisites: 22 | 23 | 8086 or better cpu. 24 | EGA or better video adapter. 25 | FreeDOS(TM) 1.1 (http://www.freedos.org) or higher 26 | NASM for DOS version 2.16.01 (http://wwww.nasm.us) or newer 27 | 28 | Compiling: 29 | 30 | Ensure the NASM directory is in your path spec. 31 | Download the latest sources from http://github.com/LoopZ/V8Power 32 | Run the mkV8.bat script. 33 | All executibles will be placed in newly created BIN directory. 34 | 35 | For lazy people, like me: 36 | 37 | Precompiled versions are available at http://up.lod.bz/V8Power. 38 | 39 | =============================================================================== 40 | 41 | V8Power Tools Tested Compatibility 42 | 43 | FreeDOS 1.1+ 44 | 45 | Limited compatiblilty of advanced features (no "set /p" batch support): 46 | 47 | MS-DOS 6.2 and 6.22 48 | PC-DOS 7.0, 7.01 and 2000 49 | DR-DOS 7.03 50 | DOSBox (i/o redirection or querying using stdout will NOT work using the 51 | built-in DOSBox shell. However, they work fine in DOSBox when a 52 | compatible shell like FreeCOM is used) 53 | Windows 3.11 Shell 54 | Windows 98 Shell and Command Line 55 | Windows XP SP3 Shell (except vcursor) 56 | 57 | =============================================================================== 58 | 59 | V8Power Tools Usage 60 | 61 | Here is some basic information regarding all utilities and how they operate. 62 | 63 | Options, values and hexidecimal numbers are not case specific /f white is 64 | the same as /F wHIte. 65 | 66 | Hexidecimal numbers may be prefixed with 0x to prevent them from being 67 | treated as base ten. (Example: 10 and 0x10) 68 | 69 | Spaces are mostly optional. /B7/f0 is the same as /B 7 /F 0. 70 | But, not / B7 / F0. 71 | 72 | To use a / or spaces in a value, put it in qoutes. Like "Jack and/or Jill". 73 | 74 | Use multiple qoutes to use quotes. Like "Jack's house" or 'Say "What?"'. 75 | 76 | Unless overriden, most utilities use the text attribute at the current 77 | cursor location. 78 | 79 | =============================================================================== 80 | 81 | Here is color table used for all **/A**, **/F** and **/B** switches: 82 | 83 | Decimal Hex Label (Not case specific) 84 | 85 | 0 0x00 Black 86 | 1 0x01 Blue 87 | 2 0x02 Green 88 | 3 0x03 Cyan 89 | 4 0x04 Red 90 | 5 0x05 Magenta 91 | 6 0x06 Brown 92 | 7 0x07 Gray / Grey 93 | 8 0x08 DarkGray / DarkGrey 94 | 9 0x09 LightBlue 95 | 10 0x0a LightGreen 96 | 11 0x0b LightCyan 97 | 12 0x0c LightRed 98 | 13 0x0d LightMagenta 99 | 14 0x0e Yellow 100 | 15 0x0f White 101 | 102 | 103 | -------------------------------------------------------------------------------- /ROADMAP.txt: -------------------------------------------------------------------------------- 1 | ******************************************************************************* 2 | V8Power Tools 3 | Copyright 2015-2021 Jerome Shidel 4 | Released under GPL v2.0 License. 5 | ******************************************************************************* 6 | 7 | Putting the power of an 8-cylinder engine under the hood of DOS batch files. 8 | 9 | =============================================================================== 10 | 11 | Fix vinfo CPU reporting with a better algorithm. My Pentium Pro reports 686 (as 12 | it should). However, my 486DX2-66 stops and reports 186 not a 486. 13 | 14 | Probable roadmap for the future of V8Power Tools: 15 | 16 | vask - add /k option support 17 | 18 | vfdutil - allow /m to accept root directory or just drive 19 | vfdutil - freespace output using same factor as /r input (ie K, M, etc) 20 | vline - additional options like smart and vertical 21 | vinfo - more system information provided by utility. 22 | vstr - Like trim, squeeze, implode, explode... 23 | vecho - Word wrapping and more control-code ascii support. 24 | vpcspkr - More music style support like maybe, C#, C. and such. 25 | vver - verify all utils are present and proper version. 26 | veach - duplicate checking and some other options 27 | vchoice - old style [Y/N] style choices 28 | 29 | vreadkey - Postponed, keyboard input. 30 | vchkbox - Postponed, Checkboxes. 31 | vview - Postponed, Text file viewer, user license agreement and whatnots.. 32 | 33 | vchoice, vpause, vask, vview, vchkbox - Mouse, Hot Key and button support. 34 | 35 | More range checking, prevent possible freeze/lockup when developer uses 36 | really bad settings. 37 | 38 | Migrate to new codebase design & layout, (v8-*.inc) 39 | 40 | Optimizations and byte squeezing. 41 | 42 | 43 | -------------------------------------------------------------------------------- /SOURCE/APPINFO.LSM: -------------------------------------------------------------------------------- 1 | Begin3 2 | Title: V8Power Tools 3 | Version: $VERSION$ 4 | Entered-date: $DATE$ 5 | Description: a set of batch file enhancement utilities for DOS that can provide text UI and other processing functions (UPX'd) 6 | Keywords: dos 16 bit batch vask vchoice vecho vpause vframe vmath vline vprogres 7 | Changes: $NOTES$ 8 | Author: Jerome Shidel 9 | Maintained-by: Jerome Shidel 10 | Primary-site: https://github.com/LoopZ/V8Power 11 | Alternate-site: http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/repositories/latest/pkg-html/v8power.html 12 | Original-site: https://up.lod.bz/V8Power/ 13 | Platforms: DOS 14 | Copying-policy: GNU General Public License, version 2 or later 15 | End 16 | -------------------------------------------------------------------------------- /SOURCE/DEBUG.INC: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2023 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %ifdef DEBUG 7 | 8 | jmp Skip_Over_DEBUG 9 | 10 | PROC_Debug_Char: 11 | pushf 12 | push ax 13 | cmp dl, 0x20 14 | jae .Print 15 | mov dl, 0xf9 16 | .Print: 17 | mov ah, 0x02 18 | int 0x21 19 | .NoPrint: 20 | pop ax 21 | popf 22 | ret 23 | 24 | PROC_Debug_CRLF: 25 | pushf 26 | push ax 27 | push dx 28 | mov ah, 0x02 29 | mov dl, 0x0d 30 | int 0x21 31 | mov dl, 0x0a 32 | int 0x21 33 | pop dx 34 | pop ax 35 | popf 36 | ret 37 | 38 | PROC_Debug_Text: 39 | pushf 40 | push ax 41 | push ds 42 | mov ax, cs 43 | mov ds, ax 44 | mov ah, 0x09 45 | int 0x21 46 | pop ds 47 | pop ax 48 | popf 49 | ret 50 | 51 | PROC_Debug_AsciiZ: 52 | pushf 53 | cld 54 | push ax 55 | push dx 56 | push ds 57 | mov ax, cs 58 | mov ds, ax 59 | mov ah, 0x02 60 | .Loop: 61 | lodsb 62 | test al, al 63 | jz .Done 64 | mov dl, al 65 | int 0x21 66 | jmp .Loop 67 | .Done: 68 | pop ds 69 | pop dx 70 | pop ax 71 | popf 72 | ret 73 | 74 | PROC_Debug_Word: 75 | pushf 76 | push cx 77 | push dx 78 | StdOutHexWord ax 79 | pop dx 80 | pop cx 81 | popf 82 | ret 83 | 84 | PROC_Debug_Byte: 85 | pushf 86 | push cx 87 | push dx 88 | StdOutHexByte ax 89 | pop dx 90 | pop cx 91 | popf 92 | ret 93 | 94 | PROC_Debug_CarryFlag: 95 | pushf 96 | push dx 97 | mov dx, .MsgCarry 98 | call PROC_Debug_Text 99 | jc .Carry 100 | mov dx, .MsgSet 101 | jmp .Done 102 | .MsgCarry: db 'Carry Flag $' 103 | .MsgSet: db 'Set$' 104 | .MsgClear: db 'Clear$' 105 | .Carry: 106 | mov dx, .MsgSet 107 | .Done: 108 | call PROC_Debug_Text 109 | call PROC_Debug_CRLF 110 | pop dx 111 | popf 112 | ret 113 | 114 | Skip_Over_DEBUG: 115 | 116 | %imacro Debug_Char 1 117 | push dx 118 | mov dl, %1 119 | call PROC_Debug_Char 120 | pop dx 121 | %endmacro 122 | 123 | %imacro Debug_CRLF 0 124 | call PROC_Debug_CRLF 125 | %endmacro 126 | 127 | %imacro Debug_Text 1+ 128 | push dx 129 | mov dx, %%Msg 130 | call PROC_Debug_Text 131 | pop dx 132 | jmp %%Over 133 | %%Msg: 134 | db %1,'$' 135 | %%Over: 136 | %endmacro 137 | 138 | %imacro Debug_TextLn 1+ 139 | push dx 140 | mov dx, %%Msg 141 | call PROC_Debug_Text 142 | pop dx 143 | jmp %%Over 144 | %%Msg: 145 | db %1,0x0d,0x0a,'$' 146 | %%Over: 147 | %endmacro 148 | 149 | %imacro Debug_AsciiZ 1 150 | push si 151 | mov si, %1 152 | call PROC_Debug_AsciiZ 153 | pop si 154 | %endmacro 155 | 156 | %imacro Debug_Word 1 157 | push ax 158 | mov ax, %1 159 | call PROC_Debug_Word 160 | pop ax 161 | %endmacro 162 | 163 | %imacro Debug_Byte 1 164 | push ax 165 | mov al, %1 166 | call PROC_Debug_Byte 167 | pop ax 168 | %endmacro 169 | 170 | %imacro Debug_CarryFlag 0 171 | call PROC_Debug_CarryFlag 172 | %endmacro 173 | 174 | %else 175 | 176 | %imacro Debug_Char 1 177 | %endmacro 178 | 179 | %imacro Debug_CRLF 0 180 | %endmacro 181 | 182 | %imacro Debug_Text 1+ 183 | %endmacro 184 | 185 | %imacro Debug_TextLn 1+ 186 | %endmacro 187 | 188 | %imacro Debug_AsciiZ 1 189 | %endmacro 190 | 191 | %imacro Debug_Word 1 192 | %endmacro 193 | 194 | %imacro Debug_Byte 1 195 | %endmacro 196 | 197 | %imacro Debug_CarryFlag 0 198 | %endmacro 199 | 200 | %endif 201 | 202 | -------------------------------------------------------------------------------- /SOURCE/DEMOPARS.ASM: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2023 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %idefine NoVideoOutput 7 | 8 | %idefine DEBUG 9 | 10 | %include "COMMON.INC" 11 | %include "INT64.INC" 12 | 13 | 14 | ParseOptions Options 15 | jnc Done 16 | Debug_Text 'Error' 17 | Done: 18 | 19 | Debug_CRLF 20 | 21 | Terminate 0 22 | 23 | Int64_Procs 24 | 25 | Options: 26 | OptTable SwitchText, SwitchInvalid 27 | OptSwitch 'H', SwitchHelp 28 | OptWild 'A', SwitchA 29 | OptSwitch 'B', SwitchB 30 | OptTableEnd 31 | 32 | HelpSwitchHandler 'vview' 33 | 34 | SwitchShow: 35 | Debug_Char bl 36 | test cx, cx 37 | jz .Done 38 | .Printing: 39 | lodsb 40 | Debug_Char al 41 | loop .Printing 42 | .Done: 43 | Debug_Char bh 44 | clc 45 | ret 46 | 47 | SwitchInvalid: ; not a valid switch 48 | mov bx, '{}' 49 | call SwitchShow 50 | stc 51 | ret 52 | 53 | SwitchText: ; command line text 54 | mov bx, 0x2222 55 | jmp SwitchShow 56 | 57 | SwitchA: 58 | mov bx, '[]' 59 | jmp SwitchShow 60 | 61 | SwitchB: 62 | 63 | mov bx, '()' 64 | jmp SwitchShow 65 | -------------------------------------------------------------------------------- /SOURCE/DSKTLS.INC: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %idefine erNotValid 0x0f 7 | %idefine erNotFormatted 0x05 8 | %idefine erIsNetwork 0x04 9 | %idefine erIsCDROM 0x03 10 | %idefine erIsRemovable 0x02 11 | %idefine erNone 0x00 12 | 13 | %imacro FindFirst 2 14 | push dx 15 | push cx 16 | mov ah, 1Ah ;Set DTA 17 | lea dx, %1 18 | int 21h 19 | ; xor cx, cx ;No attributes. 20 | mov cx, 0ffffh 21 | lea dx, %2 22 | mov ah, 4Eh ;Find First File 23 | int 21h 24 | pop cx 25 | pop dx 26 | %endmacro 27 | 28 | %imacro FindNext 0 29 | push ax 30 | mov ah, 4Fh ;Find Next File 31 | int 21h 32 | pop ax 33 | %endmacro 34 | 35 | %imacro IsValidDrive 1 ; Test is removable, fails if not valid 36 | mov ax, 0x4408 37 | mov bl, %1 38 | int 0x21 39 | jc %%Error 40 | xor ax, ax 41 | jmp %%Done 42 | %%Error: 43 | mov al, erNotValid ; Invalid Drive Number 44 | mov [ExitCode], al 45 | %%Done: 46 | %endmacro 47 | 48 | %imacro DiskFree 1 ; Get Disk free space, fails if not formatted 49 | mov ah, 0x36 50 | mov dl, %1 51 | int 0x21 52 | cmp ax, 0xffff 53 | je %%Error 54 | clc 55 | jmp %%Done 56 | %%Error: 57 | stc 58 | %%Done: 59 | %endmacro 60 | 61 | %imacro IsFormatted 1 62 | GetIntVec 0x24, SavedInt24 63 | push ds 64 | cli 65 | mov dx, MyInt24 66 | mov ax, 0x2524 67 | int 0x21 68 | sti 69 | pop ds 70 | 71 | xor al, al 72 | mov [ErrorCode], al 73 | 74 | mov al, %1 75 | add al, 0x40 76 | mov [%%FileName], al 77 | 78 | FindFirst [%%DTA], [%%FileName] 79 | jc %%Error 80 | %%NoError: 81 | xor ax, ax 82 | jmp %%Done 83 | 84 | %%FileName: 85 | DB '?:\*.*',0 86 | 87 | %%DTA: 88 | times 23 DD 0 89 | 90 | %%Error: 91 | mov al, 1 92 | mov [ExitCode], al 93 | mov ax, erNotFormatted 94 | 95 | %%Done: 96 | push ax 97 | SetIntVec 0x24, SavedInt24 98 | pop ax 99 | 100 | %endmacro 101 | 102 | %imacro GetIntVec 2 103 | push es 104 | mov al, %1 105 | mov ah, 0x35 106 | int 0x21 107 | mov [%2], bx 108 | mov bx, es 109 | mov [%2 + 2], bx 110 | pop es 111 | %endmacro 112 | 113 | %imacro SetIntVec 2 114 | cli 115 | push ds 116 | mov dx, [cs:%2+2] 117 | mov ds, dx 118 | mov dx, [cs:%2] 119 | mov al, %1 120 | mov ah, 0x25 121 | int 0x21 122 | pop ds 123 | sti 124 | %endmacro 125 | 126 | %imacro Floppies 0 ; BIOS Function 127 | int 0x11 128 | test al, 0x01 129 | jz %%NoFloppies 130 | xor ah, ah 131 | and al, 0xc0 132 | mov cl, 0x06 133 | shr ax, cl 134 | inc ax 135 | jmp %%Done 136 | %%NoFloppies: 137 | xor ax, ax 138 | %%Done: 139 | %endmacro 140 | 141 | MyInt24: 142 | mov ax, di 143 | mov [cs:ErrorCode], al 144 | mov al, 0x01 145 | mov [cs:Critical], al 146 | mov al, 0x03 147 | iret 148 | 149 | Critical: 150 | db 0 151 | ErrorCode: 152 | db 0 153 | 154 | %imacro IsCDROM 1 155 | mov ax, 0x1500 156 | xor bx, bx 157 | int 0x2f 158 | cmp bx, 0 159 | je %%NotCDRom 160 | xor ah, ah 161 | mov al, %1 162 | inc cx 163 | dec bx 164 | cmp ax, cx 165 | jl %%NotCDRom ; less then first cd 166 | add cx, bx 167 | cmp ax, cx 168 | jg %%NotCDRom ; greater then last cd 169 | mov al, 0x01 170 | jmp %%Done 171 | %%NotInstalled: 172 | %%NotCDRom: 173 | xor ax, ax 174 | %%Done: 175 | %endmacro 176 | 177 | %imacro IsNetwork 1 178 | mov ax, 0x4409 179 | mov bl, %1 180 | int 0x21 181 | jc %%Not 182 | and dx, 1000000000000b 183 | cmp dx, 0 184 | je %%Not 185 | mov ax, 1 186 | jmp %%Done 187 | %%Not: 188 | xor ax, ax 189 | %%Done: 190 | %endmacro 191 | 192 | %imacro IsRemovable 1 193 | mov ax, 0x4408 194 | mov bl, %1 195 | int 0x21 196 | jc %%Not 197 | cmp ax, 0 198 | jne %%Not 199 | mov ax, 1 200 | jmp %%Done 201 | %%Not: 202 | xor ax, ax 203 | %%Done: 204 | %endmacro 205 | 206 | %imacro DiskStatus 1 207 | mov al, %1 208 | xor ah, ah 209 | mov [%%Result], ah 210 | cmp ax, 0x5e 211 | jl %%NotLowercase 212 | sub ax, 0x20 213 | %%NotLowercase: 214 | cmp ax, 0x41 215 | jl InvalidOption 216 | cmp ax, 0x5a 217 | jg InvalidOption 218 | sub ax, 0x40 219 | mov [Drive], al 220 | 221 | cmp al, 3 222 | jnl %%NotFloppy 223 | 224 | Floppies 225 | mov bl, al 226 | mov al, [Drive] 227 | cmp al, bl 228 | jg %%BadDriveLetter 229 | %%NotFloppy: 230 | 231 | ; CD-ROM Fails Valid Test, Only works with MSCDEX driver. 232 | IsCDROM [Drive] 233 | cmp al, 0x01 234 | je %%IsCDROM 235 | 236 | IsValidDrive [Drive] 237 | ; ax = 0, At least it is exists and partitioned 238 | cmp ax, 0 239 | je %%DriveExists 240 | ; Drive not found, so se if a hard drive actually exists 241 | 242 | %%BadDriveLetter: 243 | mov al, erNotValid 244 | mov [%%Result], al 245 | jmp %%Done 246 | %%DriveExists: 247 | IsFormatted [Drive] 248 | cmp ax, 0 249 | jne %%FormatError 250 | ; Fails if it is partitioned but is not formatted 251 | ; Check Drive Type 252 | IsNetwork [Drive] 253 | cmp al, 0x01 254 | je %%IsRemote 255 | IsRemovable [Drive] 256 | cmp al, 0x01 257 | je %%IsRemovable 258 | 259 | xor al, al 260 | mov [%%Result], al 261 | jmp %%Done 262 | %%IsCDROM: 263 | mov al, erIsCDROM 264 | mov [%%Result], al 265 | jmp %%Done 266 | %%IsRemovable: 267 | mov al, erIsRemovable 268 | mov [%%Result], al 269 | jmp %%Done 270 | %%IsRemote: 271 | mov al, erIsNetwork 272 | mov [%%Result], al 273 | jmp %%Done 274 | %%FormatError: 275 | mov al, erNotFormatted 276 | mov [%%Result], al 277 | jmp %%Done 278 | %%Result: 279 | db 0 280 | %%Done: 281 | mov al, [%%Result] 282 | %endmacro 283 | 284 | %imacro DiskStatusMessage 1 285 | mov al, %1 286 | mov bx, %%Messages 287 | %%ScanLoop: 288 | mov ah, [bx] 289 | inc bx 290 | cmp al, ah 291 | je %%Found 292 | cmp ah, 0 293 | je %%NotFound 294 | %%ScanNext: 295 | mov ah, [bx] 296 | inc bx 297 | cmp ah, 0 298 | jne %%ScanNext 299 | jmp %%ScanLoop 300 | 301 | %%Found: 302 | WriteStr bx 303 | %%NotFound: 304 | WriteStr %%MsgCRLF 305 | jmp %%Done 306 | %%MsgCRLF: 307 | db CRLF,0 308 | %%Messages: 309 | db erNotValid,'Invalid drive letter',0 310 | db erNotFormatted,'Drive not formatted',0 311 | db erIsCDROM,'Drive is CD/DVD-ROM',0 312 | db erIsNetwork,'Drive is remote',0 313 | db erIsRemovable,'Drive is removable',0 314 | db erNone,'Drive is ready',0 315 | %%Done: 316 | 317 | %endmacro 318 | 319 | -------------------------------------------------------------------------------- /SOURCE/EXEC.INC: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2017-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM 2.14rc0 for DOS 5 | 6 | %imacro ShellExec 2 7 | 8 | jmp %%Over 9 | 10 | %ifndef Declared_ShellExec 11 | %define Declared_ShellExec 12 | 13 | Function_ShellExec: 14 | pushall 15 | cld 16 | xor cx, cx 17 | mov [DATABLOCK(ENVIRONMENT)], cx 18 | mov di, DATABLOCK(EXECLINE) 19 | push di 20 | inc di 21 | mov al, [si] 22 | cmp al, 0 23 | je .Copying 24 | cmp al, 0x0d 25 | je .Copying 26 | mov al, 0x20 27 | stosb 28 | .Copying: 29 | lodsb 30 | cmp al, 0x0d 31 | je .Copying 32 | stosb 33 | inc cx 34 | cmp al, 0 35 | jne .Copying 36 | dec di 37 | mov al, 0x0d 38 | stosb 39 | xor al, al 40 | .Fill: 41 | stosb 42 | cmp di, DATABLOCK(SAVESTACK) 43 | jb .Fill 44 | pop di 45 | mov [di], cl 46 | 47 | mov di, DATABLOCK(SAVESTACK) 48 | mov [di], ss 49 | mov [di + 2], sp 50 | mov ax, DATABLOCK(EXECLINE) 51 | mov [DATABLOCK(COMMANDPTR)], ax 52 | mov [DATABLOCK(STACKPTR)], ss 53 | mov [DATABLOCK(STACKPTR) + 2], sp 54 | mov ax, %%Return 55 | mov [DATABLOCK(CODEPTR)], ax 56 | mov ax, cs 57 | mov [DATABLOCK(CODEPTR) + 2], ax 58 | mov [DATABLOCK(COMMANDPTR) + 2], ax 59 | 60 | ; mov ds, ax 61 | ; mov es, ax 62 | ; mov dx, %%Program 63 | 64 | mov bx, DATABLOCK(ENVIRONMENT) 65 | mov ax, 0x4b00 66 | int 0x21 67 | %%Return: 68 | mov di, DATABLOCK(SAVESTACK) 69 | mov ss, [cs:di] 70 | mov sp, [cs:di + 2] 71 | jc %%ErrorCode 72 | mov ah, 0x4d 73 | int 0x21 74 | %%ErrorCode: 75 | mov [cs:DATABLOCK(ENVIRONMENT)], ax 76 | popall 77 | mov ax, [DATABLOCK(ENVIRONMENT)] 78 | ret 79 | 80 | %endif 81 | 82 | %%Over: 83 | multipush bx, dx 84 | mov dx, %1 85 | mov si, %2 86 | call Function_ShellExec 87 | multipop bx, dx 88 | 89 | %endmacro 90 | -------------------------------------------------------------------------------- /SOURCE/MACHINES.INC: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %imacro DetectMachine 0 7 | 8 | cpu 8086 9 | use16 10 | 11 | mov si, DOSBOXString 12 | mov bx, 0xfe00 13 | mov es, bx 14 | mov cx, 0x0100 15 | call SearchString 16 | jnc NotDOSBox 17 | mov ax, 101 18 | jmp %%DetectDone 19 | 20 | NotDOSBox: 21 | mov si, QEMUString 22 | mov bx, 0xf000 23 | mov es, bx 24 | mov cx, 0xf000 25 | call SearchString 26 | jnc NotQEMUBox 27 | mov ax, 102 28 | jmp %%DetectDone 29 | 30 | NotQEMUBox: 31 | mov si, VBOXString1 32 | mov bx, 0xffe0 33 | mov es, bx 34 | mov cx, 0x0200 35 | call SearchString 36 | jnc NotVBOX1 37 | mov ax, 103 38 | jmp %%DetectDone 39 | 40 | NotVBOX1: 41 | mov si, VBOXString2 42 | mov bx, 0xffe0 43 | mov es, bx 44 | mov cx, 0x0200 45 | call SearchString 46 | jnc NotVBOX2 47 | mov ax, 103 48 | jmp %%DetectDone 49 | 50 | NotVBOX2: 51 | mov si, VMString 52 | mov bx, 0xf000 53 | mov es, bx 54 | mov cx, 0xf000 55 | call SearchString 56 | jnc NotVMware 57 | mov ax, 104 58 | jmp %%DetectDone 59 | 60 | NotVMware: 61 | 62 | ;OtherEmulation: 63 | ; cld 64 | ; mov al, 0x90 65 | ; mov cx, 0x0008 66 | ; mov di, $ 67 | ; rep stosb 68 | ; jmp VirtualMachine 69 | ; nop 70 | ; nop 71 | 72 | 73 | DetectCPU: 74 | ; Test Pre-186, CL is AND with 0x0f prior to/during shr 75 | mov cl, 0x20 76 | mov ax, 0x0001 77 | shr ax, cl 78 | cmp ax, 0x0000 79 | jne .186orBetter 80 | xor al, al 81 | jmp .Done 82 | .186orBetter: 83 | ; At least a 80186 84 | ; Pre-286 updates the Stack Pointer before push 85 | mov ax, sp 86 | push sp 87 | pop bx 88 | cmp ax, bx 89 | je .286orBetter 90 | mov ax, 1 91 | jmp .Done 92 | .286orBetter: 93 | ; At least a 286 94 | ; Check push/pop of upper flag bits for 386 or better 95 | cpu 286 96 | 97 | pushf 98 | mov ax, 0x7000 99 | push ax 100 | popf 101 | pushf 102 | pop ax 103 | popf 104 | and ah, 0x70 105 | cmp ah, 0x70 106 | je .386orBetter 107 | mov al, 2 108 | jmp .Done 109 | .386orBetter: 110 | ; At least a 386 111 | ; Test setting AC Flag 112 | cpu 386 113 | 114 | mov bx, sp 115 | and sp, 0xfffc 116 | push ebx 117 | 118 | pushfd 119 | pushfd 120 | pop eax 121 | or eax, 0x40000 122 | push eax 123 | popfd 124 | pushfd 125 | pop eax 126 | popfd 127 | 128 | test eax, 0x40000 129 | 130 | jnz .486orBetter 131 | 132 | mov al, 3 133 | jmp .Done32 134 | .486orBetter: 135 | 136 | cpu 486 137 | ; At least a 486 138 | ; Test setting ID Flag Bit 139 | 140 | pushfd 141 | pushfd 142 | mov ecx, 0x00200000 143 | mov ebx, [esp] 144 | xor [esp], ecx 145 | popfd 146 | pushfd 147 | pop eax 148 | xor eax, [esp] 149 | popfd 150 | and eax, ecx 151 | and ebx, ecx 152 | cmp eax, ebx 153 | jne .UseCPUid 154 | .IsAtleast486: 155 | mov al, 4 156 | jmp .Done32 157 | 158 | .UseCPUid: 159 | 160 | cpu 586 161 | 162 | ; mov eax, 0 163 | ; cpuid 164 | ; mov [CPUname], ebx 165 | ; mov [CPUname + 4], edx 166 | ; mov [CPUname + 8], ecx 167 | 168 | mov eax, 1 169 | cpuid 170 | shr ax, 0x08 171 | and ax, 0x0f 172 | cmp ax, 0x04 173 | jb .IsAtleast486 174 | 175 | .Done32: 176 | 177 | cpu 386 178 | 179 | pop ebx 180 | mov sp, bx 181 | 182 | cpu 8086 183 | 184 | .Done: 185 | 186 | ; push ax 187 | ; mov bx, CPUname 188 | ; call PrintStr 189 | ; mov dl, 32 190 | ; int 0x21 191 | ; pop ax 192 | jmp %%DetectDone 193 | 194 | ;VirtualMachine: 195 | ; mov ax, 200 196 | ; jmp %%DetectDone 197 | 198 | SearchString: 199 | cld 200 | xor bx, bx 201 | xor di, di 202 | .Looping: 203 | mov dl, [cs:si+bx] 204 | cmp dl, 0 205 | je .Found 206 | mov dh, [es:di+bx] 207 | cmp dh, 0x61 208 | jb .NotLower 209 | cmp dh, 0x7a 210 | ja .NotLower 211 | sub dh, 0x20 212 | .NotLower: 213 | cmp dl, dh 214 | jne .NotMatch 215 | inc bx 216 | jmp .Looping 217 | .NotMatch: 218 | xor bx, bx 219 | inc di 220 | loop .Looping 221 | clc 222 | ret 223 | .Found: 224 | stc 225 | ret 226 | 227 | DOSBOXString: 228 | db 'THE DOSBOX TEAM', 0 229 | QEMUString: 230 | db 'QEMU',0 231 | VBOXString1: 232 | db 'ORACLE VM VIRTUALBOX',0 233 | VBOXString2: 234 | db 'ORACLE VIRTUALBOX',0 235 | VMString: 236 | db 'VMWARE VIRTUAL PLATFORM',0 237 | 238 | %%DetectDone: 239 | 240 | %endmacro 241 | 242 | %imacro MachineStatusMessage 1 243 | mov al, %1 244 | mov bx, %%Messages 245 | %%ScanLoop: 246 | mov ah, [bx] 247 | inc bx 248 | cmp al, ah 249 | je %%Found 250 | cmp ah, 0 251 | je %%NotFound 252 | %%ScanNext: 253 | mov ah, [bx] 254 | inc bx 255 | cmp ah, 0 256 | jne %%ScanNext 257 | jmp %%ScanLoop 258 | 259 | %%Found: 260 | WriteStr bx 261 | %%NotFound: 262 | WriteStr %%MsgCRLF 263 | jmp %%Done 264 | %%MsgCRLF: 265 | db CRLF,0 266 | %%Messages: 267 | db 1, '80186',0 268 | db 2, '80286',0 269 | db 3, '80386',0 270 | db 4, '80486',0 271 | db 5, '80586',0 272 | db 6, '80686',0 273 | db 101, 'DOSBox',0 274 | db 102, 'QEMU', 0 275 | db 103, 'VirtualBox', 0 276 | db 104, 'VMware',0 277 | ; db 200, 'Emulation',0 278 | db 0, '8086',0 279 | %%Done: 280 | 281 | %endmacro 282 | 283 | -------------------------------------------------------------------------------- /SOURCE/PARSER.INC: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2023 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM 2.14rc0 for DOS 5 | 6 | ; New Command Line and String Parser 7 | 8 | ; %define FLEX_QUOTES ; Enable to support Flexible Quotes where text can be 9 | ; encapsulated in one of the three quotation marks to 10 | ; be passed as single parameter. The quotation 11 | ; characters not used to wrap the text may be used 12 | ; inside the quoted text. 13 | ; 14 | ; Leave this disabled to treat all quotation characters 15 | ; as normal text. This will cause text with spaces or 16 | ; SWITCH characters to be sent as individual pieces. 17 | ; Note: Double switch characters will separate options. 18 | ; However, it will be sent as //TEXT and not as switch. 19 | 20 | ; %define INDEXED_OPTIONS ; Enable to automatically create index defines for 21 | ; options based on there text. 22 | 23 | 24 | %macro INTERNAL_StringParser 0 25 | ; AX, BX, CX, DX, SI, DI registers are either used or destroyed by this macro! 26 | ; 27 | ; On Entry: 28 | ; Direction Flag must be clear 29 | ; DS:SI->Option string 30 | ; DS:DI->Option Table 31 | ; 32 | ; Example Table: 33 | ; 34 | ; SomeOptions: 35 | ; OptTable OnText, OnBadOpt 36 | ; OptSwitch 'H', OnShowHelp 37 | ; OptWild '-', OnDisableThis 38 | ; OptWild '+', OnEnableThis 39 | ; OptSwitch 'VERSION', OnShowVersion 40 | ; OptSwitch 'a', OnLowerA 41 | ; OptSwitch 'A', OnUpperA 42 | ; OptEndTable 43 | 44 | ; When this macro calls a switch function, these registers are passed to the 45 | ; function. The macro will always call at least one sub-function. When the 46 | ; option string is empty, a single call to OnText will be performed with a 47 | ; null string. If there is a requirement to know if the option string is null, 48 | ; it may be desirable to test it before calling this macro. 49 | 50 | ; BX=Address of sub-function, (used for the actual call) 51 | ; CX=Param Length 52 | ; SI=Param Start 53 | ; DI=Next Param 54 | ; DX=1+ index of switch in table, 0=not applicable 55 | 56 | ; When calling a Switch Function, the switch character is excluded. 57 | 58 | ; Except for DS and DI, a sub-function does not need to preserve registers. 59 | ; DS must be preserved. DI will be used as the starting point for the next 60 | ; option to process. The sub-function can modify DI to skip or further breakup 61 | ; the option string text. Use extreme caution when modifying DI. There is no 62 | ; verification to prevent a crash or infinite loop. 63 | 64 | ; On return from the sub-function call: 65 | ; Direction Flag must be clear. 66 | ; If Carry flag is set, processing stops. 67 | ; Otherwise, processing continues from DS:DI. 68 | 69 | ; on return from macro, Carry Flag will be clear when all sub-functions were 70 | ; processed. Carry Flag will be set if processing was aborted. 71 | 72 | PROC_StringParser: 73 | ; cld 74 | %ifndef SWITCH_CHAR 75 | %define SWITCH_CHAR '/' 76 | %endif 77 | ; mov si, 0x81 78 | ; mov di, Options 79 | %%MainLoop: 80 | 81 | %%SkipSpaces: 82 | mov bx, si 83 | lodsb 84 | cmp al, 0x20 85 | je %%SkipSpaces 86 | ; %%SkipDone: 87 | %ifdef FLEX_QUOTES 88 | xor ah, ah 89 | call %%CheckQuote 90 | jnc %%NotQuoted 91 | %%Quoted: 92 | mov bx, si ; move start string 93 | mov ah, al 94 | %%QuotedLoop: 95 | lodsb 96 | cmp al, 0x20 97 | jb %%QuoteEnd 98 | cmp al, ah 99 | jne %%QuotedLoop 100 | jmp %%QuoteEnd 101 | %endif 102 | %%NotQuoted: 103 | lodsb 104 | call %%CheckEnd 105 | jnc %%NotQuoted 106 | jmp %%NotQuotedEnd 107 | %%CheckEnd: 108 | cmp al, 0x20 109 | jbe %%CheckYes 110 | %%CheckSlash: 111 | %ifndef FLEX_QUOTES 112 | test ah, ah 113 | je %%SkipSwitch 114 | %endif 115 | cmp al, SWITCH_CHAR 116 | je %%CheckYes 117 | %ifndef FLEX_QUOTES 118 | %%SkipSwitch: 119 | mov ah, 1 120 | %endif 121 | 122 | ; It can break params on other characters here, next param will be text 123 | ; start with this character. Example: 124 | ; cmp al, '[' 125 | ; je %%CheckYes 126 | ; cmp al, ']' 127 | ; je %%CheckYes 128 | 129 | %%CheckQuote: 130 | cmp al, 0x22 131 | je %%CheckYes 132 | cmp al, 0x27 133 | je %%CheckYes 134 | cmp al, 0x60 135 | je %%CheckYes 136 | clc 137 | ret 138 | %%CheckYes: 139 | stc 140 | ret 141 | %%NotQuotedEnd: 142 | mov cx, si 143 | dec si 144 | %ifdef FLEX_QUOTES 145 | jmp %%NoBackUp 146 | %%QuoteEnd: 147 | mov cx, si 148 | %endif 149 | %%NoBackUp: 150 | sub cx, bx 151 | dec cx 152 | 153 | ; Params have been split 154 | ; BX->Parameter of CX bytes length, SI->Next Paramemter, DI->Option Table 155 | 156 | test cx, cx 157 | jz %%NullString ; Is a NULL String 158 | mov al, SWITCH_CHAR ; Define could be memory address 159 | cmp [bx], al 160 | jne %%AsString ; Not Starting with / 161 | %ifdef FLEX_QUOTES 162 | test ah, ah 163 | jnz %%AsString ; Was not Quoted 164 | %else 165 | cmp [bx+1], al 166 | je %%AsString 167 | %endif 168 | ; Look up Option Switch: 169 | inc bx ; Drop Switch Character 170 | dec cx 171 | 172 | %%LookupOpt: 173 | push di 174 | add di, 4 175 | xor dx, dx 176 | call %%CompareOpt 177 | pop di 178 | test ax, ax 179 | jnz %%MakeCall 180 | mov ax, [di+2] ; not valid sub-function handler 181 | %%MakeCall: 182 | ; BX,CX,SI,DI still set from param splitting, AX=Function Call 183 | ; SI can be updated by function call to skip part or all of the 184 | ; remaining command line parameters. Or even backup, for additional 185 | ; splitting. DI must be preserved. 186 | 187 | ; preserve and juggle registers 188 | push di 189 | mov di, si 190 | mov si, bx 191 | mov bx, ax 192 | 193 | ; BX=Function Call, CX=Param Length, SI=Param Start, DI=Next Param, 194 | ; DX=1+option index 195 | clc 196 | call bx 197 | 198 | ; restore registers 199 | mov si, di 200 | pop di 201 | 202 | ; if carry flag set, abort! 203 | jc %%ParseEnd 204 | 205 | ; check if processing is done. Terminate on NULL, CR, LF, etc. 206 | mov al, [si] ; if next char is less than SPACE, then 207 | cmp al, 0x20 ; processing is done. 208 | jae %%MainLoop ; Repeat for next parameter 209 | clc 210 | %%ParseEnd: ; All Done, Exit Parsing 211 | ret 212 | 213 | %%NullString: 214 | %%AsString: 215 | mov ax, [di] 216 | xor dx, dx 217 | jmp %%MakeCall 218 | 219 | %%CompareOpt: 220 | push bx 221 | push cx 222 | inc dx 223 | %%Comparing: 224 | mov al, [di] 225 | inc di 226 | cmp al, 0x01 227 | jb %%EndOpt 228 | je %%WildOpt 229 | mov ah, [bx] 230 | inc bx 231 | cmp ah, al 232 | je %%SoFarOpt 233 | ; adjust Options String character to Uppercase and try again. 234 | cmp ah, 0x61 235 | jb %%NotLower 236 | cmp ah, 0x7a 237 | ja %%NotLower 238 | sub ah, 0x20 239 | %%NotLower: 240 | cmp ah, al 241 | je %%SoFarOpt 242 | ; mismatch, skip remainder of switch characters 243 | jmp %%SkipOpt 244 | %%SoFarOpt: 245 | loop %%Comparing 246 | mov al, [di] 247 | cmp al, 0x01 248 | ja %%SkipOpt 249 | inc di 250 | %%WildOpt: 251 | mov ax, [di] 252 | add di, 2 253 | pop cx 254 | pop bx 255 | ret 256 | %%SkipOpt: 257 | mov al, [di] 258 | inc di 259 | cmp al, 0x01 260 | ja %%SkipOpt 261 | %%EndOpt: 262 | mov ax, [di] 263 | add di, 2 264 | pop cx 265 | pop bx 266 | test ax, ax 267 | jnz %%CompareOpt 268 | xor dx, dx 269 | ret 270 | %endmacro 271 | 272 | %imacro ParseOptions 1-2 273 | %ifndef ParseOptions_Declared 274 | %idefine ParseOptions_Declared 275 | jmp %%SkipOver 276 | %endif 277 | INTERNAL_StringParser 278 | %%SkipOver: 279 | %if %0 = 1 280 | mov si, 0x81 281 | %elifnidni %2, si 282 | mov si, %2 283 | %endif 284 | mov di, %1 285 | call PROC_StringParser 286 | %endmacro 287 | 288 | %imacro OptTable 2-3 289 | %ifndef INDEXED_OPTIONS 290 | %if %0 = $3 291 | %fatal Indexes not enabled for option tables. 292 | %endif 293 | %else 294 | %assign OPT_SWITCH_INDEX_COUNTER 0 295 | %if %0 = 3 296 | %define OPT_SWITCH_ID %3 297 | %else 298 | %undef OPT_SWITCH_ID 299 | %endif 300 | %endif 301 | dw %1,%2 ; %1=Text call address, %2=Invalid Switch call address 302 | %endmacro 303 | 304 | %imacro OptEndTable 0 305 | %ifdef INDEXED_OPTIONS 306 | %undef OPT_SWITCH_INDEX_COUNTER 307 | %undef OPT_SWITCH_ID 308 | %endif 309 | db 0,0,0 ; Terminate Option Table Data 310 | %endmacro 311 | 312 | %idefine OptTableEnd OptEndTable 313 | 314 | %ifdef INDEXED_OPTIONS 315 | %macro SETOPTIONINDEX 2 316 | %xdefine %1 %2 317 | %endmacro 318 | %endif 319 | 320 | %imacro OptSwitch 2 ; Standard Switch 321 | ; So both UPPER/LOWER case can be used for a switch. 322 | ; UPPER matches UPPER & LOWER, LOWER only matches LOWER 323 | ; If LOWER is used, it should proceed UPPER. 324 | ; If caseless, only use UPPER. 325 | db %1,0x00 ; %1 Switch text, % function call address 326 | dw %2 327 | %ifdef INDEXED_OPTIONS 328 | %assign OPT_SWITCH_INDEX_COUNTER OPT_SWITCH_INDEX_COUNTER + 1 329 | %ifdef OPT_SWITCH_ID 330 | SETOPTIONINDEX OPT_SWITCH_ID %+ _OPTION_ %+ %tok(%1), OPT_SWITCH_INDEX_COUNTER 331 | %else 332 | SETOPTIONINDEX OPTION_ %+ %tok(%1), OPT_SWITCH_INDEX_COUNTER 333 | %endif 334 | %endif 335 | %endmacro 336 | 337 | %imacro OptWild 2 ; Wildcard Switch. Only the first part of an option 338 | ; needs to match the switch. 339 | db %1,0x01 ; %1 Switch text, % function call address 340 | dw %2 341 | %ifdef INDEXED_OPTIONS 342 | %assign OPT_SWITCH_INDEX_COUNTER OPT_SWITCH_INDEX_COUNTER + 1 343 | %ifdef OPT_SWITCH_ID 344 | SETOPTIONINDEX OPT_SWITCH_ID %+ _OPTION_ %+ %tok(%1), OPT_SWITCH_INDEX_COUNTER 345 | %else 346 | SETOPTIONINDEX OPTION_ %+ %tok(%1), OPT_SWITCH_INDEX_COUNTER 347 | %endif 348 | %endif 349 | %endmacro 350 | 351 | -------------------------------------------------------------------------------- /SOURCE/SWITCHES.INC: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | ; common code for command line switches 7 | 8 | %include "V8-HELP.INC" 9 | 10 | 11 | %imacro ColorSwitchHandlers 0 12 | SwitchA: 13 | NumberParam 14 | mov [TextAttr], al 15 | ret 16 | 17 | SwitchColor: 18 | LookupParam ColorTable 19 | cmp ax, 0xffff 20 | jne .Found 21 | NumberParam 22 | .Found: 23 | ret 24 | 25 | SwitchF: 26 | call SwitchColor 27 | cmp ax, 0x000f 28 | ja SwitchError 29 | mov ah, [TextAttr] 30 | and ah, 0xf0 31 | or ah, al 32 | mov [TextAttr], ah 33 | ret 34 | 35 | SwitchB: 36 | call SwitchColor 37 | cmp ax, 0x0007 38 | ja BlinkOnOff 39 | 40 | mov ah, [TextAttr] 41 | mov cl, 4 42 | shl al, cl 43 | and ah, 0x0f 44 | or ah, al 45 | mov [TextAttr], ah 46 | ret 47 | 48 | BlinkOnOff: 49 | cmp ax, 0x8000 50 | je BlinkOff 51 | cmp ax, 0x8001 52 | je BlinkOn 53 | jmp SwitchError 54 | 55 | BlinkOn: 56 | mov ah, [TextAttr] 57 | or ah, 0x80 58 | mov [TextAttr], ah 59 | ret 60 | 61 | BlinkOff: 62 | mov ah, [TextAttr] 63 | and ah, 0x7f 64 | mov [TextAttr], ah 65 | ret 66 | 67 | 68 | ColorTableData ; insert color name table 69 | 70 | %endmacro 71 | 72 | %imacro SwitchData 3 73 | db %1 74 | db %2 75 | dw %3 76 | %endmacro 77 | 78 | %imacro ColorSwitchData 0 79 | SwitchData 'A', 1, SwitchA 80 | SwitchData 'F', 1, SwitchF 81 | SwitchData 'B', 1, SwitchB 82 | %endmacro 83 | 84 | %imacro XYSwitchHandlers 0 85 | SwitchX: 86 | NumberParam 87 | dec al 88 | mov [CurrentX], al 89 | ret 90 | 91 | SwitchY: 92 | call NumberParam 93 | dec al 94 | mov [CurrentY], al 95 | ret 96 | 97 | CurrentXY: 98 | CurrentX: DB 0 99 | CurrentY: DB 0 100 | %endmacro 101 | 102 | %imacro SizeSwitchHandlers 0 103 | SwitchW: 104 | NumberParam 105 | mov [CurrentW], al 106 | ret 107 | 108 | SwitchH: 109 | NumberParam 110 | mov [CurrentH], al 111 | ret 112 | 113 | CurrentSize: 114 | CurrentW: DB 80 115 | CurrentH: DB 25 116 | %endmacro 117 | 118 | %imacro SetMaxSize 0 119 | push ax 120 | push bx 121 | mov ax, [WindMax] 122 | mov bx, [WindMin] 123 | sub ah, bh 124 | sub al, bl 125 | inc ah 126 | inc al 127 | mov [CurrentSize], ax 128 | pop bx 129 | pop ax 130 | %endmacro 131 | 132 | %imacro BoundsSwitchHandler 0 133 | SwitchK: 134 | NumberParam 135 | mov ah, 1 136 | mov [BoundsChar], al 137 | mov [UseBoundsChar], ah 138 | FrameBounds 139 | ret 140 | %endmacro 141 | 142 | %imacro LocalSwitchHandlers 0 143 | SwitchK: 144 | NumberParam 145 | mov ah, 1 146 | mov [BoundsChar], al 147 | mov [UseBoundsChar], ah 148 | SwitchL: 149 | FrameBounds 150 | ret 151 | SwitchG: 152 | mov ax, 0x0000 153 | mov [WindMin], ax 154 | mov ax, [ScreenMax] 155 | mov [WindMax], ax 156 | ret 157 | %endmacro 158 | 159 | %imacro XYSwitchData 0 160 | SwitchData 'X', 1, SwitchX 161 | SwitchData 'Y', 1, SwitchY 162 | %endmacro 163 | 164 | %imacro SizeSwitchData 0 165 | SwitchData 'W', 1, SwitchW 166 | SwitchData 'H', 1, SwitchH 167 | %endmacro 168 | 169 | %imacro BoundsSwitchData 0 170 | SwitchData 'K', 1, SwitchK 171 | %endmacro 172 | 173 | %imacro LocalSwitchData 0 174 | SwitchData 'L', 0, SwitchL 175 | SwitchData 'G', 0, SwitchG 176 | BoundsSwitchData 177 | %endmacro 178 | 179 | %imacro HelpSwitchData 0 180 | SwitchData '?', 0, SwitchHelp 181 | %endmacro 182 | 183 | -------------------------------------------------------------------------------- /SOURCE/TABLES.INC: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | ; common table macros 7 | 8 | %imacro TableData 2 9 | DB %1 10 | DB 0 11 | DW %2 12 | %endmacro 13 | 14 | %imacro TableEnd 0 15 | DB 0 16 | DW 0xffff 17 | %endmacro 18 | 19 | %imacro ColorTableData 0 20 | ColorTable: 21 | TableData "BLACK",0 22 | TableData "BLUE", 1 23 | TableData "GREEN",2 24 | TableData "CYAN",3 25 | TableData "RED",4 26 | TableData "MAGENTA",5 27 | TableData "BROWN",6 28 | TableData "GRAY",7 29 | TableData "GREY",7 30 | ; TableData "LIGHTGRAY",7 31 | ; TableData "LIGHT GRAY",7 32 | TableData "DARKGRAY",8 33 | ; TableData "DARK GRAY",8 34 | TableData "DARKGREY",8 35 | ; TableData "DARK GREY",8 36 | TableData "LIGHTBLUE",9 37 | ; TableData "LIGHT BLUE",9 38 | TableData "LIGHTGREEN",10 39 | ; TableData "LIGHT GREEN",10 40 | TableData "LIGHTCYAN",11 41 | ; TableData "LIGHT CYAN",11 42 | TableData "LIGHTRED",12 43 | ; TableData "LIGHT RED",12 44 | TableData "LIGHTMAGENTA",13 45 | ; TableData "LIGHT MAGENTA",13 46 | TableData "YELLOW",14 47 | TableData "WHITE",15 48 | TableData "LINKOFF",0x8000 49 | TableData "LINKON",0x8001 50 | TableEnd 51 | %endmacro 52 | -------------------------------------------------------------------------------- /SOURCE/TRANSLAT.INC: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %idefine TransBufSize 10240 7 | %idefine ReadBufSize 512 8 | ; %idefine TransBufSize 256 9 | 10 | ; Options ComandLine Parser 11 | %imacro Translator 1 12 | ; Translator: 13 | mov [FileNamePtr], di 14 | xor al, al 15 | .SearchStartTag: 16 | mov [si], al 17 | inc si 18 | cmp al, 0x0d 19 | je BadParams 20 | cmp al, 0x20 21 | je .SearchStartTag 22 | mov [StrPosition], si 23 | .SearhEndOfTag: 24 | mov al, [si] 25 | inc si 26 | cmp al, 0x0d 27 | je .EndOfTag 28 | cmp al, 0x20 29 | jne .SearhEndOfTag 30 | .EndOfTag: 31 | mov di, TransBuf 32 | mov [OutPosition], di 33 | mov [ParmPosition], si 34 | mov si, [StrPosition] 35 | 36 | ; open translation file 37 | FileOpen FileNamePtr, FileHandle 38 | ; save output position 39 | 40 | ; starting searching for string 41 | ; started new line 42 | mov ah, 0x01 43 | xor cx, cx 44 | 45 | SearchForString: 46 | mov di, ReadBuffer 47 | .KeepSearching: 48 | cmp cx, 0 49 | jne .NotEmpty 50 | call ReadMoreData 51 | jc ReadError 52 | cmp cx, 0 53 | je MatchNotFound 54 | .NotEmpty: 55 | mov al, [di] 56 | mov bl, [si] 57 | inc di 58 | inc si 59 | dec cx 60 | cmp al, 0x0d 61 | je .NewLine 62 | cmp al, 0x0a 63 | je .NewLine 64 | cmp ah, 0x00 65 | je .KeepSearching 66 | inc ah 67 | cmp al, bl 68 | je .KeepSearching 69 | cmp bl, 0x20 70 | je .TestEqual 71 | cmp bl, 0x0d 72 | jne .MissMatch 73 | .TestEqual: 74 | cmp al, 0x3d ; '=' 75 | jne .MissMatch 76 | mov [StrPosition], si 77 | jmp ReadString 78 | .MissMatch: 79 | xor ah, ah 80 | jmp .KeepSearching 81 | .NewLine: 82 | mov ah, 0x01 83 | mov si, [StrPosition] 84 | jmp .KeepSearching 85 | 86 | ReadMoreData: 87 | push ax 88 | push di 89 | ZeroMemory ReadBuffer, ReadBufferEnd - ReadBuffer 90 | pop di 91 | mov ah, 0x3f 92 | mov bx, [FileHandle] 93 | mov cx, ReadBufferEnd - ReadBuffer 94 | mov dx, ReadBuffer 95 | int 0x21 96 | mov di, ReadBuffer 97 | mov cx, ax 98 | pop ax 99 | jnc .ReadOK 100 | xor cx, cx 101 | stc 102 | ret 103 | .ReadOK: 104 | clc 105 | ret 106 | 107 | ReadString: 108 | mov ax, 0x0020 109 | call .PutChar 110 | .KeepReading: 111 | cmp cx, 0 112 | jne .NotEmpty 113 | call ReadMoreData 114 | jc ReadError 115 | cmp cx, 0 116 | je .EndOfString 117 | .NotEmpty: 118 | mov al, [di] 119 | inc di 120 | inc si 121 | dec cx 122 | cmp ah, 0x25 123 | je .PercentValue 124 | cmp al, 0x25 ; '%' 125 | jne .NotPercent 126 | mov ah, 0x25 127 | jmp .KeepReading 128 | .NotPercent: 129 | cmp al, 0x0d 130 | je .EndOfString 131 | cmp al, 0x0a 132 | je .EndOfString 133 | call .PutChar 134 | jmp .KeepReading 135 | .PercentValue: 136 | xor ah, ah 137 | cmp al, 0x25 138 | je .NotPercent 139 | cmp ax, 0x0031 ; ascii '1' 140 | jl .NotValue 141 | cmp ax, 0x0039 ; ascii '9' 142 | jg .NotValue 143 | ; insert parameter al 144 | mov bh, al 145 | sub al, 0x30 146 | mov si, [ParmPosition] 147 | 148 | .SearchParam: 149 | mov ah, [si] 150 | cmp ah, 0x20 151 | jne .FindParam 152 | inc si 153 | jmp .SearchParam 154 | .FindParam: 155 | mov ah, [si] 156 | cmp ah, 0x0d 157 | je .NoParam 158 | cmp ah, 0x22 159 | je .Qouted 160 | cmp ah, 0x27 161 | je .Qouted 162 | cmp ah, 0x60 163 | je .Qouted 164 | mov bl, 0x20 165 | .CheckParam: 166 | dec al 167 | cmp al, 0 168 | je .FoundParam 169 | .FindParamEnd: 170 | mov ah, [si] 171 | inc si 172 | cmp ah, 0x0d 173 | je .NoParam 174 | cmp ah, bl 175 | je .SearchParam 176 | jmp .FindParamEnd 177 | .Qouted: 178 | mov bl, ah 179 | inc si 180 | jmp .CheckParam 181 | .FoundParam: 182 | .AddParam: 183 | mov al, [si] 184 | inc si 185 | cmp al, 0x0d 186 | je .KeepReading 187 | cmp al, bl 188 | je .KeepReading 189 | call .PutChar 190 | jmp .AddParam 191 | .NoParam: 192 | mov al, bh 193 | .NotValue: 194 | push ax 195 | mov al, 0x25 196 | call .PutChar 197 | pop ax 198 | call .PutChar 199 | jmp .KeepReading 200 | 201 | .PutChar: 202 | push di 203 | mov di, [OutPosition] 204 | cmp di, TransBufEnd 205 | je .OverFlow 206 | mov [di], al 207 | inc di 208 | mov [OutPosition], di 209 | .OverFlow: 210 | ; Just quit adding output on overflow. 211 | pop di 212 | ret 213 | .EndOfString: 214 | mov al, 0x0d 215 | call .PutChar 216 | xor al, al 217 | call .PutChar 218 | 219 | 220 | ; temporary development displayed output. 221 | ; StdOutStr TransBuf 222 | ; StdOutCRLF 223 | 224 | ; Execute Self with new Commands. 225 | call CloseFile 226 | mov si, TransBuf 227 | jmp %1 228 | 229 | MatchNotFound: 230 | ; Nothing at present 231 | ReadError: 232 | ; Nothing at present 233 | BadParams: 234 | StdOutStr CommandLineErrorMsg 235 | StdOutCRLF 236 | 237 | ErrorExit: 238 | call CloseFile 239 | Terminate 100 240 | 241 | CloseFile: 242 | FileClose FileHandle 243 | ret 244 | 245 | StrPosition: 246 | dw 0 247 | OutPosition: 248 | dw 0 249 | ParmPosition: 250 | dw 0 251 | 252 | FileNamePtr: 253 | dw 0 254 | FileHandle: 255 | dw 0 256 | 257 | TransBuf: 258 | times TransBufSize db 0x0d 259 | TransBufEnd: 260 | db 0x0d,0 261 | 262 | ReadBuffer: 263 | times ReadBufSize db 0 264 | ReadBufferEnd: 265 | db 0 266 | 267 | %endmacro 268 | 269 | -------------------------------------------------------------------------------- /SOURCE/V8-BIOS.INC: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM 2.14rc0 5 | -------------------------------------------------------------------------------- /SOURCE/V8-DATA.INC: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM 2.14rc0 5 | 6 | DATA_SEGMENT 7 | 8 | %idefine ApplicationDataBlock 9 | 10 | %ifdef Require_PlaceHolderApplication 11 | Message_PlaceHolderApplication: 12 | DB "This program is only a placeholder for an executable. Eventually, it will be",0x0d,0x0a 13 | DB "replaced by a functional program that actually does something useful. But, that",0x0d,0x0a 14 | DB "will not be until some time in the future. Hopefully.$" 15 | %endif -------------------------------------------------------------------------------- /SOURCE/V8-DEBUG.INC: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM 2.14rc0 5 | 6 | ; macro to print a character for debugging 7 | %imacro DebugOutput 0 8 | %ifndef Declared_DebugOutput 9 | %idefine Declared_DebugOutput 10 | jmp %%Over 11 | ..@proc_DebugOutput: 12 | push ax 13 | mov ah, 0x02 14 | int 0x21 15 | pop ax 16 | ret 17 | %endif 18 | %%Over: 19 | call ..@proc_DebugOutput 20 | %endmacro 21 | 22 | %imacro DebugChar 0-1 dl 23 | %ifnidni %1, dl 24 | push dx 25 | mov dl, %1 26 | %endif 27 | DebugOutput 28 | %ifnidni %1, dl 29 | pop dx 30 | %endif 31 | %endmacro 32 | 33 | %imacro DebugHexNibble 0 34 | %ifndef Declared_DebugHexNibble 35 | %idefine Declared_DebugHexNibble 36 | jmp %%Over 37 | ..@proc_DebugHexNibble: 38 | push ax 39 | and al, 0x0f 40 | add al, 0x30 41 | cmp al, 0x39 42 | jbe %%NotAlpha 43 | add al, 0x07 44 | %%NotAlpha: 45 | DebugChar al 46 | pop ax 47 | ret 48 | %endif 49 | %%Over: 50 | call ..@proc_DebugHexNibble 51 | %endmacro 52 | 53 | %imacro DebugHexByte 0-1 al 54 | %ifndef Declared_DebugHexByte 55 | %idefine Declared_DebugHexByte 56 | jmp %%Over 57 | ..@proc_DebugHexByte: 58 | push cx 59 | %ifnidni %1, al 60 | push ax 61 | mov al, %1 62 | %endif 63 | push ax 64 | mov cl, 4 65 | shr al, cl 66 | and al, 0x0f 67 | DebugHexNibble 68 | pop ax 69 | DebugHexNibble 70 | %ifnidni %1, al 71 | pop ax 72 | %endif 73 | pop cx 74 | ret 75 | %endif 76 | %%Over: 77 | call ..@proc_DebugHexByte 78 | %endmacro 79 | 80 | %imacro DebugHexWord 0-1 81 | %ifndef Declared_DebugHexWord 82 | %idefine Declared_DebugHexWord 83 | jmp %%Over 84 | ..@proc_DebugHexWord: 85 | xchg al, ah 86 | DebugHexByte al 87 | xchg al, ah 88 | DebugHexbyte al 89 | ret 90 | %endif 91 | %%Over: 92 | %ifnidni %1, ax 93 | push ax 94 | mov ax, %1 95 | %endif 96 | call ..@proc_DebugHexWord 97 | %ifnidni %1, ax 98 | pop ax 99 | %endif 100 | %endmacro 101 | -------------------------------------------------------------------------------- /SOURCE/V8-DOS.INC: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM 2.14rc0 for DOS 5 | 6 | ; DOS Program Prefix Segment Offset Definitions 7 | ; byte, CP/M exit INT 20h 8 | %idefine PSP_INT20 0x00 9 | 10 | ; word, Segment of the first byte beyond the program 11 | %idefine PSP_MEMTOP 0x02 12 | 13 | ; 5 bytes, Far call to DOS Function Dispatcher 14 | %idefine PSP_DOSCALL 0x05 15 | 16 | ; dword, Terminate address for parent program 17 | %idefine PSP_TERMINATE 0x0A 18 | 19 | ; dword, Control-Break address for parent program 20 | %idefine PSP_BREAK 0x0E 21 | 22 | ; dword, Critical error address for parent program 23 | %idefine PSP_ERROR 0x12 24 | 25 | ; word, Parent program PSP Segment 26 | %idefine PSP_PARENT 0x16 27 | 28 | ; word, Environment Segment 29 | %idefine PSP_ENV 0x2c 30 | 31 | ; byte, Number of bytes in command line 32 | %idefine PSP_CMDLEN 0x80 33 | 34 | ; command line, ends in 0x0d 35 | %idefine PSP_CMDLN 0x81 36 | 37 | %imacro SHELLEXECBLOCK 0 38 | .ENVIRONMENT resw 1 39 | .COMMANDPTR resd 1 40 | .FCB1 resd 1 41 | .FCB2 resd 1 42 | .STACKPTR resd 1 43 | .CODEPTR resd 1 44 | .EXECLINE resb 1 + 128 ; Not part of actual Paramblock 45 | .SAVESTACK resd 1 ; Not part of actual Paramblock 46 | %endmacro 47 | 48 | struc tPARAMBLOCK 49 | SHELLEXECBLOCK 50 | endstruc 51 | 52 | %idefine PARAMBLOCK(x) tPARAMBLOCK. %+ x 53 | 54 | ; DOS Functions 55 | %imacro DOS_Terminate 0-1 56 | %if %0 = 0 57 | mov ax, 0x4c00 58 | %elifidni %1, al 59 | mov ah, 0x4c 60 | %else 61 | mov ah, 0x4c 62 | mov al, %1 63 | %endif 64 | int 0x21 65 | %endmacro 66 | 67 | 68 | %imacro DOS_PrintString 0-1 69 | ; DS:DX = string pointer, string ends in $ character 70 | mov ah, 0x09 71 | %ifnidni %1, dx 72 | mov dx, %1 73 | %endif 74 | int 0x21 75 | %endmacro 76 | 77 | -------------------------------------------------------------------------------- /SOURCE/V8-FINAL.INC: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM 2.14rc0 5 | 6 | CODE_SEGMENT 7 | 8 | %ifndef Require_Terminate 9 | ; Terminate 0 10 | %idefine Require_Terminate 11 | %endif 12 | 13 | %ifdef Require_Terminate 14 | proc_Terminate: 15 | DOS_Terminate al 16 | %endif 17 | 18 | %ifndef ApplicationDataBlock 19 | %include 'V8-DATA.INC' 20 | %endif 21 | 22 | BSS_SEGMENT 23 | 24 | HEAP_SEGMENT -------------------------------------------------------------------------------- /SOURCE/V8-GRPHX.INC: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM 2.14rc0 5 | -------------------------------------------------------------------------------- /SOURCE/V8-HELP.INC: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM 2.14rc0 5 | 6 | %imacro HelpSwitchHandler 0-1 '' 7 | SwitchHelp: 8 | %ifidni %1, '' 9 | ;%ifdef NoVideoOutput 10 | StdOutStr %%NoHelpMessage 11 | ;%else 12 | ; WriteStr %%NoHelpMessage 13 | ;%endif 14 | jmp %%Done 15 | %%NoHelpMessage: 16 | DB 'See V8Power Tools docs.',0 17 | %else 18 | ; set filename based on env strings and program 19 | SearchEnv %%EnvHelp 20 | jc %%HelpNotSet 21 | mov di, PSP_CMDLEN 22 | call %%CopyStr 23 | mov al, '\' 24 | cs stosb 25 | push cs 26 | pop ds 27 | mov si, %%UtilName 28 | call %%CopyStr 29 | mov al, '.' 30 | cs stosb 31 | SearchEnv %%EnvLang 32 | jnc %%CopyLang 33 | push cs 34 | pop ds 35 | mov si, %%DefLang 36 | %%CopyLang: 37 | call %%CopyStr 38 | push cs 39 | pop ds 40 | xor al, al 41 | stosb 42 | mov ax, 0x3d00 43 | mov dx, PSP_CMDLEN 44 | int 0x21 45 | jnc %%FileOpened 46 | %%ChangeExt: 47 | mov al, [di] 48 | cmp al, '.' 49 | je %%ExtFound 50 | dec di 51 | jmp %%ChangeExt 52 | %%ExtFound: 53 | inc di 54 | mov si, %%DefLang 55 | call %%CopyStr 56 | xor al, al 57 | stosb 58 | mov ax, 0x3d00 59 | int 0x21 60 | jnc %%FileOpened 61 | 62 | StdOutStr PSP_CMDLEN 63 | StdOutStr %%HelpMissing 64 | jmp %%Done 65 | 66 | 67 | %%FileOpened: 68 | mov bx, ax 69 | mov cx, 0x100 - PSP_CMDLEN - 1 70 | ; mov dx, PSP_CMDLEN 71 | %%ReadLoop: 72 | mov ah, 0x3f 73 | int 0x21 74 | jc %%ReadDone 75 | push dx 76 | mov si, dx 77 | %%PrintLoop: 78 | cmp ax, 0 79 | je %%PrintDone 80 | mov dl, [si] 81 | inc si 82 | dec ax 83 | push ax 84 | mov ah, 0x02 85 | int 0x21 86 | pop ax 87 | jmp %%PrintLoop 88 | %%PrintDone: 89 | pop dx 90 | cmp si, dx 91 | jne %%ReadLoop 92 | %%ReadDone: 93 | mov ah, 0x3e 94 | int 0x21 95 | jmp %%Done 96 | 97 | %%HelpNotSet: 98 | push cs 99 | pop ds 100 | StdOutStr %%EnvHelp 101 | StdOutStr %%EnvHelpNotSet 102 | jmp %%Done 103 | %%CopyStr: 104 | cld 105 | lodsb 106 | cmp al, 0 107 | retz 108 | cs stosb 109 | jmp %%CopyStr 110 | 111 | %%EnvHelpNotSet: 112 | DB ' environment variable is not set.',0 113 | %%HelpMissing: 114 | DB ' file not found.',0 115 | %%EnvHelp: 116 | DB 'HELPPATH',0 117 | %%EnvLang: 118 | DB 'LANG',0 119 | %%UtilName: 120 | DB %1,0 121 | %%DefLang: 122 | DB 'en',0 123 | %endif 124 | 125 | %%CRLFString: 126 | DB CRLF,0 127 | 128 | %%Done: 129 | push cs 130 | pop ds 131 | StdOutStr %%CRLFString 132 | Terminate 0 133 | 134 | %endmacro -------------------------------------------------------------------------------- /SOURCE/V8-MACRO.INC: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | ; NASM 2.14rc0 4 | 5 | ; 8086 language extensions 6 | 7 | %imacro retz 0 8 | jnz %%Skip 9 | ret 10 | %%Skip: 11 | %endmacro 12 | 13 | %imacro retnz 0 14 | jz %%Skip 15 | ret 16 | %%Skip: 17 | %endmacro 18 | 19 | %imacro retc 0 20 | jnc %%Skip 21 | ret 22 | %%Skip: 23 | %endmacro 24 | 25 | %imacro retnc 0 26 | jc %%Skip 27 | ret 28 | %%Skip: 29 | %endmacro 30 | 31 | %imacro pushall 0 32 | pushf 33 | push ax 34 | push bx 35 | push cx 36 | push dx 37 | push si 38 | push di 39 | push es 40 | push ds 41 | push bp 42 | %endmacro 43 | 44 | %imacro popall 0 45 | pop bp 46 | pop ds 47 | pop es 48 | pop di 49 | pop si 50 | pop dx 51 | pop cx 52 | pop bx 53 | pop ax 54 | popf 55 | %endmacro 56 | 57 | %imacro pushx 0-* 58 | %ifidni %0, 0 59 | pushall 60 | %elifidni %1, all 61 | pushall 62 | %else 63 | %rep %0 64 | push %1 65 | %rotate 1 66 | %endrep 67 | %endif 68 | %endmacro 69 | 70 | %imacro popx 1-* 71 | %ifidni %0, 0 72 | popall 73 | %elifidni %1, all 74 | popall 75 | %else 76 | %rep %0 77 | ; %rotate -1 reverse order 78 | pop %1 79 | %rotate 1 80 | %endrep 81 | %endif 82 | %endmacro 83 | 84 | ; NASM Extensions 85 | %imacro Declare 1 86 | %ifndef Delcared_%1 87 | %idefine Delcared_%1 88 | %1: 89 | %endif 90 | %endmacro 91 | 92 | %imacro CODE_SEGMENT 0 93 | section Section_CODE 94 | Declare Application_Start 95 | %endmacro 96 | 97 | %imacro DATA_SEGMENT 0 98 | section Section_DATA 99 | Declare Application_Data 100 | %endmacro 101 | 102 | %imacro SHARED_SEGMENT 0 103 | section Section_SHARED 104 | Declare Application_Shared 105 | %endmacro 106 | 107 | %imacro BSS_SEGMENT 0 108 | section Section_BSS 109 | Declare Application_BSS 110 | %endmacro 0 111 | 112 | %imacro HEAP_SEGMENT 0 113 | section Section_BSS 114 | Declare Application_Heap 115 | %endmacro 0 116 | 117 | 118 | -------------------------------------------------------------------------------- /SOURCE/V8-PREP.INC: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM 2.14rc0 5 | 6 | use16 7 | 8 | cpu 8086 9 | 10 | org 0x100 11 | 12 | %include 'V8-MACRO.INC' 13 | %include 'V8-STRUC.INC' 14 | %include 'V8-DOS.INC' 15 | 16 | %imacro Terminate 0-1 0 17 | %idefine Require_Terminate 18 | %ifidni %1, al 19 | %elif %1 = 0 20 | xor al, al 21 | %else 22 | mov al, %1 23 | %endif 24 | jmp proc_Terminate 25 | %endmacro 26 | 27 | %imacro PlaceHolderApplication 0 28 | %idefine Require_PlaceHolderApplication 29 | DOS_PrintString Message_PlaceHolderApplication 30 | %endmacro 31 | 32 | CODE_SEGMENT -------------------------------------------------------------------------------- /SOURCE/V8-STRUC.INC: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM 2.14rc0 5 | -------------------------------------------------------------------------------- /SOURCE/V8-VBIOS.INC: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2024 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM 2.14rc0 5 | 6 | %idefine VideoCardIsVESA 9 7 | %idefine VideoCardIsVGA 8 8 | %idefine VideoCardIsMCGA 7 9 | %idefine VideoCardIsEGA 6 10 | %idefine VideoCardIsCGA 5 11 | %idefine VideoCardIsInColor 4 12 | %idefine VideoCardIsHGCPlus 3 13 | %idefine VideoCardIsHGC 2 14 | %idefine VideoCardIsMDA 1 15 | %idefine VideoCardIsUnknown 0 16 | 17 | %imacro Probe_Display_Adapter 0 18 | 19 | %%Probe_VGA: ; 1897 20 | mov ax, 0x1200 ; video subsystem config 21 | mov bl, 0x36 ; enable/disable display refresh 22 | ; al=0 enable, al=1 disable 23 | int 0x10 24 | cmp al, 0x12 ; check on success 25 | jne %%Probe_MCGA 26 | 27 | %%Probe_VESA: 28 | push di 29 | mov ax, 0x4f00 30 | mov di, %%VesaBuffer ; ES:DI --> 256byte Buffer 31 | int 0x10 32 | pop di 33 | cmp ax, 0x004f 34 | jne %%OnlyVGA 35 | ; quick dirty VESA test 36 | mov dx, [%%VesaBuffer] 37 | cmp dx, 'VE' 38 | jne %%OnlyVGA 39 | mov dx, [%%VesaBuffer + 2] 40 | cmp dx, 'SA' 41 | jne %%OnlyVGA 42 | mov al, VideoCardIsVESA 43 | jmp %%Done 44 | 45 | %%OnlyVGA: 46 | mov al, VideoCardIsVGA 47 | jmp %%Done 48 | 49 | %%VesaBuffer: ; This needs moved to the an unintialized 50 | times 0x100 db 0 ; data area 51 | 52 | %%Probe_MCGA: ; 1987 53 | mov ax, 0x1200 ; video subsystem config 54 | mov bl, 0x32 ; enable/disable cpu access to video ram 55 | ; al=0 enable, al=1 disable 56 | int 0x10 57 | cmp al, 0x12 ; check success 58 | jne %%Probe_EGA 59 | mov al, VideoCardIsMCGA 60 | jmp %%Done 61 | 62 | %%Probe_EGA: ; 1984 63 | mov ax, 0x1200 ; video subsystem config 64 | mov bx, 0x0010 ; get video config 65 | int 0x10 66 | cmp ah, 0x10 ; check success 67 | jne %%Probe_CGA 68 | mov al, VideoCardIsEGA 69 | jmp %%Done 70 | 71 | %%Probe_Ports: 72 | mov ax, 0x060a ; change cursor bottom scan line 73 | ; set ah=06 for later 74 | mov bl, al 75 | out dx, al 76 | inc dx 77 | in al, dx ; get current 78 | xchg al, ah 79 | cmp ah, al 80 | jne %%Change_Value 81 | dec al 82 | dec bl 83 | %%Change_Value: 84 | out dx, al 85 | mov cx, 0x0050 ; small delay 86 | %%Probe_Delay: 87 | loop %%Probe_Delay 88 | in al, dx ; get new value 89 | xchg al, ah 90 | out dx, al ; restore old value 91 | cmp ah, bl 92 | ret 93 | 94 | ; it should be possible to first get base port number 95 | ; of active 6845 controller from BDA at 0040:0063 96 | 97 | %%Probe_CGA: 98 | mov dx, 0x3d4 ; video port 99 | call %%Probe_Ports 100 | jne %%Probe_Monochrome 101 | mov al, VideoCardIsCGA 102 | jmp %%Done 103 | 104 | %%Probe_Monochrome: 105 | mov dx, 0x3b4 ; video port 106 | call %%Probe_Ports 107 | 108 | jne %%Probe_Failed ; not 100% sure on this part 109 | 110 | ; jne %%Probe_MDA 111 | ; mov al, Monochrome 112 | ; jmp %%Done 113 | 114 | %%Probe_MDA: 115 | mov cx, 0xf000 ; watch for bit 7 to change 116 | mov bx, 0x0080 ; stays the same on MDA 117 | mov dx, 0x03ba 118 | xor ax, ax 119 | %%Probe_Watching: 120 | in al, dx 121 | test ax, bx 122 | loopnz %%Probe_Watching 123 | cmp cx, 0 124 | jne %%Probe_InColor 125 | mov al, VideoCardIsMDA 126 | jmp %%Done 127 | 128 | %%Probe_InColor: 129 | and al, 01110000b ; Al left over from chwecking status 130 | cmp al, 01010000b ; register in MDA Probe 131 | jne %%Probe_HGCPlus 132 | mov al, VideoCardIsInColor 133 | jmp %%Done 134 | 135 | %%Probe_HGCPlus: 136 | cmp al, 00010000b 137 | jne %%Probe_HGC 138 | mov al, VideoCardIsHGCPlus 139 | jmp %%Done 140 | 141 | %%Probe_HGC: 142 | mov al, VideoCardIsHGC 143 | jmp %%Done 144 | 145 | %%Probe_Failed: 146 | xor al,al 147 | 148 | %%Done: 149 | xor ah,ah 150 | 151 | %endmacro `` -------------------------------------------------------------------------------- /SOURCE/VCHKBOX.ASM: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %include "V8-PREP.INC" 7 | 8 | PlaceHolderApplication 9 | 10 | %include "V8-FINAL.INC" 11 | 12 | 13 | -------------------------------------------------------------------------------- /SOURCE/VCLS.ASM: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %include "COMMON.INC" 7 | 8 | ; SetMaxSize 9 | 10 | CommandLineParser ; insert code for command line parsing 11 | 12 | mov cx, [WindMin] 13 | mov dx, [WindMax] 14 | 15 | mov al, [EolOnly] 16 | cmp al, 1 17 | jne .NotEolOnly 18 | push dx 19 | mov ah, 0x03 20 | mov bh, [VideoPage] 21 | int 0x10 22 | mov cx, dx 23 | pop dx 24 | mov dh, ch 25 | mov [WindMin], cx 26 | mov [WindMax], dx 27 | .NotEolOnly: 28 | mov ah, 0x0a 29 | mov al, [TextOnly] 30 | cmp al, 1 31 | je .WriteClear 32 | mov ah, 0x09 33 | mov al, [FillChar] 34 | cmp al, 0x20 35 | jne .WriteClear 36 | 37 | mov ax, 0x0600 38 | mov bh, [TextAttr] 39 | int 0x10 40 | jmp .Done 41 | 42 | .WriteClear: 43 | sub dh, ch 44 | sub dl, cl 45 | xchg cx, dx 46 | inc cl 47 | inc ch 48 | xor dx, dx 49 | mov al, [FillChar] 50 | mov bh, [VideoPage] 51 | xor bl, [TextAttr] 52 | .ClearTextLoop: 53 | push ax 54 | GotoXY dx 55 | pop ax 56 | push ax 57 | push bx 58 | push cx 59 | push dx 60 | xor ch, ch 61 | int 0x10 62 | pop dx 63 | pop cx 64 | pop bx 65 | pop ax 66 | inc dh 67 | dec ch 68 | cmp ch, 0 69 | jne .ClearTextLoop 70 | mov cx, [WindMin] 71 | 72 | .Done: 73 | xor cx, cx 74 | GotoXY cx 75 | Terminate 0 76 | 77 | FillCode: 78 | NumberParam 79 | mov [FillChar], al 80 | ret 81 | 82 | NoSwitch: 83 | LookupParam OptionalTable 84 | cmp ax, 0xffff 85 | je .NotOptional 86 | jmp ax 87 | ret 88 | 89 | 90 | .NotOptional: 91 | ; NoSwitch falls through to SwitchA 92 | ColorSwitchHandlers ; Procedures for handling color switches. 93 | LocalSwitchHandlers ; Procedures for handling local and global relations. 94 | 95 | SwitchX: 96 | NumberParam 97 | dec al 98 | mov cl, [ScreenMaxX] 99 | cmp al, cl 100 | jle .Ok 101 | mov al, cl 102 | .Ok: 103 | mov [WindMinX], al 104 | ret 105 | 106 | SwitchY: 107 | call NumberParam 108 | dec al 109 | mov cl, [ScreenMaxY] 110 | cmp al, cl 111 | jle .Ok 112 | mov al, cl 113 | .Ok: 114 | mov [WindMinY], al 115 | ret 116 | 117 | SwitchW: 118 | NumberParam 119 | dec al 120 | mov bl, [WindMinX] 121 | add al, bl 122 | mov cl, [WindMaxX] 123 | cmp al, cl 124 | jle .Ok 125 | mov al, cl 126 | .Ok: 127 | mov [WindMaxX], al 128 | ret 129 | SwitchH: 130 | NumberParam 131 | dec al 132 | mov bl, [WindMinY] 133 | add al, bl 134 | mov cl, [ScreenMaxY] 135 | cmp al, cl 136 | jle .Ok 137 | mov al, cl 138 | .Ok: 139 | mov [WindMaxY], al 140 | ret 141 | 142 | OptionText: 143 | mov al, 1 144 | mov [TextOnly], al 145 | ret 146 | 147 | OptionEol: 148 | mov al, 1 149 | mov [EolOnly], al 150 | ret 151 | 152 | HelpSwitchHandler 'vcls' 153 | 154 | CommandLineSwitches: 155 | SwitchData 0, 0, NoSwitch 156 | ColorSwitchData 157 | LocalSwitchData 158 | XYSwitchData 159 | SizeSwitchData 160 | SwitchData 'C', 1, FillCode 161 | HelpSwitchData 162 | SwitchData 0, 0, 0 163 | 164 | OptionalTable: 165 | TableData "EOL",OptionEol 166 | TableData "TEXT",OptionText 167 | TableEnd 168 | 169 | FillChar: 170 | db 0x20 171 | EolOnly: 172 | DB 0 173 | TextOnly: 174 | DB 0 175 | -------------------------------------------------------------------------------- /SOURCE/VCURSOR.ASM: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %idefine NoVideoOutput 7 | 8 | %include "COMMON.INC" 9 | 10 | CommandLineParser ; insert code for command line parsing 11 | 12 | MainProgram: 13 | mov al, [CursorSet] 14 | cmp al, 1 15 | je .Done 16 | mov ax, [CursorShape] 17 | StdOutHexWord 18 | StdOutCRLF 19 | .Done: 20 | mov ah, 0x01 21 | mov cx, [CursorShape] 22 | int 0x10 23 | Terminate 0 24 | 25 | LookupParamProc 26 | NUmberParamProc 27 | 28 | NoSwitch: 29 | push es 30 | LookupParam CursorStyles 31 | cmp ax, 0xffff 32 | jne .Found 33 | NumberParam 34 | 35 | jmp .Done 36 | .Found: 37 | cmp ax, 1 38 | jne .NotHide 39 | mov ax, 0x2000 40 | jmp .Done 41 | .NotHide: 42 | mov bx, 0x0040 43 | mov es, bx 44 | mov cl, [es:0x0085] 45 | cmp ax, 2 46 | jne .NotSmall 47 | mov al, cl 48 | mov ah, al 49 | sub ah, 2 50 | jmp .Done 51 | .NotSmall: 52 | cmp ax, 3 53 | jne .NotHalf 54 | mov al, cl 55 | mov ah, al 56 | shr ah, 1 57 | jmp .Done 58 | .NotHalf: 59 | mov al, cl 60 | mov ah, 0 61 | .Done: 62 | pop es 63 | mov [CursorShape], ax 64 | mov al, 1 65 | mov [CursorSet], al 66 | ret 67 | 68 | HelpSwitchHandler 'vcursor' 69 | 70 | CommandLineSwitches: 71 | SwitchData 0, 0, NoSwitch 72 | HelpSwitchData 73 | SwitchData 0, 0, 0 74 | 75 | CursorStyles: 76 | db "HIDE",0,1,0 77 | db "SMALL",0,2,0 78 | db "HALF",0,3,0 79 | db "FULL",0,4,0 80 | db 0, 0xff, 0xff 81 | 82 | CursorSet: 83 | db 0 -------------------------------------------------------------------------------- /SOURCE/VDELAY.ASM: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %idefine NoVideoOutput 7 | 8 | %include "COMMON.INC" 9 | 10 | CommandLineParser ; insert code for command line parsing 11 | 12 | mov ax, [DelayTime] 13 | call DelayFunc 14 | 15 | Terminate 0 16 | 17 | DelayFunc: 18 | mov dx, ax 19 | cmp dx, 0x0000 20 | je .NoDelay 21 | mov al, [DelayMode] 22 | cmp al, 0 23 | je .Delay8086 24 | cmp al, 2 25 | je .Delay286 26 | Is286 27 | cmp ax, 0x0001 28 | je .Delay286 29 | .Delay8086: 30 | DelayTicks dx 31 | jmp .NoDelay 32 | .Delay286: 33 | DelayTimer dx 34 | jc .Delay8086 35 | .NoDelay: 36 | ret 37 | 38 | SwitchD: 39 | mov al, 1 40 | mov [DelayMode], al 41 | ret 42 | 43 | SwitchS: 44 | mov al, 0 45 | mov [DelayMode], al 46 | ret 47 | 48 | SwitchI: 49 | mov al, 2 50 | mov [DelayMode], al 51 | ret 52 | 53 | NoSwitch: 54 | NumberParam 55 | call DelayFunc 56 | xor ax, ax 57 | mov [DelayTime], ax 58 | ret 59 | 60 | IdleCPUHandler 61 | HelpSwitchHandler 'vdelay' 62 | 63 | CommandLineSwitches: 64 | SwitchData 0, 0, NoSwitch 65 | SwitchData 'D', 0, SwitchD 66 | SwitchData 'S', 0, SwitchS 67 | SwitchData 'I', 0, SwitchI 68 | HelpSwitchData 69 | SwitchData 0, 0, 0 70 | 71 | 72 | DelayMode: 73 | DB 0 74 | 75 | DelayTime: 76 | DW 1000 77 | -------------------------------------------------------------------------------- /SOURCE/VDELETE.ASM: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %include "COMMON.INC" 7 | %include "V8-DEBUG.INC" 8 | 9 | FrameBounds 10 | 11 | CommandLineParser ; insert code for command line parsing 12 | 13 | WhereXY 14 | mov [Position], dx 15 | xor dl, dl 16 | GotoXY dx 17 | xor ax, ax 18 | 19 | Scrolling: 20 | mov cx, [WindMin] 21 | mov dx, [Position] 22 | add ch, dh 23 | mov dx, [WindMax] 24 | mov ax, 0x0601 25 | mov bh, [TextAttr] 26 | int 0x10 27 | mov cx, [Lines] 28 | cmp cx, 0x0001 29 | jna Done 30 | dec cx 31 | mov [Lines], cx 32 | jmp Scrolling 33 | 34 | Done: 35 | mov dx, [Position] 36 | GotoXY dx 37 | Terminate 0 38 | 39 | NoSwitch: 40 | ; LookupParam OptionsTable 41 | ; cmp ax, 0xffff 42 | ; je .NotOption 43 | ; jmp ax 44 | 45 | ;.NotOption: 46 | NumberParam 47 | ; do something with ax 48 | mov [Lines], ax 49 | ret 50 | 51 | .InvalidOption: 52 | WriteStr CommandLineErrorMsg 53 | Terminate 100 54 | 55 | ColorSwitchHandlers 56 | LocalSwitchHandlers 57 | HelpSwitchHandler 'vdelete' 58 | 59 | CommandLineSwitches: 60 | SwitchData 0, 0, NoSwitch 61 | ColorSwitchData 62 | LocalSwitchData 63 | HelpSwitchData 64 | SwitchData 0, 0, 0 65 | 66 | Position: 67 | dw 0 68 | Lines: 69 | dw 0 70 | -------------------------------------------------------------------------------- /SOURCE/VECHO.ASM: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %include "COMMON.INC" 7 | 8 | FrameBounds 9 | 10 | MainParsing: 11 | 12 | CommandLineParser ; insert code for command line parsing 13 | 14 | UseAdvancedStdIn 15 | 16 | mov al, [NoNewLine] 17 | cmp al, 0 18 | jne Done 19 | mov cx, [Repeat] 20 | ReturnLoop: 21 | push cx 22 | WriteStr CRLFString 23 | pop cx 24 | loop ReturnLoop 25 | Done: 26 | Terminate 0 27 | 28 | NoSwitch: 29 | xor al, al 30 | mov [si], al 31 | mov cx, [Repeat] 32 | .SwitchLoop: 33 | push cx 34 | push di 35 | mov al, [Squeeze] 36 | cmp al, 1 37 | jne .NoSpace 38 | mov al, [SqueezeFlag] 39 | cmp al, 1 40 | jne .NoSpace 41 | push di 42 | mov al, 0x20 43 | WriteChar 0x09 44 | pop di 45 | .NoSpace: 46 | WriteStr di 47 | mov al, 1 48 | mov [SqueezeFlag], al 49 | pop di 50 | pop cx 51 | loop .SwitchLoop 52 | inc cx 53 | mov [Repeat], cx 54 | ret 55 | 56 | SwitchN: 57 | mov al, 1 58 | mov [NoNewLine], al 59 | ret 60 | 61 | SwitchS: 62 | mov al, [di] 63 | mov ah, 0 64 | cmp al, '-' 65 | je .SetSqueeze 66 | mov ah, 1 67 | cmp al, '+' 68 | jne .Error 69 | .SetSqueeze: 70 | mov [Squeeze], ah 71 | ret 72 | .Error: 73 | WriteStr CommandLineErrorMsg 74 | Terminate 100 75 | 76 | 77 | SwitchC: 78 | NumberParam 79 | mov cx, [Repeat] 80 | .SwitchLoop: 81 | push cx 82 | WriteChar 83 | pop cx 84 | loop .SwitchLoop 85 | inc cx 86 | mov [Repeat], cx 87 | ret 88 | 89 | SwitchI: 90 | WriteStdIn 91 | ret 92 | 93 | SwitchR: 94 | NumberParam 95 | mov [Repeat], ax 96 | ret 97 | 98 | SwitchE: 99 | mov ax, 0x20 100 | jmp FillLine 101 | 102 | SwitchX: 103 | NumberParam 104 | 105 | FillLine: 106 | push ax 107 | WhereXY 108 | pop ax 109 | mov cl, [WindMaxX] 110 | sub cl, [WindMinX] 111 | inc cl 112 | sub cl, dl 113 | xor ch, ch 114 | cmp cx, 0 115 | je .Done 116 | .Fill: 117 | mov ah, 0x09 118 | mov bh, [VideoPage] 119 | mov bl, [TextAttr] 120 | int 0x10 121 | .Done: 122 | ret 123 | 124 | ColorSwitchHandlers 125 | 126 | LocalSwitchHandlers 127 | 128 | %include "TRANSLAT.INC" 129 | 130 | SwitchT: 131 | Translator MainParsing 132 | 133 | SwitchP: 134 | WriteStr CRLFString 135 | mov al, 0 136 | mov [SqueezeFlag], al 137 | ret 138 | 139 | HelpSwitchHandler 'vecho' 140 | 141 | CommandLineSwitches: 142 | SwitchData 0, 0, NoSwitch 143 | ColorSwitchData 144 | SwitchData 'N', 0, SwitchN 145 | SwitchData 'C', 1, SwitchC 146 | SwitchData 'R', 1, SwitchR 147 | SwitchData 'I', 0, SwitchI 148 | SwitchData 'E', 0, SwitchE 149 | SwitchData 'X', 1, SwitchX 150 | SwitchData 'T', 1, SwitchT 151 | SwitchData 'P', 0, SwitchP 152 | SwitchData 'S', 1, SwitchS 153 | LocalSwitchData 154 | HelpSwitchData 155 | SwitchData 0, 0, 0 156 | 157 | Repeat: 158 | dw 1 159 | NoNewLine: 160 | db 0 161 | Squeeze: 162 | db 1 163 | SqueezeFlag: 164 | db 0 165 | 166 | -------------------------------------------------------------------------------- /SOURCE/VERRLVL.ASM: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %idefine NoVideoOutput 7 | 8 | %include "COMMON.INC" 9 | 10 | CommandLineParser ; insert code for command line parsing 11 | 12 | mov al, [ExitCode] 13 | Terminate al 14 | 15 | NoSwitch: 16 | NumberParam 17 | mov [ExitCode], al 18 | ret 19 | 20 | HelpSwitchHandler 'verrlvl' 21 | 22 | CommandLineSwitches: 23 | SwitchData 0, 0, NoSwitch 24 | HelpSwitchData 25 | SwitchData 0, 0, 0 26 | 27 | ExitCode: 28 | db 0 29 | -------------------------------------------------------------------------------- /SOURCE/VFONT.ASM: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2019-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %include "COMMON.INC" 7 | 8 | %define ALPHA_CODE 9 | 10 | CommandLineParser ; insert code for command line parsing 11 | 12 | Terminate 0 13 | 14 | GetCharHeight: 15 | push es 16 | mov ax, 0x0040 17 | mov es, ax 18 | mov ah, [es:0x0085] ; EGA Character Height (word but anything above 19 | ; about 30 is never supported by hardware) 20 | pop es 21 | ret 22 | 23 | SwitchD: 24 | call GetCharHeight 25 | mov al, ah 26 | cmp al, 8 27 | je .KnownValue 28 | cmp al, 14 29 | je .KnownValue 30 | mov al, 16 31 | .KnownValue: 32 | mov [DataHeight], al 33 | xor ax, ax 34 | mov [FileSize], ax 35 | jmp SetFont 36 | 37 | NoSwitch: 38 | call GetCharHeight 39 | mov al, [DataHeight] 40 | cmp al, 0x00 ; Font Height Not set 41 | je LoadFontFile 42 | cmp al, ah ; Font Height Match 43 | je LoadFontFile 44 | xor al, al ; Reset For Next 45 | mov [DataHeight], al 46 | ret 47 | 48 | LoadFontFile: 49 | mov dl, [si] 50 | xor al, al 51 | mov [si], al 52 | push dx 53 | mov dx, di 54 | mov ax, 0x3d00 55 | int 0x21 56 | jc .FileCleanup 57 | mov [FileHandle], ax 58 | .FileCleanup: 59 | pop dx 60 | mov [si], dl 61 | jc FileError 62 | mov ax, 0x3f00 63 | mov bx, [FileHandle] 64 | mov cx, 0x6000 65 | mov dx, DataTemp 66 | int 0x21 67 | jc FileError 68 | mov [FileSize], ax 69 | FileClose FileHandle 70 | jc FileError 71 | CompareMemory DataTemp, V8FontID, 7 72 | je V8Font 73 | ; Validate size is divisible by 256 (characters) 74 | xor dx, dx 75 | mov ax, [FileSize] 76 | mov cx, 0x0100 77 | div cx 78 | cmp dx, 0x0000 79 | jne FontError 80 | cmp ax, 30 81 | ja FontError 82 | cmp ax, 1 83 | jb FontError 84 | mov [DataHeight], al 85 | 86 | SetFont: 87 | mov al, [DataSave] 88 | cmp al, 0x00 89 | je .NoSaveScreen 90 | 91 | ; Save Screen 92 | mov al, [DataEffects] 93 | cmp al, 0x00 94 | je .NoRestoreScreen 95 | ; Special Effects 96 | .NoSaveScreen: 97 | 98 | mov al, [DataInit] 99 | cmp al, 0x00 100 | je .NoInit 101 | 102 | ; Initialize Video 103 | .NoInit: 104 | 105 | ; Set Font 106 | mov bl, 0 107 | 108 | mov ax, [FileSize] 109 | cmp ax, 0 110 | je .SetROMFont 111 | ; Set Custom Font 112 | mov al, 0 113 | mov bh, [DataHeight] 114 | mov cx, 0x0100 115 | mov dx, 0x0000 116 | jmp .ApplyFont 117 | .SetROMFont: 118 | mov ah, [DataHeight] 119 | mov al, 0x02 120 | cmp ah, 8 121 | je .ApplyFont 122 | mov al, 0x01 123 | cmp ah, 14 124 | je .ApplyFont 125 | mov al, 0x04 126 | .ApplyFont: 127 | mov ah, 0x11 128 | push bp 129 | mov bp, DataTemp 130 | int 0x10 131 | pop bp 132 | mov al, [DataReset] 133 | cmp al, 0x00 134 | je .NoScreenReset 135 | ; Reset Stuff 136 | jmp .Done 137 | .NoScreenReset: 138 | mov al, [DataSave] 139 | cmp al, 0x00 140 | je .NoRestoreScreen 141 | ; Restore Screen 142 | mov al, [DataEffects] 143 | cmp al, 0x00 144 | je .NoRestoreScreen 145 | ; Special Effects 146 | .NoRestoreScreen: 147 | 148 | .Done: 149 | Terminate 0 150 | 151 | V8Font: 152 | mov si, DataTemp 153 | cld 154 | .SkipToData: 155 | lodsb 156 | cmp si, 0 157 | je FontError 158 | cmp al, 26 159 | jne .SkipToData 160 | .ReadBlock: 161 | lodsb 162 | ; mov ah, 0 163 | ; DebugInt 164 | ; DebugCRLF 165 | mov cx, [si] 166 | cmp al, 0 167 | je .DoneReading 168 | cmp al, 1 169 | je .ReadChars 170 | add si, cx 171 | jo FontError 172 | jmp .ReadBlock 173 | .ReadChars: 174 | mov ax, [si + 6] 175 | cmp ax, 8 ; Check 8 bit width 176 | jne FontError 177 | 178 | mov ax, [si + 8] 179 | mov bx, [DataVHeight] 180 | cmp bx, 0 181 | jne .CheckChars 182 | mov bx, ax 183 | mov [DataVHeight], bx 184 | ; Clone BIOS font 185 | push ax 186 | push bx 187 | push cx 188 | mov di, [FileSize] 189 | add di, DataTemp 190 | mov cx, 0x07F 191 | mov bh, 0x03 192 | cmp al, 8 193 | je .Clone8 194 | mov cx, 0x0100 195 | mov bh, 0x02 196 | cmp al, 14 197 | je .Clone14 198 | mov bh, 0x06 199 | cmp al, 16 200 | je .Clone16 201 | 202 | ; Unknown So Clear it 203 | mul cx 204 | mov cx, ax 205 | xor al, al 206 | .ClearFontLoop: 207 | stosb 208 | loop .ClearFontLoop 209 | jmp .DoneCloneBIOS 210 | 211 | .CloneCopy: 212 | push es 213 | push bp 214 | push ax 215 | push cx 216 | 217 | mul cx 218 | mov cx, ax 219 | push cx 220 | mov ax, 0x1130 221 | int 0x10 222 | pop cx 223 | .CloneCopying: 224 | mov al, [es:bp] 225 | mov [ds:di], al 226 | inc bp 227 | inc di 228 | 229 | loop .CloneCopying 230 | 231 | pop cx 232 | pop ax 233 | pop bp 234 | pop es 235 | ret 236 | 237 | .Clone8: 238 | call .CloneCopy 239 | mov bh, 0x04 240 | call .CloneCopy 241 | jmp .DoneCloneBIOS 242 | 243 | .Clone14: 244 | .Clone16: 245 | call .CloneCopy 246 | jmp .DoneCloneBIOS 247 | 248 | .DoneCloneBIOS: 249 | pop cx 250 | pop bx 251 | pop ax 252 | 253 | .CheckChars: 254 | cmp ax, bx ; Check Height 255 | jne FontError 256 | jne .IgnoreChars 257 | .CloneChars: 258 | push cx 259 | push si 260 | mov ax, [si + 4] ; count 261 | mul bx 262 | mov cx, ax 263 | mov ax, [si + 2] ; first 264 | mul bx 265 | mov di, ax 266 | mov dx, [FileSize] 267 | add di, dx 268 | add di, DataTemp 269 | add si, 10 270 | .Cloning: 271 | lodsb 272 | stosb 273 | loop .Cloning 274 | pop si 275 | pop cx 276 | .IgnoreChars: 277 | add si, cx 278 | jmp .ReadBlock 279 | .DoneReading: 280 | mov bx, [DataVHeight] 281 | mov [DataHeight], bl 282 | cmp bx, 0 283 | je FontError 284 | mov ax, 0x0100 285 | mul bx 286 | mov cx, ax 287 | mov di, DataTemp 288 | mov si, [FileSize] 289 | add si, di 290 | mov [FileSize], cx 291 | .Relocate: 292 | lodsb 293 | stosb 294 | loop .Relocate 295 | ; Terminate 0 296 | jmp SetFont 297 | 298 | SwitchF: 299 | LookupParam FontOptionTable 300 | cmp ax, 0xffff 301 | je NotOption 302 | jmp SetFontTarget 303 | NotOption: 304 | NumberParam 305 | cmp ax, 30 306 | ja ValueOutOfRange 307 | SetFontTarget: 308 | mov [DataHeight], al 309 | ret 310 | 311 | %ifndef ALPHA_CODE 312 | SwitchA: 313 | mov al, 0x01 314 | mov [DataAlternate], al 315 | ret 316 | 317 | SwitchS: 318 | mov al, 0x01 319 | mov [DataSave], al 320 | mov al, 0x00 321 | mov [DataReset], al 322 | ret 323 | 324 | SwitchR: 325 | mov al, 0x01 326 | mov [DataReset], al 327 | mov [DataInit], al 328 | mov al, 0x00 329 | mov [DataSave], al 330 | ret 331 | 332 | SwitchX: 333 | mov al, 0x01 334 | mov [DataEffects], al 335 | ret 336 | 337 | SwitchI: 338 | mov al, 0x01 339 | mov [DataInit], al 340 | ret 341 | 342 | SwitchP: 343 | mov al, 0x01 344 | mov [DataPermanent], al 345 | ret 346 | %endif 347 | 348 | FontErrorMsg: 349 | db "Invalid font file format",0 350 | FileErrorMsg: 351 | db 'File Error #',0 352 | FileError: 353 | push ax 354 | push ax 355 | StdOutStr FileErrorMsg 356 | pop ax 357 | StdOutIntWord 358 | StdOutCRLF 359 | FileClose FileHandle 360 | pop ax 361 | Terminate al 362 | 363 | FontError: 364 | WriteStr FontErrorMsg 365 | Terminate 100 366 | ValueOutOfRange: 367 | InvalidOption: 368 | WriteStr CommandLineErrorMsg 369 | Terminate 100 370 | 371 | HelpSwitchHandler 'vfont' 372 | 373 | CommandLineSwitches: 374 | SwitchData 0, 0, NoSwitch 375 | %ifndef ALPHA_CODE 376 | SwitchData 'P', 0, SwitchP ; Permanent 377 | SwitchData 'A', 0, SwitchA ; Force Alternate 378 | SwitchData 'S', 0, SwitchS ; Store Contents 379 | SwitchData 'R', 0, SwitchR ; Reset settings 380 | SwitchData 'X', 0, SwitchX ; Special Effects 381 | SwitchData 'I', 0, SwitchI ; Initialize Display 382 | SwitchData 'E', 1, SwitchE ; Export as V8FONT 383 | %endif 384 | SwitchData 'F', 1, SwitchF ; Font Height 385 | SwitchData 'D', 0, SwitchD ; Font Default 386 | HelpSwitchData 387 | SwitchData 0, 0, 0 388 | 389 | FontOptionTable: 390 | TableData "EGA",14 391 | TableData "VGA",16 392 | TableEnd 393 | V8FontID: 394 | db 'V8FONT',0x0d,0x0a,0 395 | FileHandle: 396 | dw 0 397 | FileSize: 398 | dw 0 399 | VideoSize: 400 | dw 0 401 | DataHeight: 402 | db 0 403 | DataVHeight: 404 | dw 0 405 | DataAlternate: 406 | db 0 407 | DataSave: 408 | db 0 409 | DataReset: 410 | db 0 411 | DataEffects: 412 | db 0 413 | DataInit: 414 | db 0 415 | DataPermanent: 416 | db 0 417 | 418 | DataTemp: 419 | 420 | -------------------------------------------------------------------------------- /SOURCE/VGOTOXY.ASM: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %include "COMMON.INC" 7 | 8 | ProgramMain: 9 | WhereXY 10 | mov [CurrentXY], dx 11 | CommandLineParser ; insert code for command line parsing 12 | GotoXY [CurrentXY] 13 | Terminate 0 14 | 15 | NoSwitch: 16 | LookupParam OptionalTable 17 | jmp DoWhatNow 18 | 19 | SwitchQ: 20 | LookupParam QueryTable 21 | 22 | DoWhatNow: 23 | cmp ax, 0xffff 24 | je .NotFound 25 | jmp ax 26 | .NotFound: 27 | WriteStr CommandLineErrorMsg 28 | Terminate 100 29 | ret 30 | 31 | XYSwitchHandlers 32 | 33 | ; LocalSwitchHandlers Don't use CurrentXY 34 | SwitchK: 35 | NumberParam 36 | mov ah, 1 37 | mov [BoundsChar], al 38 | mov [UseBoundsChar], ah 39 | 40 | SwitchL: 41 | mov ax, [WindMin] 42 | mov dx, [CurrentXY] 43 | add dh, ah 44 | add dl, al 45 | mov [CurrentXY], dx 46 | mov ah, 0x02 47 | mov bh, [VideoPage] 48 | int 0x10 49 | FrameBounds 50 | mov ax, [WindMin] 51 | mov dx, [CurrentXY] 52 | sub dh, ah 53 | sub dl, al 54 | mov [CurrentXY], dx 55 | ret 56 | 57 | SwitchG: 58 | mov ax, [WindMin] 59 | mov dx, [CurrentXY] 60 | add dh, ah 61 | add dl, al 62 | mov [CurrentXY], dx 63 | mov ah, 0x02 64 | mov bh, [VideoPage] 65 | int 0x10 66 | mov ax, 0x0000 67 | mov [WindMin], ax 68 | mov ax, [ScreenMax] 69 | mov [WindMax], ax 70 | mov ax, [WindMin] 71 | mov dx, [CurrentXY] 72 | sub dh, ah 73 | sub dl, al 74 | mov [CurrentXY], dx 75 | ret 76 | 77 | WhereXProc: 78 | mov al, [CurrentXY] 79 | jmp WhereOutProc 80 | WhereYProc: 81 | mov al, [CurrentXY+1] 82 | WhereOutProc: 83 | inc al 84 | StdOutHexByte 85 | StdOutCRLF 86 | ret 87 | 88 | OptionSor: 89 | mov al, 0 90 | mov [CurrentX], al 91 | ret 92 | 93 | OptionEor: 94 | mov al, [WindMaxX] 95 | mov ah, [WindMinX] 96 | sub al, ah 97 | mov [CurrentX], al 98 | ret 99 | 100 | OptionSop: 101 | xor ax, ax 102 | mov [CurrentXY], ax 103 | ret 104 | 105 | OptionEop: 106 | mov ax, [WindMax] 107 | mov bx, [WindMin] 108 | sub ah, bh 109 | sub al, bl 110 | mov [CurrentXY], ax 111 | ret 112 | 113 | OptionUp: 114 | mov al, [CurrentY] 115 | cmp al, 0 116 | je OptionNoMove 117 | dec al 118 | mov [CurrentY], al 119 | ret 120 | 121 | OptionDown: 122 | mov ah, [WindMaxY] 123 | mov al, [WindMinY] 124 | sub ah, al 125 | mov al, [CurrentY] 126 | cmp al, ah 127 | jge OptionNoMove 128 | inc al 129 | mov [CurrentY], al 130 | ret 131 | 132 | OptionLeft: 133 | mov al, [CurrentX] 134 | cmp al, 0 135 | je OptionNoMove 136 | dec al 137 | mov [CurrentX], al 138 | ret 139 | 140 | OptionRight: 141 | mov ah, [WindMaxX] 142 | mov al, [WindMinX] 143 | sub ah, al 144 | mov al, [CurrentX] 145 | cmp al, ah 146 | jge OptionNoMove 147 | inc al 148 | mov [CurrentX], al 149 | ret 150 | ret 151 | 152 | OptionNoMove: 153 | ret 154 | 155 | OptionSot: 156 | mov bx, [WindMin] 157 | mov cx, [WindMax] 158 | sub ch, bh 159 | sub cl, bl 160 | xor dx, dx 161 | SearchStart: 162 | mov [CurrentXY], dx 163 | .TestLoop: 164 | push bx 165 | push cx 166 | push dx 167 | add dh, bh 168 | add dl, bl 169 | mov ah, 0x02 170 | mov bh, [VideoPage] 171 | int 0x10 172 | mov ah, 0x08 173 | int 0x10 174 | pop dx 175 | pop cx 176 | pop bx 177 | cmp al, 0x20 178 | jne .TestDone 179 | call OptionNext 180 | cmp dx, cx 181 | je .TestDone 182 | jmp .TestLoop 183 | .TestDone: 184 | ret 185 | 186 | OptionEot: 187 | mov bx, [WindMin] 188 | mov cx, [WindMax] 189 | sub ch, bh 190 | sub cl, bl 191 | mov dx, cx 192 | xor cx, cx 193 | SearchEnd: 194 | mov [CurrentXY], dx 195 | .TestLoop: 196 | push bx 197 | push cx 198 | push dx 199 | add dh, bh 200 | add dl, bl 201 | mov ah, 0x02 202 | mov bh, [VideoPage] 203 | int 0x10 204 | mov ah, 0x08 205 | int 0x10 206 | pop dx 207 | pop cx 208 | pop bx 209 | cmp al, 0x20 210 | jne .TestDone 211 | call OptionPrev 212 | cmp dx, cx 213 | je .TestDone 214 | jmp .TestLoop 215 | .TestDone: 216 | ret 217 | 218 | OptionSol: 219 | mov bx, [WindMin] 220 | mov cx, [WindMax] 221 | mov dx, [CurrentXY] 222 | xor dl, dl 223 | sub ch, bh 224 | jmp SearchStart 225 | 226 | OptionEol: 227 | mov bx, [WindMin] 228 | mov cx, [WindMax] 229 | mov dx, [CurrentXY] 230 | mov dl, cl 231 | sub dl, bl 232 | mov cx, dx 233 | xor cl, cl 234 | jmp SearchEnd 235 | 236 | OptionNext: 237 | push bx 238 | push cx 239 | mov bx, [WindMin] 240 | mov cx, [WindMax] 241 | mov dx, [CurrentXY] 242 | add dh, bh 243 | add dl, bl 244 | cmp dl, cl 245 | jl .MoreX 246 | cmp dh, ch 247 | jl .MoreY 248 | jmp .Done 249 | .MoreY: 250 | mov dl, bl 251 | inc dh 252 | jmp .Done 253 | .MoreX: 254 | inc dl 255 | .Done: 256 | sub dh, bh 257 | sub dl, bl 258 | mov [CurrentXY], dx 259 | pop cx 260 | pop bx 261 | ret 262 | 263 | OptionPrev: 264 | push bx 265 | push cx 266 | mov bx, [WindMin] 267 | mov cx, [WindMax] 268 | mov dx, [CurrentXY] 269 | add dh, bh 270 | add dl, bl 271 | cmp dl, bl 272 | jg .LessX 273 | cmp dh, bh 274 | jg .LessY 275 | jmp .Done 276 | .LessY: 277 | mov dl, cl 278 | dec dh 279 | jmp .Done 280 | .LessX: 281 | dec dl 282 | .Done: 283 | sub dh, bh 284 | sub dl, bl 285 | mov [CurrentXY], dx 286 | pop cx 287 | pop bx 288 | ret 289 | ret 290 | 291 | HelpSwitchHandler 'vgotoxy' 292 | 293 | CommandLineSwitches: 294 | SwitchData 0, 0, NoSwitch 295 | SwitchData 'Q', 1, SwitchQ 296 | XYSwitchData 297 | LocalSwitchData 298 | HelpSwitchData 299 | SwitchData 0, 0, 0 300 | 301 | QueryTable: 302 | TableData "X", WhereXProc 303 | TableData "WHEREX", WhereXProc 304 | TableData "Y", WhereYProc 305 | TableData "WHEREY", WhereYProc 306 | TableEnd 307 | 308 | OptionalTable: 309 | TableData "SOL",OptionSol 310 | TableData "EOL",OptionEol 311 | TableData "SOR",OptionSor 312 | TableData "EOR",OptionEor 313 | TableData "SOP",OptionSop 314 | TableData "EOP",OptionEop 315 | TableData "SOT",OptionSot 316 | TableData "EOT",OptionEot 317 | TableData "UP",OptionUp 318 | TableData "DOWN",OptionDown 319 | TableData "LEFT",OptionLeft 320 | TableData "RIGHT",OptionRight 321 | TableData "NEXT",OptionNext 322 | TableData "PREVIOUS",OptionPrev 323 | TableEnd 324 | -------------------------------------------------------------------------------- /SOURCE/VINSERT.ASM: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %include "COMMON.INC" 7 | 8 | FrameBounds 9 | 10 | CommandLineParser ; insert code for command line parsing 11 | 12 | WhereXY 13 | mov [Position], dx 14 | xor dl, dl 15 | GotoXY dx 16 | xor ax, ax 17 | 18 | Scrolling: 19 | mov cx, [WindMin] 20 | mov dx, [Position] 21 | add ch, dh 22 | mov dx, [WindMax] 23 | mov ax, 0x0701 24 | mov bh, [TextAttr] 25 | int 0x10 26 | mov cx, [Lines] 27 | cmp cx, 0x0001 28 | jna Done 29 | dec cx 30 | mov [Lines], cx 31 | jmp Scrolling 32 | 33 | Done: 34 | mov dx, [Position] 35 | GotoXY dx 36 | Terminate 0 37 | 38 | NoSwitch: 39 | ; LookupParam OptionsTable 40 | ; cmp ax, 0xffff 41 | ; je .NotOption 42 | ; jmp ax 43 | 44 | ;.NotOption: 45 | NumberParam 46 | ; do something with ax 47 | mov [Lines], ax 48 | ret 49 | 50 | .InvalidOption: 51 | WriteStr CommandLineErrorMsg 52 | Terminate 100 53 | 54 | ColorSwitchHandlers 55 | LocalSwitchHandlers 56 | HelpSwitchHandler 'vinsert' 57 | 58 | CommandLineSwitches: 59 | SwitchData 0, 0, NoSwitch 60 | ColorSwitchData 61 | LocalSwitchData 62 | HelpSwitchData 63 | SwitchData 0, 0, 0 64 | 65 | Position: 66 | dw 0 67 | Lines: 68 | dw 0 69 | -------------------------------------------------------------------------------- /SOURCE/VLINE.ASM: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %include "COMMON.INC" 7 | 8 | call PrepareSettings 9 | 10 | CommandLineParser ; insert code for command line parsing 11 | 12 | mov al, [LineStyle] 13 | cmp al, 0 14 | jne .NotHidden 15 | mov al, [TextAttr] 16 | and al, 0xf0 17 | mov ah, al 18 | mov cl, 4 19 | shr al, cl 20 | or al, ah 21 | mov [TextAttr], al 22 | 23 | .NotHidden: 24 | xor ch, ch 25 | mov cl, [LineDir] 26 | cmp cl, 1 27 | je Vertical 28 | mov cl, [CurrentW] 29 | cmp cl, 0 30 | je Vertical 31 | 32 | Horizontal: 33 | mov cl, [CurrentW] 34 | push cx 35 | mov bh, [VideoPage] 36 | mov dx, [CurrentXY] 37 | mov ax, [WindMin] 38 | add dh, ah 39 | add dl, al 40 | mov ah, 0x02 41 | int 0x10 42 | mov bl, [TextAttr] 43 | mov ah, [BoxPad] 44 | test ah, ah 45 | jnz .PadChar 46 | mov ah, [LineStyle] 47 | cmp ah, 2 48 | je .DoubleLine 49 | mov al, 0xc4 50 | jmp .CharSet 51 | .PadChar: 52 | mov al, [BoxPadChar] 53 | jmp .CharSet 54 | .DoubleLine: 55 | mov al, 0xcd 56 | .CharSet: 57 | mov ah, 0x09 58 | int 0x10 59 | pop cx 60 | mov dx, [Position] 61 | xor dl, dl 62 | inc dh 63 | mov cx, [ScreenMax] 64 | cmp dh, ch 65 | jge Done 66 | mov [Position], dx 67 | jmp Done 68 | 69 | Vertical: 70 | mov cl, [CurrentH] 71 | cmp cl, 0 72 | je Done 73 | 74 | Done: 75 | mov dx, [Position] 76 | GotoXY dx 77 | Terminate 0 78 | 79 | NoSwitch: 80 | LookupParam OptionsTable 81 | cmp ax, 0xffff 82 | je .NotOption 83 | jmp ax 84 | 85 | .NotOption: 86 | NumberParam 87 | ; do something with ax 88 | 89 | .InvalidOption: 90 | WriteStr CommandLineErrorMsg 91 | Terminate 100 92 | 93 | PrepareSettings: 94 | FrameBounds 95 | 96 | SetMaxSize 97 | 98 | WhereXY 99 | mov [CurrentXY], dx 100 | mov [Position], dx 101 | xor dl, dl 102 | GotoXY dx 103 | xor ax, ax 104 | mov [CurrentH], al 105 | ret 106 | 107 | ColorSwitchHandlers 108 | XYSwitchHandlers 109 | SizeSwitchHandlers 110 | 111 | OptHidden: 112 | mov al, 0 113 | mov [LineStyle], al 114 | mov [LineSmart], al 115 | ret 116 | OptSingle: 117 | mov al, 1 118 | mov [LineStyle], al 119 | ret 120 | OptDouble: 121 | mov al, 2 122 | mov [LineStyle], al 123 | ret 124 | OptSmart: 125 | mov al, 1 126 | mov [LineSmart], al 127 | ret 128 | OptDumb: 129 | mov al, 0 130 | mov [LineSmart], al 131 | ret 132 | OptHorizontal: 133 | mov al, 0 134 | mov [LineDir], al 135 | ret 136 | OptVertical: 137 | mov al, 1 138 | mov [LineDir], al 139 | ret 140 | 141 | SwitchP: 142 | NumberParam 143 | mov [BoxPadChar], al 144 | mov al, 1 145 | mov [BoxPad], al 146 | xor al, al 147 | mov [LineStyle], al 148 | ret 149 | 150 | SwitchK: 151 | NumberParam 152 | mov ah, 1 153 | mov [BoundsChar], al 154 | mov [UseBoundsChar], ah 155 | FrameBounds 156 | WhereXY 157 | mov [CurrentXY], dx 158 | mov [Position], dx 159 | xor dl, dl 160 | GotoXY dx 161 | xor ax, ax 162 | mov [CurrentH], al 163 | ret 164 | jmp PrepareSettings 165 | 166 | HelpSwitchHandler 'vline' 167 | 168 | CommandLineSwitches: 169 | SwitchData 0, 0, NoSwitch 170 | SwitchData 'P', 1, SwitchP 171 | ColorSwitchData 172 | XYSwitchData 173 | SizeSwitchData 174 | BoundsSwitchData 175 | HelpSwitchData 176 | SwitchData 0, 0, 0 177 | 178 | OptionsTable: 179 | TableData "HIDE", OptHidden 180 | TableData "HIDDEN", OptHidden 181 | TableData "SINGLE", OptSingle 182 | TableData "DOUBLE", OptDouble 183 | TableData "SMART", OptSmart 184 | TableData "DUMB", OptDumb 185 | TableData "HORIZONTAL", OptHorizontal 186 | TableData "VERTIVAL", OptVertical 187 | TableData "HORZ", OptHorizontal 188 | TableData "VERT", OptVertical 189 | TableData "HOR", OptHorizontal 190 | TableData "VER", OptVertical 191 | TableEnd 192 | 193 | BoxPad: 194 | db 0 195 | BoxPadChar: 196 | db 0 197 | Position: 198 | dw 0 199 | LineStyle: 200 | db 1 201 | LineSmart: 202 | db 1 203 | LineDir: 204 | db 0 -------------------------------------------------------------------------------- /SOURCE/VMATH.ASM: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %idefine NoVideoOutput 7 | 8 | %idefine Bit64 9 | 10 | %include "COMMON.INC" 11 | 12 | %idefine SwitchChar '^' 13 | 14 | CommandLineParser ; insert code for command line parsing 15 | 16 | ; Include 64-bit integer math for 8086 17 | %ifdef Bit64 18 | %include "INT64.INC" 19 | %endif 20 | 21 | Main: 22 | ; ----------------------------------------------------------------------------- 23 | %ifndef Bit64 24 | mov al, [OutStyle] 25 | cmp al, 1 26 | je OutHex 27 | StdOutIntWord [OutResult] 28 | jmp Done 29 | OutHex: 30 | mov ax, [OutResult] 31 | StdOutHexWord 32 | Done: 33 | StdOutCRLF 34 | Terminate 0 35 | 36 | ClearLastOpt: 37 | mov ax, OptNone 38 | mov [LastOpt], ax 39 | ret 40 | 41 | OptNone: 42 | mov [OutResult], ax 43 | jmp ClearLastOpt 44 | 45 | OptPlus: 46 | mov cx, [OutResult] 47 | add cx, ax 48 | mov [OutResult], cx 49 | jmp ClearLastOpt 50 | 51 | OptMinus: 52 | mov cx, [OutResult] 53 | sub cx, ax 54 | mov [OutResult], cx 55 | jmp ClearLastOpt 56 | 57 | OptMultiply: 58 | xor dx, dx 59 | mov cx, [OutResult] 60 | mul cx 61 | mov [OutResult], ax 62 | jmp ClearLastOpt 63 | 64 | OptDivide: 65 | xor dx, dx 66 | mov cx, [OutResult] 67 | xchg ax, cx 68 | div cx 69 | mov [OutResult], ax 70 | jmp ClearLastOpt 71 | 72 | OptMod: 73 | xor dx, dx 74 | mov cx, [OutResult] 75 | xchg ax, cx 76 | div cx 77 | mov [OutResult], dx 78 | jmp ClearLastOpt 79 | 80 | OptShr: 81 | xor dx, dx 82 | mov cx, [OutResult] 83 | xchg ax, cx 84 | shr ax, cl 85 | mov [OutResult], ax 86 | jmp ClearLastOpt 87 | 88 | OptShl: 89 | xor dx, dx 90 | mov cx, [OutResult] 91 | xchg ax, cx 92 | shl ax, cl 93 | mov [OutResult], ax 94 | jmp ClearLastOpt 95 | 96 | OptAnd: 97 | xor dx, dx 98 | mov cx, [OutResult] 99 | and ax, cx 100 | mov [OutResult], ax 101 | jmp ClearLastOpt 102 | 103 | OptOr: 104 | xor dx, dx 105 | mov cx, [OutResult] 106 | or ax, cx 107 | mov [OutResult], ax 108 | jmp ClearLastOpt 109 | 110 | OptXor: 111 | xor dx, dx 112 | mov cx, [OutResult] 113 | xor ax, cx 114 | mov [OutResult], ax 115 | jmp ClearLastOpt 116 | 117 | RealSwitches: 118 | 119 | SwitchB: 120 | ret 121 | 122 | SwitchH: 123 | mov al, 1 124 | mov [OutStyle], al 125 | ret 126 | 127 | SwitchD: 128 | mov al, 0 129 | mov [OutStyle], al 130 | ret 131 | 132 | NoSwitch: 133 | LookupParam OptionsTable 134 | cmp ax, 0xffff 135 | je .NotOption 136 | cmp ax, RealSwitches 137 | jl .NotSwitch 138 | jmp ax 139 | .NotSwitch: 140 | mov [LastOpt], ax 141 | ret 142 | 143 | .NotOption: 144 | NumberParam 145 | jmp [LastOpt] 146 | 147 | OutResult: 148 | dw 0 149 | %else 150 | 151 | ; ----------------------------------------------------------------------------- 152 | mov al, [OutStyle] 153 | cmp al, 1 154 | je OutHex 155 | ja OutBin 156 | sInt64_StdOutInt OutResult 157 | jmp Done 158 | OutHex: 159 | StdOutChar '0' 160 | StdOutChar 'x' 161 | sInt64_StdOutHex OutResult 162 | jmp Done 163 | OutBin: 164 | sInt64_StdOutBin OutResult 165 | Done: 166 | StdOutCRLF 167 | Terminate 0 168 | 169 | ClearLastOpt: 170 | mov ax, OptNone 171 | mov [LastOpt], ax 172 | ret 173 | 174 | OptNone: 175 | test [NeedOpt], byte 1 176 | jnz NoOptError 177 | mov [NeedOpt], byte 1 178 | sInt64_MOV OutResult, TempVal 179 | jmp ClearLastOpt 180 | 181 | OptPlus: 182 | sInt64_ADD OutResult, TempVal 183 | jc OverFlowError 184 | jmp ClearLastOpt 185 | 186 | OptMinus: 187 | sInt64_SUB OutResult, TempVal 188 | jc OverFlowError 189 | jmp ClearLastOpt 190 | 191 | OptMultiply: 192 | sInt64_MUL OutResult, TempVal 193 | jc OverFlowError 194 | jmp ClearLastOpt 195 | 196 | OptDivide: 197 | sInt64_DIV OutResult, TempVal ; out Quotient, Remainder 198 | jc DivZeroError 199 | jmp ClearLastOpt 200 | 201 | OptMod: 202 | sInt64_DIV OutResult, TempVal 203 | sInt64_MOV OutResult, TempVal ; mov Remainder into result 204 | jc DivZeroError 205 | jmp ClearLastOpt 206 | 207 | OptShr: 208 | mov cx, [TempVal] 209 | sInt64_SHR OutResult, cx 210 | jmp ClearLastOpt 211 | 212 | OptShl: 213 | mov cx, [TempVal] 214 | sInt64_SHL OutResult, cx 215 | jmp ClearLastOpt 216 | 217 | OptAnd: 218 | sInt64_AND OutResult, TempVal 219 | jmp ClearLastOpt 220 | 221 | OptOr: 222 | sInt64_OR OutResult, TempVal 223 | jmp ClearLastOpt 224 | 225 | OptXor: 226 | sInt64_XOR OutResult, TempVal 227 | jmp ClearLastOpt 228 | 229 | RealSwitches: 230 | 231 | SwitchB: 232 | mov al, 2 233 | mov [OutStyle], al 234 | ret 235 | 236 | SwitchH: 237 | mov al, 1 238 | mov [OutStyle], al 239 | ret 240 | 241 | SwitchD: 242 | mov al, 0 243 | mov [OutStyle], al 244 | ret 245 | 246 | NoSwitch: 247 | LookupParam OptionsTable 248 | cmp ax, 0xffff 249 | je .NotOption 250 | cmp ax, RealSwitches 251 | jl .NotSwitch 252 | jmp ax 253 | .NotSwitch: 254 | mov [LastOpt], ax 255 | ret 256 | 257 | .NotOption: 258 | Ascii_uInt64 TempVal, di 259 | jc .InvalidOption 260 | jmp [LastOpt] 261 | 262 | .InvalidOption: 263 | mov si,CommandLineErrorMsg 264 | DieNow: 265 | WriteStr si 266 | WriteStr ErrorMessage 267 | Terminate 100 268 | 269 | OverFlowError: 270 | mov si,OverFlowErrorMessage 271 | jmp DieNow 272 | 273 | DivZeroError: 274 | mov si,DivZeroErrorMessage 275 | jmp DieNow 276 | 277 | NoOptError: 278 | mov si, NoOptErrorMessage 279 | jmp DieNow 280 | 281 | 282 | OverFlowErrorMessage: 283 | db 'overflow',0 284 | 285 | NoOptErrorMessage: 286 | db 'no operator',0 287 | 288 | DivZeroErrorMessage: 289 | db 'divide by zero',0 290 | 291 | ErrorMessage: 292 | db ' error',CRLF,0 293 | 294 | Int64_Procs 295 | 296 | OutResult: 297 | dq 0 298 | TempVal: 299 | dq 0 300 | %endif 301 | ; ----------------------------------------------------------------------------- 302 | LastOpt: 303 | dw OptNone 304 | 305 | NeedOpt: 306 | db 0 307 | 308 | OutStyle: 309 | db 0 310 | 311 | HelpSwitchHandler 'vmath' 312 | 313 | CommandLineSwitches: 314 | SwitchData 0, 0, NoSwitch 315 | SwitchData 0, 0, 0 316 | 317 | OptionsTable: 318 | 319 | TableData '/B', SwitchB 320 | TableData '/H', SwitchH 321 | TableData '/D', SwitchD 322 | TableData '/?', SwitchHelp 323 | TableData 'ADD', OptPlus 324 | TableData '+', OptPlus 325 | TableData 'SUB', OptMinus 326 | TableData '-', OptMinus 327 | TableData 'MUL', OptMultiply 328 | TableData '*', OptMultiply 329 | TableData 'DIV', OptDivide 330 | TableData '/', OptDivide 331 | TableData 'MOD', OptMod 332 | TableData '\', OptMod 333 | TableData 'SHR', OptShr 334 | TableData 'SHL', OptShl 335 | TableData 'AND', OptAnd 336 | TableData 'OR', OptOr 337 | TableData 'XOR', OptXor 338 | TableEnd 339 | -------------------------------------------------------------------------------- /SOURCE/VMODE.ASM: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %idefine NoVideoOutput 7 | %idefine SuperVGA 8 | 9 | %include "COMMON.INC" 10 | 11 | call ReadMode 12 | mov [ModeFirst], ax 13 | mov [FontFirst], bx 14 | 15 | CommandLineParser ; insert code for command line parsing 16 | 17 | GoodBye: 18 | mov ax, [FontCurrent] 19 | cmp ax, [FontFirst] 20 | jne .SetNewMode 21 | mov ax, [ModeCurrent] 22 | cmp ax, [ModeFirst] 23 | jne .SetNewMode 24 | cmp [HadOpts], byte 0 25 | jne .Finished 26 | mov si, BW40Msg 27 | test ax, ax 28 | jz .PrintMode 29 | mov si, CO40Msg 30 | cmp ax, 0x01 31 | je .PrintMode 32 | mov si, CO80Msg 33 | cmp ax, 0x03 34 | je .PrintMode 35 | mov si, BW80Msg 36 | jb .PrintMode 37 | mov si, MonoMsg 38 | cmp ax, 0x07 39 | je .PrintMode 40 | StdOutHexWord 41 | jmp .ROMFontSize 42 | .PrintMode: 43 | StdOutStr si 44 | 45 | .ROMFontSize: 46 | mov ax, [FontCurrent] 47 | cmp al, 0x08 48 | je .PrintFont 49 | cmp al, 0x0e 50 | je .PrintFont 51 | cmp al, 0x10 52 | je .PrintFont 53 | jmp .NoROMFont 54 | .PrintFont: 55 | push ax 56 | StdOutStr PlusFontMsg 57 | pop ax 58 | StdOutIntWord ax 59 | .NoROMFont: 60 | StdOutCRLF 61 | jmp .Done 62 | .SetNewMode: 63 | call WriteMode 64 | .Finished: 65 | xor al, al 66 | .Done: 67 | Terminate al 68 | 69 | InvalidMode: 70 | mov al, 100 71 | jmp GoodBye.Done 72 | 73 | ReadMode: 74 | %ifdef SuperVGA 75 | call ReadModeSVGA 76 | cmp ax, 0x100 77 | jge .Done 78 | %endif 79 | mov ah, 0x0f 80 | int 0x10 81 | xor ah, ah 82 | cmp al, 0x07 83 | jle .Normal 84 | mov ax, 0xffff 85 | jmp .Done 86 | .Normal: 87 | push es 88 | mov bx, 0x0040 89 | push bx 90 | pop es 91 | mov bh, [es:0x0085] 92 | pop es 93 | cmp bh, 0x08 94 | je .KnownFont 95 | cmp bh, 0x0e 96 | je .KnownFont 97 | cmp bh, 0x10 98 | je .KnownFont 99 | xor bh, bh 100 | .KnownFont: 101 | xchg bh, bl 102 | .Done: 103 | xor bh, bh 104 | mov [ModeCurrent], ax 105 | mov [FontCurrent], bx 106 | ret 107 | 108 | WriteMode: 109 | mov ax, [ModeCurrent] 110 | cmp ax, 0xffff 111 | je InvalidMode 112 | cmp ax, 0x0100 113 | jb .StandardMode 114 | %ifdef SuperVGA 115 | jmp WriteModeSVGA 116 | %else 117 | jmp InvalidMode 118 | %endif 119 | .StandardMode: 120 | mov ah, 0x00 121 | int 0x10 122 | ; ret 123 | 124 | WriteFont: 125 | mov ax, [FontCurrent] 126 | mov bl, 0x12 127 | cmp al, 0x08 128 | je .LoadROMFont 129 | mov bl, 0x11 130 | cmp al, 0x0e 131 | je .LoadROMFont 132 | mov bl, 0x14 133 | cmp al, 0x10 134 | jne .Done 135 | .LoadROMFont: 136 | mov al, bl 137 | mov ah, 0x11 138 | mov bl, 0 139 | int 0x10 140 | ; fix cursor 141 | mov ah, 0x03 142 | mov bh, 0 143 | int 0x10 144 | push cx 145 | mov cx, 0x2000 146 | mov ah, 0x01 147 | int 0x10 148 | pop cx 149 | int 0x10 150 | .Done: 151 | ret 152 | 153 | ReadModeSVGA: 154 | push di 155 | mov ax, 0x4f00 156 | mov di, SVGABuffer 157 | int 0x10 158 | cmp ax, 0x004f 159 | jne .NoVesa 160 | ; quick dirty VESA test 161 | mov dx, [SVGABuffer] 162 | cmp dx, 'VE' 163 | jne .NoVesa 164 | mov dx, [SVGABuffer + 2] 165 | cmp dx, 'SA' 166 | jne .NoVesa 167 | ; get mode 168 | mov ax, 0x4f03 169 | int 0x10 170 | cmp ax, 0x004f 171 | jne .NoVesa 172 | mov ax, bx 173 | jmp .Done 174 | .NoVesa: 175 | xor ax, ax 176 | .Done: 177 | pop di 178 | ret 179 | 180 | WriteModeSVGA: 181 | push di 182 | mov ax, 0x4f00 183 | mov di, SVGABuffer 184 | int 0x10 185 | cmp ax, 0x004f 186 | jne .NoVesa 187 | ; quick dirty VESA test 188 | mov dx, [SVGABuffer] 189 | cmp dx, 'VE' 190 | jne .NoVesa 191 | mov dx, [SVGABuffer + 2] 192 | cmp dx, 'SA' 193 | jne .NoVesa 194 | ; get mode 195 | mov ax, 0x4f02 196 | mov bx, [ModeCurrent] 197 | int 0x10 198 | cmp ax, 0x004f 199 | je .Done 200 | pop di 201 | StdOutStr FailVesaMsg 202 | Terminate 100 203 | .NoVesa: 204 | StdOutStr NoVesaMsg 205 | Terminate 101 206 | .Done: 207 | pop di 208 | ret 209 | 210 | LookupParamProc 211 | NumberParamProc 212 | 213 | OptVesa: 214 | push es 215 | push si 216 | push di 217 | mov [SVGABuffer], word 'VB' 218 | mov [SVGABuffer+2], word 'E2' 219 | mov ax, 0x4f00 220 | mov di, SVGABuffer 221 | int 0x10 222 | cmp ax, 0x004f 223 | jne .NoVesa 224 | ; quick dirty VESA test 225 | mov dx, [SVGABuffer] 226 | cmp dx, 'VE' 227 | jne .NoVesa 228 | mov dx, [SVGABuffer + 2] 229 | cmp dx, 'SA' 230 | jne .NoVesa 231 | les si, [SVGABuffer + 0x0e] 232 | .Looping: 233 | mov ax, [es:si] 234 | cmp ax, 0xffff 235 | je .Done 236 | call VesaModeInfo 237 | add si, 2 238 | jmp .Looping 239 | .NoVesa: 240 | pop di 241 | StdOutStr NoVesaMsg 242 | push di 243 | .Done: 244 | pop di 245 | pop si 246 | pop es 247 | jmp GoodBye.Finished 248 | 249 | VesaModeInfo: 250 | push es 251 | push cs 252 | pop es 253 | mov di, SVGAMode 254 | push ax 255 | push di 256 | mov cx, 0x0080 257 | xor ax, ax 258 | cld 259 | rep stosw 260 | pop di 261 | pop cx 262 | mov ax, 0x4f01 263 | int 0x10 264 | cmp ax, 0x004f 265 | jne .Done 266 | mov ax, cx 267 | mov cx, [SVGAMode+0x12] 268 | or cx, [SVGAMode+0x14] 269 | test cx, cx 270 | jz .Done 271 | StdOutHexWord 0x 272 | StdOutStr ModeSepMsg 273 | mov ax, [SVGAMode+0x12] 274 | StdOutIntWord ax 275 | StdOutChar 'x' 276 | mov ax, [SVGAMode+0x14] 277 | StdOutIntWord ax 278 | StdOutCRLF 279 | .Done: 280 | pop es 281 | 282 | OptIngore: 283 | ret 284 | 285 | OptBW40: 286 | mov ax, 0x0000 287 | jmp SetModeCurrent 288 | 289 | OptColor40: 290 | mov ax, 0x0001 291 | jmp SetModeCurrent 292 | 293 | OptBW80: 294 | mov ax, 0x0002 295 | jmp SetModeCurrent 296 | 297 | OptColor80: 298 | mov ax, 0x0003 299 | jmp SetModeCurrent 300 | 301 | OptMono80: 302 | mov ax, 0x0007 303 | 304 | SetModeCurrent: 305 | mov [ModeCurrent], ax 306 | ret 307 | 308 | OptFont8: 309 | mov al, 0x08 310 | jmp SetFontCurrent 311 | 312 | OptFont14: 313 | mov al, 0x0e 314 | jmp SetFontCurrent 315 | 316 | OptFont16: 317 | mov al, 0x10 318 | 319 | SetFontCurrent: 320 | xor ah, ah 321 | mov [FontCurrent], ax 322 | ret 323 | 324 | SwitchF: 325 | mov ax, 0xffff 326 | mov [ModeFirst], ax 327 | ret 328 | 329 | SwitchP: 330 | or [HadOpts], byte 1 331 | NumberParam 332 | jc NoSwitch.InvalidOption 333 | test ah, ah 334 | jnz NoSwitch.InvalidOption 335 | mov ah, 0x05 336 | int 0x10 337 | ret 338 | 339 | NoSwitch: 340 | or [HadOpts], byte 1 341 | LookupParam OptionsTable 342 | cmp ax, 0xffff 343 | je .NotOption 344 | mov bx, [ModeCurrent] 345 | jmp ax 346 | 347 | .NotOption: 348 | NumberParam 349 | jnc SetModeCurrent 350 | 351 | .InvalidOption: 352 | WriteStr CommandLineErrorMsg 353 | Terminate 100 354 | 355 | HelpSwitchHandler 'vmode' 356 | 357 | CommandLineSwitches: 358 | SwitchData 0, 0, NoSwitch 359 | SwitchData 'F', 0, SwitchF 360 | SwitchData 'P', 1, SwitchP 361 | HelpSwitchData 362 | SwitchData 0, 0, 0 363 | 364 | OptionsTable: 365 | TableData 'B40', OptBW40 366 | TableData 'B80', OptBW80 367 | TableData 'BW40', OptBW40 368 | TableData 'BW80', OptBW80 369 | TableData 'BW', OptBW80 370 | TableData 'C40', OptColor40 371 | TableData 'C80', OptColor80 372 | TableData 'CO40', OptColor40 373 | TableData 'CO80', OptColor80 374 | TableData 'COLOR', OptColor80 375 | TableData 'MONO', OptMono80 376 | TableData 'FONT8', OptFont8 377 | TableData 'FONT14', OptFont14 378 | TableData 'FONT16', OptFont16 379 | TableData 'F8', OptFont8 380 | TableData 'F14', OptFont14 381 | TableData 'F16', OptFont16 382 | TableData 'VESA', OptVesa 383 | TableData '+', OptIngore 384 | TableEnd 385 | 386 | PlusFontMsg: 387 | DB ' + Font',0 388 | BW40Msg: 389 | DB 'BW40',0 390 | BW80Msg: 391 | DB 'BW80',0 392 | CO40Msg: 393 | DB 'CO40',0 394 | CO80Msg: 395 | DB 'CO80',0 396 | MonoMsg: 397 | DB 'MONO',0 398 | 399 | %ifdef SuperVGA 400 | FailVesaMsg: 401 | DB 'Bad VESA mode.',CRLF,0 402 | NoVesaMsg: 403 | DB 'No VESA support.',CRLF,0 404 | ModeSepMsg: 405 | DB ' - ',0 406 | GraphicsModeMsg: 407 | DB ' Graphics',0 408 | TextModeMsg: 409 | DB ' Text',0 410 | %endif 411 | 412 | HadOpts: 413 | db 0 414 | 415 | ModeCurrent: 416 | dw 0 417 | ModeFirst: 418 | dw 0 419 | FontCurrent: 420 | dw 0 421 | FontFirst: 422 | dw 0 423 | 424 | %ifdef SuperVGA 425 | section .bss 426 | 427 | SVGABuffer: 428 | resb 0x100 429 | SVGAMode: 430 | resb 0x100 431 | 432 | %endif -------------------------------------------------------------------------------- /SOURCE/VPAUSE.ASM: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %include "COMMON.INC" 7 | 8 | DumpKeystrokes 9 | 10 | WhereXY 11 | mov [Position], dx 12 | 13 | CommandLineParser ; insert code for command line parsing 14 | 15 | KeyBoardLoop: 16 | mov cx, [TimeOut] 17 | push es 18 | mov bx, 0x0040 19 | mov es, bx 20 | mov bx, 0x006c 21 | mov dx, [es:bx] 22 | .WaitLoop: 23 | IdleCPU 24 | mov ax, [TimeOut] 25 | cmp ax, 0 26 | je .NoTimeOut 27 | cmp cx, 0 28 | je TimedOut 29 | mov ax, [es:bx] 30 | cmp ax, dx 31 | je .NoTimeOut 32 | dec cx 33 | mov dx, ax 34 | call ShowTimeOut 35 | .NoTimeOut: 36 | mov ax, 0x0100 37 | int 0x16 38 | jz .WaitLoop 39 | pop es 40 | 41 | mov ax, 0x0000 42 | int 0x16 43 | 44 | push ax 45 | mov ah, [ControlC] 46 | cmp ax, 0x0103 47 | pop ax 48 | je ControlCQuit 49 | mov al, [Postal] 50 | cmp al, 1 51 | je DoPostal 52 | mov dx, [Position] 53 | GotoXY dx 54 | Terminate 0 55 | 56 | TimedOut: 57 | mov al, [Postal] 58 | cmp al, 1 59 | je DoPostal 60 | mov dx, [Position] 61 | GotoXY dx 62 | Terminate 1 63 | 64 | DoPostal: 65 | GoPostal 66 | 67 | ControlCQuit: 68 | mov al, 200 69 | Terminate al 70 | 71 | ShowTimeOut: 72 | push cx 73 | push bx 74 | push dx 75 | 76 | xor dx, dx 77 | mov ax, 11 78 | xchg ax, cx 79 | mul cx 80 | mov cx, 200 81 | div cx 82 | 83 | push ax 84 | ; mov cx, 0 85 | ; cmp ax, 1000 86 | ; jge .SetWidth 87 | ; inc cx 88 | ; cmp ax, 100 89 | ; jge .SetWidth 90 | ; inc cx 91 | ; cmp ax, 10 92 | ; jge .SetWidth 93 | ; inc cx 94 | ; .SetWidth: 95 | mov bl, [TextAttr] 96 | mov bh, [VideoPage] 97 | mov dx, [Position] 98 | mov ah, 0x02 99 | int 0x10 100 | ; cmp cx, 0 101 | ; je .NoSpace 102 | ; mov ax, 0x0920 103 | ; int 0x10 104 | ; add dl, cl 105 | ; .NoSpace: 106 | mov ah, 0x02 107 | int 0x10 108 | 109 | pop ax 110 | WriteInt ax 111 | mov al, 0x20 112 | WriteChar 0x09 113 | NoDisplayTimeOut: 114 | pop dx 115 | pop bx 116 | pop cx 117 | ret 118 | 119 | NoSwitch: 120 | LookupParam OptionsTable 121 | cmp ax, 0xffff 122 | je .NotOption 123 | jmp ax 124 | 125 | .NotOption: 126 | NumberParam 127 | ; do something with ax 128 | 129 | .InvalidOption: 130 | WriteStr CommandLineErrorMsg 131 | Terminate 100 132 | 133 | OptCtrlC: 134 | mov al, 1 135 | mov [ControlC], al 136 | ret 137 | 138 | OptPostal: 139 | mov al, 1 140 | mov [Postal], al 141 | ret 142 | 143 | SwitchT: 144 | NumberParam 145 | cmp ax, 0 146 | je .SwitchOff 147 | cmp ax, 3600 148 | jle .SwitchOK 149 | mov ax, 3600 150 | .SwitchOK: 151 | inc ax 152 | mov cx, 200 153 | mul cx 154 | mov cx, 11 155 | div cx 156 | inc ax 157 | .SwitchOff: 158 | mov [TimeOut], ax 159 | ret 160 | 161 | IdleCPUHandler 162 | 163 | ColorSwitchHandlers 164 | 165 | HelpSwitchHandler 'vpause' 166 | 167 | CommandLineSwitches: 168 | SwitchData 0, 0, NoSwitch 169 | SwitchData 'D', 1, SwitchT 170 | SwitchData 'T', 1, SwitchT 171 | ColorSwitchData 172 | HelpSwitchData 173 | SwitchData 0, 0, 0 174 | 175 | OptionsTable: 176 | TableData 'CTRL-C', OptCtrlC 177 | TableData 'CTRL+C', OptCtrlC 178 | TableData 'POSTAL', OptPostal 179 | TableEnd 180 | 181 | TimeOut: 182 | dw 0 183 | Position: 184 | dw 0 185 | ControlC: 186 | db 0 187 | Postal: 188 | db 0 -------------------------------------------------------------------------------- /SOURCE/VPCSPKR.ASM: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %idefine NoVideoOutput 7 | 8 | %include "COMMON.INC" 9 | 10 | CommandLineParser 11 | Terminate 0 12 | 13 | NoSwitch: 14 | mov bx, di 15 | .FindColon: 16 | mov al, [bx] 17 | cmp al, ':' 18 | je SoundAndDelay 19 | cmp bx, si 20 | je DelayOnly 21 | inc bx 22 | jmp .FindColon 23 | 24 | SoundAndDelay: 25 | mov cx, bx 26 | sub cx, di 27 | push bx 28 | NumberParam 29 | pop bx 30 | mov cx, ax 31 | push cx 32 | inc bx 33 | mov di, bx 34 | mov cx, si 35 | sub cx, di 36 | NumberParam 37 | pop cx 38 | call Sound 39 | jmp DoDelay 40 | 41 | DelayOnly: 42 | NumberParam 43 | call SoundOff 44 | DoDelay: 45 | mov dx, ax 46 | cmp dx, 0x0000 47 | je .NoDelay 48 | mov al, [DelayMode] 49 | cmp al, 0 50 | je .Delay8086 51 | cmp al, 2 52 | je .Delay286 53 | Is286 54 | cmp ax, 0x0001 55 | je .Delay286 56 | .Delay8086: 57 | DelayTicks dx 58 | jmp .NoDelay 59 | .Delay286: 60 | DelayTimer dx 61 | .NoDelay: 62 | ret 63 | 64 | Sound: 65 | push ax 66 | cmp cx, 0x0012 67 | jle SoundOffInstead 68 | mov dx, 0x0012 69 | mov ax, 0x34DC 70 | div cx 71 | push ax 72 | mov al, 10110110b 73 | mov dx, 0x0043 74 | out dx, al 75 | mov dx, 0x0042 76 | pop ax 77 | out dx, al 78 | mov al, ah 79 | out dx, al 80 | mov dx, 0x0061 81 | in al, dx 82 | mov al, 0x03 83 | out dx, al 84 | pop ax 85 | ret 86 | 87 | SoundOffInstead: 88 | pop ax 89 | SoundOff: 90 | push ax 91 | mov dx, 0x0061 92 | in al, dx 93 | and al, 11111101b 94 | out dx, al 95 | mov al, 10110110b 96 | mov dx, 0x0043 97 | out dx, al 98 | mov dx, 0x0042 99 | mov al, 0 100 | out dx, al 101 | out dx, al 102 | pop ax 103 | ret 104 | 105 | SwitchD: 106 | mov al, 1 107 | mov [DelayMode], al 108 | ret 109 | 110 | SwitchS: 111 | mov al, 0 112 | mov [DelayMode], al 113 | ret 114 | 115 | SwitchI: 116 | mov al, 2 117 | mov [DelayMode], al 118 | ret 119 | 120 | IdleCPUHandler 121 | HelpSwitchHandler 'vpcspkr' 122 | 123 | CommandLineSwitches: 124 | SwitchData 0, 0, NoSwitch 125 | SwitchData 'D', 0, SwitchD 126 | SwitchData 'S', 0, SwitchS 127 | SwitchData 'I', 0, SwitchI 128 | HelpSwitchData 129 | SwitchData 0, 0, 0 130 | 131 | DelayMode: 132 | DB 0 133 | -------------------------------------------------------------------------------- /SOURCE/VPROGRES.ASM: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %include "COMMON.INC" 7 | 8 | FrameBounds 9 | 10 | CommandLineParser ; insert code for command line parsing 11 | 12 | WhereXY 13 | 14 | mov cx, [WindMax] 15 | mov bx, [WindMin] 16 | add bh, dh 17 | add bl, dl 18 | mov ch, bh 19 | mov [WindMax], cx 20 | mov [WindMin], bx 21 | 22 | mov al, [Width] 23 | cmp al, 0 24 | jg WidthKnown 25 | 26 | mov al, cl 27 | sub al, bl 28 | inc al 29 | 30 | WidthKnown: 31 | mov ah, [Position] 32 | cmp ah, 0 33 | je .NoNumberPad 34 | cmp ah, 2 35 | je .NoNumberPad 36 | cmp al, 10 37 | jge .WithNumbers 38 | mov ah, [Percent] 39 | cmp ah, 100 40 | jge .WithNumbers 41 | xor ah, ah 42 | mov [Position], ah 43 | jmp .NoNumberPad 44 | .WithNumbers: 45 | sub al, 5 46 | .NoNumberPad: 47 | mov [Width], al 48 | xor ah, ah 49 | mov al, [Position] 50 | cmp al, 1 51 | jne .NotLeftNumber 52 | call WriteNumber 53 | call WritePadding 54 | mov dx, 0x0005 55 | GotoXY dx 56 | .NotLeftNumber: 57 | xor dx, dx 58 | xor ah, ah 59 | mov al, [Percent] 60 | mov cl, [Width] 61 | xor ch, ch 62 | mul cx 63 | mov cx, 100 64 | div cx 65 | mov [Partial], dl 66 | mov cl, [Width] 67 | xor ch, ch 68 | cmp ax, cx 69 | jl .WriteBar 70 | mov ax, cx 71 | .WriteBar: 72 | mov [Used], al 73 | mov cx, ax 74 | mov ah, 0x09 75 | mov al, 0xb2 76 | mov bh, [VideoPage] 77 | mov bl, [TextAttr] 78 | int 0x10 79 | push cx 80 | xor ch, ch 81 | mov cl, [Percent] 82 | cmp cx, 100 83 | pop cx 84 | jge .NoPartial 85 | mov dl, [Partial] 86 | cmp dl, 25 87 | jl .NoPartial 88 | mov al, [Used] 89 | inc al 90 | mov [Used], al 91 | xor dx, dx 92 | mov dl, al 93 | dec dl 94 | mov al, [Position] 95 | cmp al, 1 96 | jne .NotLeft1 97 | add dx, 5 98 | .NotLeft1: 99 | GotoXY dx 100 | mov cx, 1 101 | mov ah, 0x09 102 | mov al, 0xb1 103 | mov bh, [VideoPage] 104 | mov bl, [TextAttr] 105 | int 0x10 106 | .NoPartial: 107 | mov al, [Used] 108 | xor dx, dx 109 | mov dl, al 110 | mov al, [Position] 111 | cmp al, 1 112 | jne .NotLeft2 113 | add dx, 5 114 | .NotLeft2: 115 | GotoXY dx 116 | mov cl, [Width] 117 | mov al, [Used] 118 | xor ch, ch 119 | sub cl, al 120 | mov ah, 0x09 121 | mov al, 0xb0 122 | mov bh, [VideoPage] 123 | mov bl, [TextAttr] 124 | and bl, 0x77 125 | int 0x10 126 | mov al, [Position] 127 | cmp al, 3 128 | jne .NotRight 129 | xor dx, dx 130 | mov dl, [Width] 131 | push dx 132 | GotoXY dx 133 | call WritePadding 134 | pop dx 135 | add dx, cx 136 | GotoXY dx 137 | xor ax, ax 138 | mov al, [Percent] 139 | call WriteNumber 140 | jmp Done 141 | .NotRight: 142 | cmp al, 2 143 | jne Done 144 | xor ah, ah 145 | mov al, [Width] 146 | shr al, 1 147 | dec al 148 | GotoXY ax 149 | xor ah, ah 150 | mov al, [Percent] 151 | WriteIntNoAttr ax 152 | mov al, '%' 153 | WriteChar 0x0a 154 | 155 | Done: 156 | xor dx, dx 157 | GotoXY dx 158 | Terminate 0 159 | 160 | WritePadding: 161 | mov cx, 0x0001 162 | xor ah, ah 163 | mov al, [Percent] 164 | cmp ax, 100 165 | jge .Writing 166 | inc cx 167 | cmp ax, 10 168 | jge .Writing 169 | inc cx 170 | .Writing: 171 | push cx 172 | mov ah, 0x09 173 | mov al, 0x20 174 | mov bh, [VideoPage] 175 | mov bl, [TextAttr] 176 | int 0x10 177 | pop cx 178 | ret 179 | 180 | WriteNumber: 181 | xor ah, ah 182 | mov al, [Percent] 183 | WriteInt ax 184 | mov ah, 0x09 185 | mov al, '%' 186 | mov bh, [VideoPage] 187 | mov bl, [TextAttr] 188 | mov cx, 0x0001 189 | int 0x10 190 | mov al, [Position] 191 | cmp al, 1 192 | jne .Done 193 | GotoNextXY 194 | .Done: 195 | ret 196 | 197 | SwitchOF: 198 | mov al, 1 199 | mov [NextOF], al 200 | ret 201 | 202 | NoSwitch: 203 | LookupParam OptionTable 204 | cmp ax, 0xffff 205 | je .NotOption 206 | cmp ax, SwitchOF 207 | je SwitchOF 208 | mov [Position], al 209 | ret 210 | 211 | .NotOption: 212 | NumberParam 213 | mov bl, [NextOF] 214 | xor bh, bh 215 | mov [NextOF], bh 216 | cmp bl, 1 217 | je .Calculate 218 | mov [Percent], ax 219 | ret 220 | 221 | .Calculate: 222 | 223 | push ax 224 | xor dx, dx 225 | mov cx, 100 226 | mov ax, [Percent] 227 | mul cx 228 | pop cx 229 | cmp cx, 0 230 | je .Zero 231 | div cx 232 | jmp .SetPercent 233 | .Zero: 234 | xor ax, ax 235 | .SetPercent: 236 | mov [Percent], ax 237 | ret 238 | 239 | SwitchW: 240 | NumberParam 241 | cmp ax, 5 242 | jl SwitchError 243 | cmp ax, 0x00ff 244 | jg SwitchError 245 | push ax 246 | WhereXY 247 | pop ax 248 | mov cl, [WindMaxX] 249 | mov ch, [WindMinX] 250 | sub cl, ch 251 | sub cl, dl 252 | inc cl 253 | xor ah, ah 254 | xor ch, ch 255 | cmp ax, cx 256 | jg SwitchError 257 | mov [Width], al 258 | ret 259 | 260 | ColorSwitchHandlers 261 | HelpSwitchHandler 'vprogres' 262 | 263 | BoundsSwitchHandler 264 | 265 | CommandLineSwitches: 266 | SwitchData 0, 0, NoSwitch 267 | ColorSwitchData 268 | SwitchData 'W', 1, SwitchW 269 | SwitchData 'K', 1, SwitchK 270 | HelpSwitchData 271 | SwitchData 0, 0, 0 272 | 273 | OptionTable: 274 | TableData "OF", SwitchOF 275 | TableData "OFF", 0 276 | TableData "LEFT", 1 277 | TableData "CENTER", 2 278 | TableData "RIGHT", 3 279 | TableEnd 280 | 281 | Width: 282 | db 0 283 | Position: 284 | db 2 285 | Percent: 286 | dw 0 287 | Partial: 288 | db 0 289 | Used: 290 | db 0 291 | NextOF: 292 | db 0 -------------------------------------------------------------------------------- /SOURCE/VREADKEY.ASM: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2024 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %idefine NoVideoOutput 7 | 8 | %include "COMMON.INC" 9 | 10 | %define opTimeOut 0x0100 11 | %define opSilent 0x0200 12 | %define opPurge 0x1000 13 | 14 | CommandLineParser ; insert code for command line parsing 15 | 16 | call .GetTicker 17 | 18 | test [OPTIONS], word opPurge 19 | jz .WaitLoop 20 | 21 | DumpKeystrokes 22 | 23 | .WaitLoop: 24 | mov ax, 0x0100 25 | int 0x16 26 | jnz .KeyPressed 27 | test [OPTIONS], word opTimeOut 28 | jz .WaitLoop 29 | cmp [WAIT_DELAY], word 0 30 | je .TimeOut 31 | IdleCPU 32 | call .GetTicker 33 | jnc .WaitLoop 34 | dec word [WAIT_DELAY] 35 | jmp .WaitLoop 36 | 37 | .GetTicker: 38 | push es 39 | mov ax, 0x0040 40 | mov es, ax 41 | mov ax, [es:0x006c] 42 | cmp [TICKER], ax 43 | je .NoTick 44 | mov [TICKER], ax 45 | stc 46 | jmp .Ticker_Done 47 | .NoTick: 48 | clc 49 | .Ticker_Done: 50 | pop es 51 | ret 52 | 53 | .KeyPressed: 54 | mov ax, 0x0000 55 | int 0x16 56 | jmp .SetKeyCode 57 | 58 | .TimeOut: 59 | mov ax, [DEFAULT_CODE] 60 | 61 | .SetKeyCode: 62 | test al, al 63 | jz .KeepHigh 64 | xor ah, ah 65 | .KeepHigh: 66 | mov [KEYCODE], ax 67 | 68 | .StandardCodes: 69 | test [OPTIONS], word opSilent 70 | jnz .Silent 71 | StdOutHexWord null 72 | StdOutCRLF 73 | 74 | .Silent: 75 | mov ax, [KEYCODE] 76 | test ah, ah 77 | jz .Goodbye 78 | mov al, ah 79 | or al, 0x80 80 | .Goodbye: 81 | Terminate al 82 | 83 | IdleCPUHandler 84 | 85 | HelpSwitchHandler 'vreadkey' 86 | 87 | CommandLineSwitches: 88 | SwitchData 0, 0, NoSwitch 89 | SwitchData 'N', 0, SwitchN ; no standard output 90 | SwitchData 'D', 1, SwitchD ; delay time in seconds (0-3600 seconds) 91 | SwitchData 'R', 1, SwitchR ; timeout return code 92 | SwitchData 'P', 0, SwitchP ; purge any pending keystrokes 93 | HelpSwitchData 94 | SwitchData 0, 0, 0 95 | 96 | SwitchP: 97 | or [OPTIONS], word opPurge 98 | ret 99 | 100 | SwitchN: 101 | or [OPTIONS], word opSilent 102 | ret 103 | 104 | SwitchR: 105 | NumberParam 106 | mov [DEFAULT_CODE], ax 107 | or [OPTIONS], word opTimeOut 108 | ret 109 | 110 | SwitchD: 111 | NumberParam 112 | cmp ax, 3600 113 | jbe .OK 114 | mov ax, 3600 115 | .OK: 116 | pushf 117 | push cx 118 | push dx 119 | mov dx, 182 120 | mov cx, 10 121 | mul dx 122 | div cx 123 | .SetValue: 124 | mov [WAIT_DELAY], ax 125 | or [OPTIONS], word opTimeOut 126 | pop dx 127 | pop cx 128 | popf 129 | ret 130 | 131 | NoSwitch: 132 | 133 | InvalidOption: 134 | WriteStr CommandLineErrorMsg 135 | Terminate 255 136 | 137 | section .data 138 | 139 | OPTIONS: dw 0 140 | KEYCODE: dw 0 141 | 142 | DEFAULT_CODE: dw 0 143 | WAIT_DELAY: dw 30 144 | TICKER: dw 0 145 | -------------------------------------------------------------------------------- /SOURCE/VVER.ASM: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 2016-2022 Jerome Shidel 2 | ; Open source see License file 3 | 4 | ; NASM for DOS 5 | 6 | %idefine NoVideoOutput ; A lie, but only using STDOUT 7 | 8 | %include "COMMON.INC" 9 | 10 | CommandLineParser 11 | mov al, [Shown] 12 | cmp al, 0 13 | jne Done 14 | call OptAll 15 | Done: 16 | Terminate 0 17 | 18 | OptAll: 19 | StdOutCRLF 20 | call OptName 21 | call OptCopy 22 | call OptVer 23 | call OptURL 24 | call OptEMail 25 | StdOutCRLF 26 | call OptLic 27 | ret 28 | 29 | OptName: 30 | StdOutStr OptNameMsg 31 | StdOutCRLF 32 | ret 33 | OptVer: 34 | StdOutStr OptVerMsg 35 | StdOutCRLF 36 | ret 37 | OptCopy: 38 | StdOutStr OptCopyMsg 39 | StdOutCRLF 40 | ret 41 | OptLic: 42 | StdOutStr OptLicMsg 43 | StdOutCRLF 44 | ret 45 | OptURL: 46 | StdOutStr OptURLMsg 47 | StdOutCRLF 48 | ret 49 | OptEMail: 50 | StdOutStr OptEmailMsg 51 | StdOutCRLF 52 | ret 53 | 54 | NoSwitch: 55 | LookupParam OptionsTable 56 | cmp ax, 0xffff 57 | je Oops 58 | mov bl, 1 59 | mov [Shown], bl 60 | jmp ax 61 | ret 62 | 63 | Oops: 64 | StdOutStr CommandLineErrorMsg 65 | StdOutCRLF 66 | Terminate 100 67 | 68 | HelpSwitchHandler 'vver' 69 | 70 | CommandLineSwitches: 71 | SwitchData 0, 0, NoSwitch 72 | HelpSwitchData 73 | SwitchData 0, 0, 0 74 | 75 | Shown: 76 | db 0 77 | 78 | OptionsTable: 79 | TableData "ALL", OptAll 80 | TableData "NAME", OptName 81 | TableData "COPYRIGHT", OptCopy 82 | TableData "VERSION", OptVer 83 | TableData "LICENSE", OptLic 84 | TableData "TITLE", OptName 85 | TableData "COPY", OptCopy 86 | TableData "VER", OptVer 87 | TableData "LIC", OptLic 88 | TableData "URL", OptURL 89 | TableData "EMAIL", OptEMail 90 | TableEnd 91 | 92 | OptNameMsg: 93 | DB 'V8Power Tools for DOS',0 94 | OptVerMsg: 95 | DB 'Version ',__DATE__,0 96 | OptCopyMsg: 97 | DB 'Copyright (C) 2015-2024 Jerome Shidel',0 98 | OptEmailMsg: 99 | DB 'mailto:V8Power@Shidel.net',0 100 | OptURLMsg: 101 | DB 'https://github.com/LoopZ/V8Power',0 102 | OptLicMsg: 103 | DB "This program is free software; you can redistribute it and/or modify",CRLF 104 | DB "it under the terms of the GNU General Public License as published by",CRLF 105 | DB "the Free Software Foundation; either version 2 of the License, or",CRLF 106 | DB "(at your option) any later version.",CRLF 107 | DB CRLF 108 | DB "This program is distributed in the hope that it will be useful,",CRLF 109 | DB "but WITHOUT ANY WARRANTY; without even the implied warranty of",CRLF 110 | DB "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",CRLF 111 | DB "GNU General Public License for more details.",CRLF 112 | DB CRLF 113 | DB "You should have received a copy of the GNU General Public License along",CRLF 114 | DB "with this program; if not, write to the Free Software Foundation, Inc.,",CRLF 115 | DB "51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.",CRLF 116 | DB 0 117 | -------------------------------------------------------------------------------- /VNLSTEST/CP857.V8F: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LoopZ/V8Power/9475786721532b4a2a2d2a72dcb13c5c020a9fa3/VNLSTEST/CP857.V8F -------------------------------------------------------------------------------- /VNLSTEST/CP858.V8F: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LoopZ/V8Power/9475786721532b4a2a2d2a72dcb13c5c020a9fa3/VNLSTEST/CP858.V8F -------------------------------------------------------------------------------- /VNLSTEST/CP866.V8F: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LoopZ/V8Power/9475786721532b4a2a2d2a72dcb13c5c020a9fa3/VNLSTEST/CP866.V8F -------------------------------------------------------------------------------- /VNLSTEST/VNLSTEST.BAT: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | if "%1" == "" goto NoOpts 4 | 5 | set _VNLS.LNG=en 6 | 7 | :OptRepeater 8 | if "%1" == "" goto end 9 | 10 | vfdutil /e %1 | set /p _VNLS.EXT= 11 | 12 | if "%_VNLS.EXT%" == "" goto NoFileExt 13 | if /I "%_VNLS.EXT%" == "DEF" goto DoneGuessLang 14 | if /I "%_VNLS.EXT%" == "BAT" goto DoneGuessLang 15 | set _VNLS.LNG=%_VNLS.EXT% 16 | goto DoneGuessLang 17 | :NoFileExt 18 | vfdutil /n %1 | set /p _VNLS.NAME= 19 | if /I "%_VNLS.NAME%" == "%1" goto GuessLang 20 | goto DoneGuessLang 21 | 22 | :GuessLang 23 | set _VNLS.LNG=%_VNLS.NAME% 24 | shift 25 | goto OptRepeater 26 | 27 | :DoneGuessLang 28 | vecho /g /p 29 | vgotoxy up up 30 | vline 31 | vgotoxy down 32 | 33 | vfont /d 34 | 35 | set _VNLS.FNT= 36 | set _VNLS.V8F= 37 | if /I "%_VNLS.LNG%" == "EN" goto ReadyToDisplay 38 | 39 | IF /I "%_VNLS.LNG%" == "TR" set _VNLS.FNT=CP857 40 | IF /I "%_VNLS.LNG%" == "FR" set _VNLS.FNT=CP850 41 | IF /I "%_VNLS.LNG%" == "DE" set _VNLS.FNT=CP858 42 | IF /I "%_VNLS.LNG%" == "RU" set _VNLS.FNT=CP866 43 | 44 | if "%_VNLS.FNT%" == "" goto NoFont 45 | 46 | rem Find and load font 47 | set _VNLS.V8F=%_VNLS.FNT%.V8F 48 | if exist %_VNLS.V8F% goto FontFound 49 | vfdutil /p %0 | set /p _VNLS.V8F= 50 | set _VNLS.V8F=%_VNLS.V8F%\%_VNLS.FNT%.V8F 51 | if exist %_VNLS.V8F% goto FontFound 52 | vfdutil /s %_VNLS.FNT%.V8F | vstr /b /l 0 | set /p _VNLS.V8F= 53 | if exist %_VNLS.V8F% goto FontFound 54 | goto MissingFont 55 | 56 | :FontFound 57 | vfont %_VNLS.V8F% 58 | goto ReadyToDisplay 59 | 60 | :NoFont 61 | set _VNLS.V8F= 62 | vecho /g /fLightRed Unknown language "%_VNLS.LNG%" /fGray 63 | goto ReadyToDisplay 64 | 65 | :MissingFont 66 | set _VNLS.V8F= 67 | vecho /g /fLightRed Unknown to locate "%_VNLS.FNT%" font for language "%_VNLS.LNG%" /fGray 68 | goto ReadyToDisplay 69 | 70 | :ReadyToDisplay 71 | if "%_VNLS.FNT%" == "" set _VNLS.FNT=CP437 72 | vecho /n /g "Font: %_VNLS.FNT%" 73 | if "%_VNLS.V8F%" == "" vecho /n /c32 /s- /fDarkGray ( /fYellow "no font loaded" /fDarkGray ) /fGray 74 | vecho /fGray /p /g "Language: %_VNLS.LNG%" 75 | vecho /g "File: %1" 76 | type %1 | vstr /L total | set /p _VNLS.CNT= 77 | vecho /g "Lines: %_VNLS.CNT%" /p 78 | set _VNLS.LINE=0 79 | if "%_VNLS.LINE%" == "%_VNLS.CNT%" goto DoneShowing 80 | 81 | :RunThroughFile 82 | set _VNLS.WAIT=no 83 | type %1 | vstr /L %_VNLS.LINE% | set /p _VNLS.ALL= 84 | if "%_VNLS.ALL%" == "" goto NextLine 85 | echo %_VNLS.ALL% | vstr /f = 1 | set /p _VNLS.ID= 86 | if "%_VNLS.ID%" == "" goto NextLine 87 | echo %_VNLS.ID% | vstr /s " " "" | set /p _VNLS.VAL= 88 | if not "%_VNLS.VAL%" == "%_VNLS.ID%" goto NextLine 89 | echo %_VNLS.ALL% | vstr /f = 1-2 | set /p _VNLS.VAL= 90 | if "%_VNLS.VAL%" == "%_VNLS.ID%" goto NextLine 91 | set _VNLS.WAIT=yes 92 | 93 | vecho /g /n /fGray Line /fCyan # /s- "%_VNLS.LINE%" 94 | vecho /g /fGray , ID= /s- /fLightGreen "%_VNLS.ID%" /fGray 95 | vecho /g /t %1 %_VNLS.ID% Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9 96 | 97 | :NextLine 98 | vmath %_VNLS.LINE% + 1 | set /p _VNLS.NEXT= 99 | if "%_VNLS.NEXT%" == "" goto NextLine 100 | set _VNLS.LINE=%_VNLS.NEXT% 101 | set _VNLS.NEXT= 102 | if "%_VNLS.LINE%" == "%_VNLS.CNT%" goto DoneShowing 103 | if "%_VNLS.WAIT%" == "no" goto RunThroughFile 104 | vecho /fGray /bBlue /e /n /g /fDarkGray Press a key, CTRL+C to abort /fGray 105 | vpause CTRL-C 106 | if Errorlevel 1 goto End 107 | vgotoxy sol 108 | vecho /n /g /fgray /bBlack /e 109 | goto RunThroughFile 110 | 111 | :DoneShowing 112 | if "%_VNLS.WAIT%" == "no" goto End 113 | vecho /fGray /bRed /e /n /g /fWhite End of File, Press a key, CTRL+C to abort /fGray 114 | vpause CTRL-C 115 | if Errorlevel 1 goto End 116 | vgotoxy sol 117 | vecho /n /g /fgray /bBlack /e 118 | shift 119 | goto OptRepeater 120 | 121 | :NoOpts 122 | echo please specify file name and/or language to use 123 | 124 | :End 125 | vfont /d 126 | set _VNLS.LNG= 127 | set _VNLS.FNT= 128 | set _VNLS.V8F= 129 | set _VNLS.EXT= 130 | set _VNLS.NAME= 131 | set _VNLS.CNT= 132 | set _VNLS.LINE= 133 | set _VNLS.ALL= 134 | set _VNLS.ID= 135 | set _VNLS.VAL= 136 | set _VNLS.WAIT= 137 | 138 | -------------------------------------------------------------------------------- /mkClean.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | if exist BIN del BIN\*.* 4 | if exist BIN rmdir BIN 5 | 6 | if exist DIST del DIST\*.* 7 | if exist DIST rmdir DIST -------------------------------------------------------------------------------- /mkV8.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :Start 4 | set MKV8_SELF=%0 5 | if not exist %MKV8_SELF% set MKV8_SELF=%0.BAT 6 | if exist %MKV8_SELF% goto Begin 7 | set MKV8_STAGE= 8 | echo Unable to locate this script for compiler messages. 9 | goto ERROR 10 | 11 | :Begin 12 | set MKV8_ASM=NASM.EXE 13 | if exist %DOSDIR%\LINKS\NASM.BAT set MKV8_ASM=call NASM 14 | if exist %DOSDIR%\LINKS\NASM.COM set MKV8_ASM=NASM.COM 15 | 16 | if not "%1" == "" goto %1 17 | if not "%1" == "" goto AllDone 18 | 19 | if "%1" == "" call mkClean.bat 20 | if not exist BIN\NUL mkdir BIN 21 | 22 | echo V8Power Tools for DOS! 23 | echo. 24 | call %MKV8_SELF% PreCompile VECHO 25 | if ERRORLEVEL 1 goto Error 26 | call %MKV8_SELF% PreCompile VFDUTIL 27 | if ERRORLEVEL 1 goto Error 28 | call %MKV8_SELF% PreCompile VEACH 29 | if ERRORLEVEL 1 goto Error 30 | 31 | :Loopy 32 | veach /S/D SOURCE\*.ASM /X %MKV8_SELF% SubCompile * 33 | if ERRORLEVEL 1 goto Error 34 | goto Done 35 | 36 | :PreCompile 37 | set MKV8_STAGE=%2 38 | set MKV8_CODE=%2.ASM 39 | goto DoMessage 40 | :SubCompile 41 | if "%2" == "VECHO.ASM" goto VeryEnd 42 | if "%2" == "VFDUTIL.ASM" goto VeryEnd 43 | if "%2" == "VEACH.ASM" goto VeryEnd 44 | set /e MKV8_STAGE=BIN\VFDUTIL.COM /n %2 45 | if "%MKV8_STAGE" == "" goto SubCompile 46 | set MKV8_CODE=%2 47 | :DoMessage 48 | if exist bin\vecho.com goto FancyMessage 49 | echo (%MKV8_STAGE%) Cabin Fever... 50 | goto DoCompile 51 | :FancyMessage 52 | vecho /g /n /fDarkGray (%MKV8_STAGE%) /fGray /t %MKV8_SELF% MSG_%MKV8_STAGE% %MKV8_STAGE% 53 | if ERRORLEVEL 1 Echo missing message for %MKV8_STAGE% 54 | :DoCompile 55 | 56 | if exist BIN\%MKV8_STAGE%.COM del BIN\%MKV8_STAGE%.COM>NUL 57 | %MKV8_ASM% -ISOURCE\ SOURCE\%MKV8_STAGE%.ASM -fbin -O9 -o BIN\%MKV8_STAGE%.COM 58 | if ERRORLEVEL 1 goto CompileFail 59 | if not exist BIN\%MKV8_STAGE%.COM CompileFail 60 | 61 | :CompileOk 62 | vecho /g /t %MKV8_SELF% MSG_SUCCESS 63 | goto VeryEnd 64 | :CompileFail 65 | vecho /g /t %MKV8_SELF% MSG_FAIL 66 | verrlvl 1>NUL 67 | goto VeryEnd 68 | 69 | ### Displayed messages 70 | 71 | MSG_SUCCESS=/f LightGreen /c32 Success /f Gray 72 | MSG_FAIL=/f LightRed /c32 Failed! /f Gray 73 | MSG_VECHO=Grabbing /fYellow keys /fGray /s- ... 74 | MSG_VFDUTIL=Inspecting /fWhite tires /fGray /s- ... 75 | MSG_VEACH=Examining /f lightred coolant /f Gray /s- ... 76 | MSG_VASK=Studying /f 10 dipstick /f gray /s- ... 77 | MSG_VCHKBOX=Checking /f yellow spark-plugs /f Gray /s- ... 78 | MSG_VCHOICE=Cleaning /f 15 air filter /f gray /s- ... 79 | MSG_VCLS=Testing /f 13 belts /f gray /s- ... 80 | MSG_VCURSOR=Turning /f 10 the key /f gray /s- ... 81 | MSG_VDELAY=Verifying /f 12 timing /f gray /s- ... 82 | MSG_VDELETE=Adjusting /f 13 carburetor /f gray /s- ... 83 | MSG_VERRLVL=Examining /f 9 gauges /f gray /s- ... 84 | MSG_VFONT=Warming /f 0x0a engine /f gray /s- ... 85 | MSG_VFRAME=Opening /f 14 map /f gray /s- ... 86 | MSG_VGOTOXY=Planing /f10 waypoints /f gray /s- ... 87 | MSG_VHDUTIL=Studying /f 12 route /f gray /s- ... 88 | MSG_VINFO=Tuning /f 10 radio /f gray /s- ... 89 | MSG_VINSERT=Referencing /f 11 Zen and the Art of Motorcycle Maintenance /f gray /s- ... 90 | MSG_VLINE=Dawning /f 9 shades /f gray /s- ... 91 | MSG_VMATH=Selecting /f 10 gear /f gray /s- ... 92 | MSG_VMODE=Releasing /f 11 brakes /f gray /s- ... 93 | MSG_VPAUSE=Revving /f 13 engine /f gray /s- ... 94 | MSG_VPCSPKR=Spotting /f 10 gap /f gray /s- ... 95 | MSG_VPROGRES=Engaging /f 12 signal /f gray /s- ... 96 | MSG_VREADKEY=Releasing /f 14 clutch /f gray /s- ... 97 | MSG_VTEST=Pacing /f 0x9 vehicles /f gray /s- ... 98 | MSG_VSTR=Eyeing /f 0x0a surroundings /f gray /s- ... 99 | MSG_VVER=Monitoring /f 5 traffic /f gray /s- ... 100 | MSG_VVIEW=Mashing /f 12 accelerator /f gray /s- ... 101 | 102 | :Error 103 | if "%MKV8_STAGE%" == "" echo Script failure. 104 | if not "%MKV8_STAGE%" == "" echo Error creating utility %MKV8_STAGE%.com. 105 | goto AllDone 106 | 107 | :Done 108 | bin\vecho /g/s- 109 | bin\vecho /g/s- /n /fLightCyan Vroom /fWhite "! " 110 | bin\vecho /g/s- /n /fLightRed Vroom /fWhite "! " 111 | bin\vecho /g/s- /fYellow "Lets roll" /fWhite "! " /fGray 112 | if not exist BIN\NUL goto AllDone 113 | copy LICENSE BIN >NUL 114 | if exist README.TXT copy README.TXT BIN\V8POWER.TXT >NUL 115 | if not exist README.TXT copy README.md BIN\V8POWER.md >NUL 116 | 117 | :AllDone 118 | set MKV8_SELF= 119 | set MKV8_STAGE= 120 | set MKV8_CODE= 121 | set MKV8_ASM= 122 | 123 | :VeryEnd 124 | -------------------------------------------------------------------------------- /mkv8.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # IGNORE=';VVIEW;VREADKEY;VCHKBOX;' 4 | IGNORE=';;' 5 | 6 | if [[ "$(uname)" == "Darwin" ]] ; then 7 | DARWIN=yes 8 | else 9 | unset DARWIN 10 | fi 11 | function filesize () { 12 | if [[ ${DARWIN} ]] ; then 13 | stat -f '%z' "${1}" 2>/dev/null || echo 0 14 | else 15 | stat --format '%s' "${1}" 2>/dev/null || echo 0 16 | fi 17 | } 18 | 19 | function assemble () { 20 | 21 | [[ ! -d BIN ]] && mkdir -p BIN 22 | local n="${1##*/}" 23 | n="${n%.*}" 24 | local o=$(echo ${n} | tr "[:lower:]" "[:upper:]" ) 25 | 26 | if [[ "${IGNORE/${n}}" != "${IGNORE}" ]] ; then 27 | echo "${n}, ignored" 28 | return 0 29 | fi 30 | if [[ ! -f "BIN/${o}.COM" ]] ; then 31 | local z=$(filesize "../../BIN/${o}.COM") 32 | else 33 | local z=$(filesize "BIN/${o}.COM") 34 | fi 35 | nasm -ISOURCE/ SOURCE/${n}.ASM -fbin -O9 -o BIN/${o}.COM || { 36 | echo "error assembling ${n}.ASM" 37 | return 1 38 | } 39 | [[ ! -e BIN/${o}.COM ]] && { 40 | echo "missing BIN/${o}.COM" 41 | return 1 42 | } 43 | local x=$(filesize "BIN/${o}.COM") 44 | [[ ${z} -eq ${x} ]] || echo "${n}, ${z} --> ${x}, ${o}" 45 | 46 | return 0 47 | 48 | } 49 | 50 | if [[ "${*}" == '' ]] ; then 51 | for i in SOURCE/*.ASM ; do 52 | [[ "${i}" == "SOURCE/DEMOPARS.ASM" ]] && continue 53 | assemble "${i}" || exit 1 54 | done 55 | else 56 | while [[ "${*}" != '' ]] ; do 57 | assemble "${1}" || exit 1 58 | shift 59 | done 60 | fi -------------------------------------------------------------------------------- /release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [[ "${0##*/}" != 'release.sh' ]] ; then 3 | echo bad script name 4 | exit 1 5 | fi 6 | 7 | FDNLS=../../FreeDOS/FD-NLS/v8power 8 | if [[ ! -d "${FDNLS}" ]] ; then 9 | echo missing NLS 10 | exit 1 11 | fi 12 | 13 | # ls ${FDNLS} 14 | 15 | # PRERELEASE='.pre' 16 | 17 | DESTINATION='Downloads' 18 | RELEASE=0 19 | FORMAT='zip' 20 | PROJECT=$(echo ${PWD##*/}) 21 | TODAY=$(date +'%Y-%m-%d') 22 | VERSION=$(date +'%y.%m.%d') 23 | CHANGES="${@//!/.}" 24 | 25 | 26 | [[ -d "${HOME}/${DESTINATION}/${PROJECT}" ]] && rm -rf "${HOME}/${DESTINATION}/${PROJECT}" 27 | 28 | # Standard binaries release 29 | touch BIN/* 30 | 31 | mkdir -p "${HOME}/${DESTINATION}/${PROJECT}" 32 | cp -r BIN/* "${HOME}/${DESTINATION}/${PROJECT}/" 33 | mkdir -p "${HOME}/${DESTINATION}/${PROJECT}/DEMOS" 34 | cp -r DEMOS/* "${HOME}/${DESTINATION}/${PROJECT}/DEMOS/" 35 | mkdir -p "${HOME}/${DESTINATION}/${PROJECT}/EXAMPLES" 36 | cp -r EXAMPLES/* "${HOME}/${DESTINATION}/${PROJECT}/EXAMPLES/" 37 | 38 | ARCHIVE="${PROJECT}-${VERSION}-${RELEASE}${PRERELEASE}.${FORMAT}" 39 | while [[ -f "${HOME}/${DESTINATION}/${ARCHIVE}" ]] ; do 40 | (( RELEASE++ )) 41 | ARCHIVE="${PROJECT}-${VERSION}-${RELEASE}${PRERELEASE}.${FORMAT}" 42 | done 43 | 44 | if [[ -f 'LICENSE' ]] ; then 45 | cp 'LICENSE' "${HOME}/${DESTINATION}/${PROJECT}/LICENSE.txt" 46 | fi; 47 | if [[ -f "${FDNLS}/help/v8power.en" ]] ; then 48 | cp "${FDNLS}/help/v8power.en" "${HOME}/${DESTINATION}/${PROJECT}-README.txt" 49 | mkdir -p "${HOME}/${DESTINATION}/${PROJECT}/HELP" 50 | 51 | cp "${FDNLS}/help/"* "${HOME}/${DESTINATION}/${PROJECT}/HELP/" 52 | fi; 53 | if [[ -f 'CONTRIB.md' ]] ; then 54 | cp 'CONTRIB.md' "${HOME}/${DESTINATION}/${PROJECT}/CONTRIB.md" 55 | fi; 56 | 57 | CURDIR="$PWD" 58 | cd "${HOME}/${DESTINATION}" 59 | # if [[ "$FORMAT" == "zip" ]] ; then 60 | # zip -9 -r "${ARCHIVE}" "${PROJECT}/"* 61 | # fi; 62 | cd "${CURDIR}" 63 | 64 | rm -rf "${HOME}/${DESTINATION}/${PROJECT}" 65 | 66 | # Package Release 67 | mkdir -p "${HOME}/${DESTINATION}/${PROJECT}" 68 | mkdir -p "${HOME}/${DESTINATION}/${PROJECT}/APPINFO" 69 | [[ ${RELEASE} == 0 ]] && RNAME=${VERSION} || RNAME=${VERSION}-${RELEASE} 70 | cat SOURCE/APPINFO.LSM | sed 's/\$VERSION\$/'${RNAME}/g | \ 71 | sed 's/\$DATE\$/'${TODAY}/g | \ 72 | sed 's!\$NOTES\$!'"${CHANGES}"!g > \ 73 | "${HOME}/${DESTINATION}/${PROJECT}/APPINFO/${PROJECT}.LSM" 74 | 75 | mkdir -p "${HOME}/${DESTINATION}/${PROJECT}/BIN" 76 | cp -r BIN/* "${HOME}/${DESTINATION}/${PROJECT}/BIN" 77 | mkdir -p "${HOME}/${DESTINATION}/${PROJECT}/DOC/${PROJECT}" 78 | cp -r *.txt "${HOME}/${DESTINATION}/${PROJECT}/DOC/${PROJECT}" 79 | cp -r LICENSE "${HOME}/${DESTINATION}/${PROJECT}/DOC/${PROJECT}" 80 | cp -r CONTRIB.md "${HOME}/${DESTINATION}/${PROJECT}/DOC/${PROJECT}" 81 | mkdir -p "${HOME}/${DESTINATION}/${PROJECT}/SOURCE/${PROJECT}" 82 | cp -r * "${HOME}/${DESTINATION}/${PROJECT}/SOURCE/${PROJECT}" 83 | rm -rf "${HOME}/${DESTINATION}/${PROJECT}/SOURCE/${PROJECT}/BIN" 84 | mkdir -p "${HOME}/${DESTINATION}/${PROJECT}/HELP" 85 | if [[ -f "${FDNLS}/help/en/v8power.en" ]] ; then 86 | cp "${FDNLS}/help/en/v8power.en" "${HOME}/${DESTINATION}/${PROJECT}/DOC/${PROJECT}/README.txt" 87 | mkdir -p "${HOME}/${DESTINATION}/${PROJECT}/HELP" 88 | for trs in "${FDNLS}/help/"*/* ; do 89 | [[ "${trs//.UTF}" != "${trs}" ]] && continue 90 | cp -av "${trs}" "${HOME}/${DESTINATION}/${PROJECT}/HELP/" 91 | done 92 | 93 | fi; 94 | 95 | mkdir -p "${HOME}/${DESTINATION}/${PROJECT}/SOURCE/${PROJECT}/SOURCE" 96 | cp -r SOURCE/* "${HOME}/${DESTINATION}/${PROJECT}/SOURCE/${PROJECT}/SOURCE" 97 | 98 | pushd "${HOME}/${DESTINATION}/${PROJECT}" 99 | [[ -e "BIN/DEMOPARS.COM" ]] && rm "BIN/DEMOPARS.COM" 100 | [[ -e "BIN/LICENSE" ]] && rm "BIN/LICENSE" 101 | rm -f BIN/*.TXT 102 | mv -f BIN/*.MD DOC/V8Power/ 103 | rm -f HELP/*UTF-8 104 | cp SOURCE/V8Power/LICENSE.* DOC/V8Power/ 105 | popd 106 | 107 | lcase=$(echo "${PROJECT}" | tr '[:upper:]' '[:lower:]') 108 | cd "${HOME}/${DESTINATION}" 109 | [[ -f "${lcase}.zip" ]] && rm "${lcase}.zip" 110 | cd "${PROJECT}" 111 | rm "BIN/V8POWER.TXT" >/dev/null 112 | zip -9 -r -k "../${lcase}.zip" * 113 | cd "${CURDIR}" 114 | 115 | rm -rf "${HOME}/${DESTINATION}/${PROJECT}" 116 | 117 | # echo "${HOME}/${DESTINATION}/${ARCHIVE}" 118 | # echo "${HOME}/${DESTINATION}/${PROJECT}.zip" 119 | --------------------------------------------------------------------------------