From: Svjatoslav Agejenko Date: Sun, 21 Jul 2024 10:56:44 +0000 (+0300) Subject: Improved QBasic tutorials in group 2 X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=3b28ab84c7f81311de41d77f58f7591e28f1afb7;p=qbasicapps.git Improved QBasic tutorials in group 2 --- diff --git a/QBasic tutorial/Group 1/00.bas b/QBasic tutorial/Group 1/00.bas new file mode 100755 index 0000000..fc62f12 --- /dev/null +++ b/QBasic tutorial/Group 1/00.bas @@ -0,0 +1,10 @@ +' This program demonstrates a basic "Hello World" example in QuickBasic. +' It is designed to be simple and easy to understand for novice programmers. + +' The following line prints a greeting message to the console. +PRINT "Hello world!" + +' When you run this program, it will output the string "Hello world!" to the screen. +' This is a traditional first step in learning any new programming language. + +' To execute this program, press F5 while in the QuickBasic editor environment. diff --git a/QBasic tutorial/Group 1/01.bas b/QBasic tutorial/Group 1/01.bas new file mode 100755 index 0000000..0760259 --- /dev/null +++ b/QBasic tutorial/Group 1/01.bas @@ -0,0 +1,24 @@ +' This QuickBasic program demonstrates basic arithmetic operations +' and the use of variables. It will perform a series of calculations +' on a single variable and print the results after each operation. + +CLS ' Clears the screen to provide a clean output area + +' Initialize a variable with the value 3 +DIM initialValue AS INTEGER +initialValue = 3 + +' Print the current value of initialValue +PRINT "The initial value is: "; initialValue + +' Perform multiplication and assign the result back to initialValue +initialValue = initialValue * 2 + +' Print the new value after multiplication +PRINT "After doubling, the value is: "; initialValue + +' Perform subtraction and decrease initialValue by 1 +initialValue = initialValue - 1 + +' Print the final value after subtraction +PRINT "After decrementing by 1, the value is: "; initialValue diff --git a/QBasic tutorial/Group 1/02.bas b/QBasic tutorial/Group 1/02.bas new file mode 100755 index 0000000..ccf5019 --- /dev/null +++ b/QBasic tutorial/Group 1/02.bas @@ -0,0 +1,21 @@ +' This program demonstrates basic arithmetic operations in QuickBasic + +CLS ' Clears the screen to provide a clean output area + +' Declare a variable 'a' and assign it the value of 7 +DIM a AS INTEGER +a = 7 + +' Print the current value of 'a' to the console +PRINT "The value contained in variable 'a' is: "; a + +' Perform a series of arithmetic operations on the value of 'a' +' and print the result +PRINT "Performing some calculations with 'a':"; +PRINT (a + 2.1234) / 3 * 4 - 6 + +' Explanation of the calculation: +' 1. Add 2.1234 to 'a' +' 2. Divide the result by 3 +' 3. Multiply the new result by 4 +' 4. Subtract 6 from the final result diff --git a/QBasic tutorial/Group 1/03.bas b/QBasic tutorial/Group 1/03.bas new file mode 100755 index 0000000..6f6cebe --- /dev/null +++ b/QBasic tutorial/Group 1/03.bas @@ -0,0 +1,34 @@ +' This program demonstrates how to use semicolon and comma as separators +' in PRINT statements within Microsoft QuickBasic. + +CLS ' Clears the screen before starting the program + +' Semicolon Separator Example + +' The semicolon is used to print multiple items on the same line, without +' advancing to a new line after each item. It is useful for formatting output +' in a single line of text. + +PRINT "Semicolon separator:" +PRINT 12; 314; 122; 1; 43 ' Prints numbers separated by semicolons on the same line +PRINT 312; 4; 1; 3111; 3 ' Continues printing more numbers on the next line +PRINT 3; 2344; 12231; 1; 12333 ' Final set of numbers printed on the last line + +' Print an empty line for better readability +PRINT ' This statement prints an empty line to separate different sections + +' Comma Separator Example + +' The comma is used as a separator in PRINT statements to print multiple items, +' each followed by a space and advancing to the next tab column (default is 14 +' characters apart). If there are more items than columns, it will start +' a new line. + +PRINT "Comma separator:" +PRINT 12, 314, 122, 1, 43 ' Prints numbers separated by commas, with spacing +PRINT 312, 4, 1, 3111, 3 ' Numbers are printed in tabular form +PRINT 3, 2344, 12231, 1, 12333 ' Continues the tabular output + +' End of program +END ' This statement marks the end of the QuickBasic program + diff --git a/QBasic tutorial/Group 1/04.bas b/QBasic tutorial/Group 1/04.bas new file mode 100755 index 0000000..dd1a43d --- /dev/null +++ b/QBasic tutorial/Group 1/04.bas @@ -0,0 +1,17 @@ +' This program prompts the user to enter a number and then prints that number back to the screen. +' It demonstrates basic input/output operations in QuickBasic. + +DEFINT A-Z ' Declare all variables as integers for simplicity + +' Declare a variable to store the user's input +DIM num AS INTEGER + +' Use the INPUT statement to prompt the user and read their input +PRINT "Please enter a number:"; +INPUT num + +' Print a message to the screen along with the entered number +PRINT "You entered: "; num + +' End of program +END diff --git a/QBasic tutorial/Group 1/05.bas b/QBasic tutorial/Group 1/05.bas new file mode 100755 index 0000000..5d56b0c --- /dev/null +++ b/QBasic tutorial/Group 1/05.bas @@ -0,0 +1,26 @@ +REM **** Guess a Number Game **** + +DEFINT A-Z ' Define all variables as integers for performance and clarity + +' Main game loop +DO + ' Prompt the user to enter a number + INPUT "Enter a number between 1 and 10: "; guess + + ' Check if the user guessed the correct number + IF guess = 5 THEN + ' If the guess is correct, congratulate the user and exit the loop + PRINT "Correct!!! You've guessed the secret number." + EXIT DO + ELSEIF guess < 5 THEN + ' If the guess is too low, prompt the user to try a higher number + PRINT "Try a bigger number." + ELSEIF guess > 5 THEN + ' If the guess is too high, prompt the user to try a lower number + PRINT "Try a smaller number." + END IF +LOOP + +' End of the program +PRINT "Thank you for playing! Goodbye." +END diff --git a/QBasic tutorial/Group 1/06.bas b/QBasic tutorial/Group 1/06.bas new file mode 100755 index 0000000..4237cf8 --- /dev/null +++ b/QBasic tutorial/Group 1/06.bas @@ -0,0 +1,22 @@ +CLS ' Clear the screen + +' This program demonstrates a simple counting loop in QuickBasic. +' It will print the current value of 'a' and increment it by 1 each time. +' The loop continues until 'a' is no longer less than 10. + +DIM a AS INTEGER ' Declare variable 'a' as an integer + +' Initialize the counter variable 'a' to start at 1 +a = 1 + +' Start of the counting loop +DO WHILE a < 10 + ' Print the current value of 'a' with a label + PRINT "current:"; a + + ' Increment 'a' by 1 + a = a + 1 +LOOP + +' The program will end after the loop finishes +END diff --git a/QBasic tutorial/Group 1/07.bas b/QBasic tutorial/Group 1/07.bas new file mode 100755 index 0000000..9bb214b --- /dev/null +++ b/QBasic tutorial/Group 1/07.bas @@ -0,0 +1,12 @@ +' This program demonstrates a simple FOR loop in Microsoft QuickBasic + +CLS ' Clears the screen, preparing it for output + +' We are about to use a FOR loop to print numbers from 1 to 10 +FOR i = 1 TO 10 ' Initialize a counter variable 'i' starting at 1 + ' For each iteration of the loop, print the current value of 'i' + PRINT "current: "; i ' Outputs the message with the current number +NEXT i ' Increment 'i' by 1 and repeat the loop until 'i' is no longer less than or equal to 10 + +' The program has now finished executing and will end +END ' This marks the end of the QuickBasic program diff --git a/QBasic tutorial/Group 1/08.bas b/QBasic tutorial/Group 1/08.bas new file mode 100755 index 0000000..8df64b6 --- /dev/null +++ b/QBasic tutorial/Group 1/08.bas @@ -0,0 +1,23 @@ +' This program demonstrates how to use a FOR loop and the SOUND statement +' in QuickBasic. It plays a series of tones at increasing frequencies +' from 100 Hz to 1000 Hz, in steps of 50 Hz, with each tone lasting for +' one duration unit as defined by the SOUND statement. + +CLS ' Clears the screen before starting the program + +' Initialize the frequency variable to the starting value +LET frequency = 100 + +' Loop from the initial frequency (100 Hz) to the maximum frequency (1000 Hz), +' increasing by 50 Hz on each iteration +FOR frequency = 100 TO 1000 STEP 50 + ' Print the current frequency value to the console + PRINT "Current Frequency:"; frequency; " Hz" + + ' Play a sound at the specified frequency and duration + ' The SOUND statement takes two arguments: frequency and duration + SOUND frequency, 1 ' The duration is set to 1 (shortest possible sound) +NEXT frequency + +' End of program execution +END diff --git a/QBasic tutorial/Group 1/09.bas b/QBasic tutorial/Group 1/09.bas new file mode 100755 index 0000000..1b96f04 --- /dev/null +++ b/QBasic tutorial/Group 1/09.bas @@ -0,0 +1,22 @@ +REM This program demonstrates how to generate random numbers +REM and use them to create sound effects in QuickBasic. + +CLS ' Clear the screen before starting the program + +' Define constants for the range of random numbers +FOR i = 1 TO 20 ' Loop 20 times to generate and play 20 random sounds + ' Generate a random floating-point number between LOWER_BOUND and UPPER_BOUND + n = RND * 1000 + ' Print the generated random number to the screen + PRINT "Random number: "; n + + ' Play a sound with a frequency based on the random number + ' The QuickBasic SOUND statement takes two arguments: frequency and duration + ' We add 40 to the random number to shift the frequency range + ' so that it is more audible + SOUND n + 40, 1 ' Play the sound for a short duration (1/89th of a second) + +NEXT i + +END ' End the program + diff --git a/QBasic tutorial/Group 1/10.bas b/QBasic tutorial/Group 1/10.bas new file mode 100755 index 0000000..ab4120b --- /dev/null +++ b/QBasic tutorial/Group 1/10.bas @@ -0,0 +1,25 @@ +' This example program demonstrates how to use the WIDTH and COLOR +' statements in QuickBasic to change the text font size and text colors. + +' Set the text window to a smaller font size suitable for displaying +' 50 lines of text within an 80-column width. +WIDTH 80, 50 + +' Define constants for the number of colors available in standard +' QuickBasic color palette. +CONST NumColors = 32 + +' Loop through all possible colors (0 to 31) and display a message +' with each color to illustrate the different text color options. +FOR colorIndex = 0 TO NumColors - 1 + ' Set the current text color using the COLOR statement. + ' Colors range from 0 to 15 are solid, while colors 16 to 31 + ' will blink slowly or quickly depending on the terminal. + COLOR colorIndex + + ' Print a message indicating which color number is currently being used. + ' Note that color numbers 16 and above will produce blinking text. + PRINT "This is text color number "; colorIndex; "." + +NEXT colorIndex + diff --git a/QBasic tutorial/Group 1/11.bas b/QBasic tutorial/Group 1/11.bas new file mode 100755 index 0000000..e6f69e6 --- /dev/null +++ b/QBasic tutorial/Group 1/11.bas @@ -0,0 +1,27 @@ +' This program demonstrates how to use the COLOR statement and LOCATE function +' in Microsoft QuickBasic to change the text color and cursor position +' on the console screen. + +CLS ' Clears the screen before starting + +' Set the text color to yellow (color code 14) and position the cursor +' at row 1, column 50. Then print a message at that location. +COLOR 14 +LOCATE 1, 50 ' Sets the cursor location to +PRINT "Yellow text at 1, 50" + +' Change the text color to pink (color code 12) and move the cursor +' to row 6, column 5. Print a message with the new color and position. +COLOR 12 +LOCATE 6, 5 ' Sets the cursor location to +PRINT "Pink text at 6, 5" + +' Update the text color to green (color code 10) and set the cursor +' to row 20, column 40. Display a message at this new location. +COLOR 10 +LOCATE 20, 40 ' Sets the cursor location to +PRINT "Green text at 20, 40" + +' The program finishes execution here. Users can add more statements +' below this line to experiment with different colors and positions. +END ' End of the program diff --git a/QBasic tutorial/Group 1/12.bas b/QBasic tutorial/Group 1/12.bas new file mode 100755 index 0000000..3aa9c36 --- /dev/null +++ b/QBasic tutorial/Group 1/12.bas @@ -0,0 +1,24 @@ +' This program demonstrates the use of FOR loops, color manipulation, +' and string output in QuickBasic. It also shows how to prevent the +' cursor from moving to a new line after printing a string. + +CLS ' Clears the screen before starting the program + +' The first loop demonstrates changing text colors using the COLOR statement +' inside a FOR loop, which iterates from 1 to 15 (the number of available +' color attributes in QuickBasic). +FOR ColorIndex = 1 TO 15 + COLOR ColorIndex ' Set the current text color to the loop index + PRINT "This is a test" ' Print the string with the new color +NEXT ColorIndex + +PRINT ' Print a blank line for better readability + +' The second loop does the same as the first one, but it uses a semicolon +' at the end of the PRINT statement to prevent the cursor from moving +' to the start of a new line after each string output. This results in +' all strings being printed on the same line. +FOR ColorIndex = 1 TO 15 + COLOR ColorIndex ' Change the text color for each iteration + PRINT "This is a test"; ' Print the string and keep the cursor on the same line +NEXT ColorIndex diff --git a/QBasic tutorial/Group 1/13.bas b/QBasic tutorial/Group 1/13.bas new file mode 100755 index 0000000..c778556 --- /dev/null +++ b/QBasic tutorial/Group 1/13.bas @@ -0,0 +1,19 @@ +' This example QuickBasic program demonstrates the difference between +' normal division and integer division with rounding. + +CLS ' Clears the screen to provide a clean output area + +' Perform normal division which results in a floating-point number +' and print the result +PRINT "Normal division (70 / 4):"; 70 / 4 + +' Explain the use of backslash (\) for integer division with rounding +' Perform integer division with rounding and print the result +PRINT "Integer division with rounding (70 \ 4):"; 70 \ 4 + +' Provide a brief conclusion to summarize what was demonstrated +PRINT +PRINT "In QuickBasic, '/' performs normal division, while '\' does integer division" +PRINT "and rounds the result to the nearest whole number." + +END ' End of program diff --git a/QBasic tutorial/Group 1/15.bas b/QBasic tutorial/Group 1/15.bas new file mode 100755 index 0000000..242c221 --- /dev/null +++ b/QBasic tutorial/Group 1/15.bas @@ -0,0 +1,18 @@ +' This program demonstrates the use of nested FOR loops in QuickBasic +' to draw a simple pattern on the screen. + +CLS ' Clears the screen and prepares for output + +' Outer loop will run 15 times, representing rows +FOR row = 1 TO 15 + + ' Inner loop will run 60 times, representing columns within each row + FOR column = 1 TO 60 + PRINT "#"; ' Print a '#' character followed by no space to create a continuous line + NEXT column + + ' After completing one row, print a newline character to move to the next line + PRINT + +NEXT row + diff --git a/QBasic tutorial/Group 1/16.bas b/QBasic tutorial/Group 1/16.bas new file mode 100755 index 0000000..71f1eaf --- /dev/null +++ b/QBasic tutorial/Group 1/16.bas @@ -0,0 +1,34 @@ +' QuickBasic example program to demonstrate the use of nested loops +' and how to control the flow of a loop using the STEP keyword. + +CLS ' Clears the screen before starting the program + +' This outer loop will iterate from 1 to 10 +FOR b = 1 TO 10 + ' The inner loop will print "A" b times, where b is the current + ' value of the outer loop iterator + FOR a = 1 TO b + PRINT "A"; ' Print "A" followed by a semicolon to prevent newline + NEXT a + + ' After each inner loop iteration, print a newline to start the next line + PRINT +NEXT b + +' Print a blank line to separate the two parts of the demonstration +PRINT + +' This outer loop will iterate from 60 to 0, decrementing by 8 each time +FOR b = 60 TO 0 STEP -8 + ' The inner loop will print "B" b times, where b is the current + ' value of the outer loop iterator + FOR a = 1 TO b + PRINT "B"; ' Print "B" followed by a semicolon to prevent newline + NEXT a + + ' After each inner loop iteration, print a newline to start the next line + PRINT +NEXT b + +' End of the program +END diff --git a/QBasic tutorial/Group 1/17.bas b/QBasic tutorial/Group 1/17.bas new file mode 100755 index 0000000..b5e5f35 --- /dev/null +++ b/QBasic tutorial/Group 1/17.bas @@ -0,0 +1,31 @@ +' This example QuickBasic program demonstrates how to use the built-in +' timer, as well as how to display the current system time and date. +' It also shows a simple loop structure and the use of the CLS statement +' to clear the screen. + +' To stop the program, press CTRL + PAUSE/BREAK. + +DO + ' Clear the screen to provide a clean display for each iteration. + CLS + + ' Retrieve and print the current value of the system timer. + ' The TIMER function returns the number of seconds that have + ' elapsed since midnight, not counting leap seconds. + PRINT "System Timer: "; TIMER; " seconds since midnight." + + ' Retrieve and print the current system time using TIME$. + ' TIME$ returns a string in the format "HH:MM:SS". + PRINT "Current System Time: "; TIME$; "." + + ' Retrieve and print the current system date using DATE$. + ' DATE$ returns a string in the format "M/D/YYYY" or "DD/MM/YYYY" + ' depending on regional settings. + PRINT "Current System Date: "; DATE$; "." + + ' Pause for a moment to allow the user to see the output before + ' it is cleared again in the next iteration of the loop. + ' The Sleep statement requires including the QB.BI library. + SLEEP 1 + +LOOP diff --git a/QBasic tutorial/Group 1/18.bas b/QBasic tutorial/Group 1/18.bas new file mode 100755 index 0000000..0aec40a --- /dev/null +++ b/QBasic tutorial/Group 1/18.bas @@ -0,0 +1,31 @@ +' This example program demonstrates the use of the RND function +' to generate random numbers in Microsoft QuickBasic. + +' Clear the screen before starting the program +CLS + +' The first loop will print ten random numbers. However, these +' numbers may not seem truly random because the random number +' generator needs to be seeded with a varying value. + +PRINT "First group of 'random' numbers without seeding:" +FOR b = 1 TO 10 + PRINT RND +NEXT b + +' Print an empty line for better readability between the two groups +PRINT + +' Seed the random number generator using the TIMER function, which +' returns the number of seconds since midnight. This ensures that +' subsequent calls to RND will yield different sequences of numbers +' each time the program is run after being restarted. +RANDOMIZE TIMER +PRINT "Second group of truly random numbers with seeding:" + +' Now, print another ten random numbers after seeding the generator +FOR b = 1 TO 10 + PRINT RND +NEXT b + +' End of program diff --git a/QBasic tutorial/Group 1/19.bas b/QBasic tutorial/Group 1/19.bas new file mode 100755 index 0000000..536364b --- /dev/null +++ b/QBasic tutorial/Group 1/19.bas @@ -0,0 +1,31 @@ +' This program demonstrates how to use the QuickBasic functions RND (random number generator), +' COLOR (sets text and background color), LOCATE (positions the cursor on the screen), PRINT (displays text), +' SOUND (generates a tone through the PC speaker) + +CLS ' Clears the screen before starting the program + +' Generate random coordinates (x, y) for text placement on the screen +' and a random color (c) for the text. +' The screen has 80 columns (0-79) and 25 lines (0-24), but we start counting from 1. + + +' INKEY$ returns a string containing any keystroke; if no key is pressed, it returns an empty string +DO WHILE INKEY$ = "" + x = INT(RND * 80) + 1 ' Random column, ensuring it is within the screen width + y = INT(RND * 25) + 1 ' Random line, ensuring it is within the screen height + c = INT(RND * 16) ' Random color index (0-15), where 0 is black and 15 is white + + ' Set the text color to the randomly chosen color + COLOR c + + ' Position the cursor at the random coordinates + LOCATE y, x + + ' Print an "x" character at the current cursor position + PRINT "x"; ' The semicolon prevents advancing to the next line + + ' Generate a sound with a frequency based on the x coordinate and a duration of 0.1 seconds + SOUND x * 100 + 100, 1 + +LOOP + diff --git a/QBasic tutorial/Group 2/01.bas b/QBasic tutorial/Group 2/01.bas new file mode 100755 index 0000000..d3f31ae --- /dev/null +++ b/QBasic tutorial/Group 2/01.bas @@ -0,0 +1,38 @@ +CLS + +' This program demonstrates how to use the SOUND statement in QuickBasic +' to play tones with varying frequency and duration. + +' Play a sequence of tones with increasing frequency +' Each tone has a fixed duration of 2 time units +PRINT "Playing tones with increasing frequency:" +SOUND 1000, 2 ' Play a tone at 1000 Hz for 2 time units +SOUND 2000, 2 ' Play a tone at 2000 Hz for 2 time units +SOUND 3000, 2 ' Play a tone at 3000 Hz for 2 time units + +' Wait for 10 time units to create a pause +PRINT "Pausing for 10 time units..." +SOUND 0, 10 ' Pause for 10 time units (silence) + +' Play a sequence of tones with a fixed frequency +' Each tone has an increasing duration +PRINT "Playing tones with fixed frequency and increasing length:" +SOUND 1000, 1 ' Play a tone at 1000 Hz for 1 time unit +SOUND 0, 10 ' Pause for 10 time units (silence) + +SOUND 1000, 2 ' Play a tone at 1000 Hz for 2 time units +SOUND 0, 10 ' Pause for 10 time units (silence) + +SOUND 1000, 4 ' Play a tone at 1000 Hz for 4 time units +SOUND 0, 10 ' Pause for 10 time units (silence) + +SOUND 1000, 8 ' Play a tone at 1000 Hz for 8 time units +SOUND 0, 10 ' Pause for 10 time units (silence) + +' Notes: +' - The SOUND statement takes two arguments: frequency and duration. +' - Frequency is specified in Hertz (Hz), and duration is specified in time units. +' - A frequency of 0 results in silence, which can be used to create pauses. +' - Time units are not precisely defined by QuickBasic and may vary depending +' on the hardware and system configuration. They provide a relative measure +' for timing musical tones. diff --git a/QBasic tutorial/Group 2/03.bas b/QBasic tutorial/Group 2/03.bas new file mode 100755 index 0000000..c2bba1e --- /dev/null +++ b/QBasic tutorial/Group 2/03.bas @@ -0,0 +1,16 @@ +' This program demonstrates basic user input and string manipulation in QuickBasic. +' It greets the user by name and asks how they are doing, using colors to enhance the output. + +CLS ' Clears the screen to provide a clean start for the program. + +' Prompt the user for their name and store it in a variable called userName$. +INPUT "Hi, what is your name: ", userName$ + +' Set the text color to a bright green (color code 10) for a pleasant visual effect. +COLOR 10 + +' Greet the user by printing "Hello" followed by their name and an exclamation mark. +PRINT "Hello " + userName$ + "!" + +' Ask the user how they are doing by appending their name to the question. +PRINT userName$ + ", how are you?" diff --git a/QBasic tutorial/Group 2/05.bas b/QBasic tutorial/Group 2/05.bas new file mode 100755 index 0000000..031f8d4 --- /dev/null +++ b/QBasic tutorial/Group 2/05.bas @@ -0,0 +1,52 @@ +CLS + +' This program creates a simple text-based box in the console window. +' The user specifies the horizontal and vertical size of the box within +' certain constraints to ensure it fits on the screen. + +' Prompt the user for the horizontal size of the box (between 2 and 79) +INPUT "Enter the Horizontal Size of the Box (2 to 79): ", hs + +' Validate the horizontal size input +WHILE hs < 2 OR hs > 79 + PRINT "Invalid input. Please enter a number between 2 and 79." + INPUT "Enter the Horizontal Size of the Box (2 to 79): ", hs +WEND + +' Prompt the user for the vertical size of the box (between 2 and 23) +INPUT "Enter the Vertical Size of the Box (2 to 23): ", vs + +' Validate the vertical size input +WHILE vs < 2 OR vs > 23 + PRINT "Invalid input. Please enter a number between 2 and 23." + INPUT "Enter the Vertical Size of the Box (2 to 23): ", vs +WEND + +' Draw the top line of the box +FOR i = 1 TO hs + PRINT "#"; +NEXT i +PRINT + +' Draw the middle section of the box +FOR y = 1 TO vs - 2 + ' Print the left side of the box + PRINT "#"; + + ' Print the interior of the box + FOR i = 1 TO hs - 2 + PRINT "."; + NEXT i + + ' Print the right side of the box + PRINT "#" +NEXT y + +' Draw the bottom line of the box +FOR i = 1 TO hs + PRINT "#"; +NEXT i +PRINT + +' The program has finished drawing the box and now ends +END diff --git a/QBasic tutorial/Group 2/07.bas b/QBasic tutorial/Group 2/07.bas new file mode 100755 index 0000000..afe3d37 --- /dev/null +++ b/QBasic tutorial/Group 2/07.bas @@ -0,0 +1,36 @@ +REM This program demonstrates basic input/output and conditional logic in QuickBasic. +REM It prompts the user to enter a number and then evaluates that number +REM with respect to the value 5 using various comparison operators. + +PRINT "Please enter a number:" +INPUT n + +REM Check if the number is less than 5 +IF n < 5 THEN + PRINT "The number you entered is smaller than 5." +END IF + +REM Check if the number is greater than 5 +IF n > 5 THEN + PRINT "The number you entered is greater than 5." +END IF + +REM Check if the number is exactly equal to 5 +IF n = 5 THEN + PRINT "The number you entered is equal to 5." +END IF + +REM Check if the number is less than or equal to 5 +IF n <= 5 THEN + PRINT "The number you entered is 5, or less." +END IF + +REM Check if the number is greater than or equal to 5 +IF n >= 5 THEN + PRINT "The number you entered is 5, or greater." +END IF + +REM Check if the number is not equal to 5 +IF n <> 5 THEN + PRINT "The number you entered is not 5." +END IF diff --git a/QBasic tutorial/Group 2/08.bas b/QBasic tutorial/Group 2/08.bas new file mode 100755 index 0000000..930bea8 --- /dev/null +++ b/QBasic tutorial/Group 2/08.bas @@ -0,0 +1,80 @@ +CLS + +' This program simulates a login prompt for a nuclear rocket control system. +' It asks the user to enter a password and checks if the entered password is correct. +' If the password is incorrect, it prompts the user again. + +' Define a constant for the correct password for better security practices +CONST CorrectPassword = "jerry" + +' Function to display the welcome message +SUB DisplayWelcomeMessage + LOCATE 1, 1 + COLOR 14 + PRINT " ========================================" + PRINT " Welcome to nuclear rocket control system" + PRINT " ========================================" +END SUB + +' Function to display the rocket artwork +SUB DisplayRocketArt + COLOR 10, 1 + PRINT "..............................................................." + PRINT ".....MMMMMM................MM...MMMMMMM.MMMMMM.MMM..MMMMMMM..MM" + PRINT "MMMMMMMMMMMMMMM...MM.M....MMMMM.MM.MMMMMMMMMMMMMMMMMMMMMMM.MM.." + PRINT ".MMMMMMMMMMM.M.....MMM...MM.....MMMMMMMMMMMMMMMMMMMMMM.M......." + PRINT "..MMMMMMMMMMMM..............MMMMMMMMMMMMMMMMMMMMMMMMMM..M ....." + PRINT "....MMMMMMMM...............MMMM..MMMMM.MMMMMMMMMMMMM.MM........" + PRINT ".....MMMMMMM.............MMMMMMMM..MMM..MMMMMM.MMMMM.M........." + PRINT "........MM...............MMMMMMMMMM.M.....MM...........M......." + PRINT "......MMMMMM................MMMMMMM....................M......." + PRINT ".....MMMMMMMM.................MMMMMM....................MMM...." + PRINT "......MMMMMMM.................MMMMM...................MMMMMM..." + PRINT "........MMMMMM..................MM....................MMMMMMM.." + PRINT "..........MMMMM ...........................................MM.." +END SUB + +' Function to play a simple tune +SUB PlayTune + FOR a = 9 TO 23 + SOUND 1.5 ^ a, 3 + NEXT a +END SUB + +' Main program execution starts here +DO + ' Clear the screen and prompt the user for the password + CLS + COLOR 7 + PRINT "Enter password: "; + + ' Temporarily set text color to black to hide the password input + COLOR 0 + INPUT "", UserPassword$ + + ' Restore original text color + COLOR 7 +LOOP UNTIL UserPassword$ = CorrectPassword + +' Clear the screen for the welcome message +CLS + +' Call the function to display the welcome message +DisplayWelcomeMessage + +' Call the function to display the rocket artwork +DisplayRocketArt + +' Locate and display our location with a special color +LOCATE 7, 34 +COLOR 12 + 16 +PRINT "*" + +' Play the simple tune using the sound command +PlayTune + +' Restore default text color +COLOR 7, 0 + +' End of the program +END diff --git a/QBasic tutorial/Group 2/09.bas b/QBasic tutorial/Group 2/09.bas new file mode 100755 index 0000000..2e99357 --- /dev/null +++ b/QBasic tutorial/Group 2/09.bas @@ -0,0 +1,21 @@ +' This program demonstrates the use of string manipulation functions +' in Microsoft QuickBasic. It shows how to extract substrings from a +' given string using the LEFT$ and RIGHT$ functions. + +DEFSTR A-Z ' Define all variables as strings to avoid type mismatches + +' Initialize a string variable with the value "software" +SoftwareName$ = "software" + +' Print the full name of the software +PRINT "Full software name: "; SoftwareName$ + +' Extract and print the first four characters from the left of the string +LEFTPart$ = LEFT$(SoftwareName$, 4) ' Get the leftmost substring +PRINT "Left part (first 4 characters): "; LEFTPart$ + +' Extract and print the last four characters from the right of the string +RIGHTPart$ = RIGHT$(SoftwareName$, 4) ' Get the rightmost substring +PRINT "Right part (last 4 characters): "; RIGHTPart$ + +END ' End of program diff --git a/QBasic tutorial/Group 2/10.bas b/QBasic tutorial/Group 2/10.bas new file mode 100755 index 0000000..5df3e41 --- /dev/null +++ b/QBasic tutorial/Group 2/10.bas @@ -0,0 +1,37 @@ +CLS + +' This program demonstrates basic user input and string manipulation in QuickBasic. + +' Prompt the user to enter some text and store it in a variable called 'userInput$'. +INPUT "Enter some text: ", userInput$ + +' Print the text that the user entered in three different ways: +' 1. Concatenating the prompt with the entered text using the '+' operator. +' 2. Using a comma to separate the prompt from the entered text, which is more efficient. +' 3. Using a colon to print on the same line without a space between the prompt and the input. +PRINT "You entered: " + userInput$ + +' Calculate the length of the entered text using the LEN function. +' Then, print out the length, formatting it as a sentence. +PRINT "Its length is" + STR$(LEN(userInput$)) + " characters." + +' Use a FOR loop to iterate from 1 to the length of the user input. +' In each iteration, extract a substring from the left using the LEFT$ function +' and print it to demonstrate string extraction from the beginning. +FOR index = 1 TO LEN(userInput$) + PRINT "Leftmost " + STR$(index) + " character(s): " + LEFT$(userInput$, index) +NEXT index + +' Print a blank line for better readability of the output. +PRINT + +' Similar to the previous loop, but now we use the RIGHT$ function to extract +' substrings from the right end of the user input, demonstrating string extraction +' from the end of the string. +FOR index = 1 TO LEN(userInput$) + PRINT "Rightmost " + STR$(index) + " character(s): " + RIGHT$(userInput$, index) +NEXT index + +' End of the program. +END + diff --git a/QBasic tutorial/Group 2/12.bas b/QBasic tutorial/Group 2/12.bas new file mode 100755 index 0000000..28b738d --- /dev/null +++ b/QBasic tutorial/Group 2/12.bas @@ -0,0 +1,45 @@ +' This program demonstrates the basics of animation and control flow in QuickBasic. +' It shows a simple text bouncing up and down on the screen, simulating a "jumping" effect. + +' Declare variables with descriptive names to hold the position and movement direction +DIM yPosition AS INTEGER ' Current vertical position of the text +DIM ySpeed AS INTEGER ' Vertical speed (or direction) of the text + +' Initialize the starting position and speed +yPosition = 10 +ySpeed = 1 + +' Main animation loop +DO + ' Clear the screen before drawing the next frame + CLS + + ' Update the vertical position based on the current speed + yPosition = yPosition + ySpeed + + ' Check if the text has hit the top boundary and change direction if it has + IF yPosition > 20 THEN + ySpeed = -1 + ENDIF + + ' Check if the text has hit the bottom boundary and change direction if it has + IF yPosition < 2 THEN + ySpeed = 1 + ENDIF + + ' Set the cursor position to the current vertical position + LOCATE yPosition + + ' Print the "jumping" text at the new position + PRINT "This is jumping text"; + + ' Play a sound with a frequency that varies based on the vertical position + ' The frequency is calculated to give an audible effect as the text jumps + SOUND yPosition * 200 + 100, 1 + + ' Pause briefly before drawing the next frame (adjust this value for faster or slower animation) + DELAY 0.1 +LOOP + +' Note: The program will run indefinitely due to the DO LOOP structure. +' To stop the program, you can press Ctrl+Break on most systems. diff --git a/QBasic tutorial/Group 2/13.bas b/QBasic tutorial/Group 2/13.bas new file mode 100755 index 0000000..c7c507a --- /dev/null +++ b/QBasic tutorial/Group 2/13.bas @@ -0,0 +1,54 @@ +' This program demonstrates basic animation and boundary checking in QuickBasic. +' It simulates a simple ball bouncing around the screen. + +CLS ' Clear the screen before starting the animation + +' Initialize variables representing the ball's position and velocity +DIM x AS INTEGER ' Ball's X coordinate +DIM y AS INTEGER ' Ball's Y coordinate +DIM xs AS INTEGER ' Ball's speed in the X direction +DIM ys AS INTEGER ' Ball's speed in the Y direction + +x = 12 ' Initial X position of the ball +y = 7 ' Initial Y position of the ball +xs = 1 ' Initial velocity in the X direction (rightward) +ys = 1 ' Initial velocity in the Y direction (downward) + +' Main animation loop +DO + ' Erase the ball at its current position by printing a space + LOCATE y, x: PRINT " "; + + ' Update the ball's position based on its velocities + x = x + xs + y = y + ys + + ' Draw the ball at its new position + LOCATE y, x: PRINT "O"; + + ' Check if the ball hits the right or left boundaries and reverse X velocity + IF x >= 79 THEN + xs = -1 + SOUND 1000, 1 ' Play a sound when hitting the boundary + END IF + IF x <= 1 THEN + xs = 1 + SOUND 1000, 1 ' Play a sound when hitting the boundary + END IF + + ' Check if the ball hits the bottom or top boundaries and reverse Y velocity + IF y >= 22 THEN + ys = -1 + SOUND 1000, 1 ' Play a sound when hitting the boundary + END IF + IF y <= 1 THEN + ys = 1 + SOUND 1000, 1 ' Play a sound when hitting the boundary + END IF + + ' Pause briefly to control the speed of the animation + SOUND 0, 1 +LOOP + +' The program will continue running indefinitely, creating an animated bouncing ball effect + diff --git a/QBasic tutorial/Group 2/14.bas b/QBasic tutorial/Group 2/14.bas new file mode 100755 index 0000000..4a0f1f9 --- /dev/null +++ b/QBasic tutorial/Group 2/14.bas @@ -0,0 +1,54 @@ +' This program demonstrates how to use the SOUND statement in QuickBasic +' to produce different tones when pressing keys "0" through "9". +' It also shows how to exit the program by pressing the Escape key. + +CLS +PRINT "Press keys '0'-'9' for different sounds." +PRINT "Press Esc to exit the program." + +' Start an infinite loop to continuously check for user input +DO + ' Read a single character from the keyboard + a$ = INPUT$(1) + + ' Play a sound corresponding to the key pressed + SELECT CASE a$ + CASE "0" + ' Generate a low-pitched tone + SOUND 1900, 2 + CASE "1" + ' Generate a slightly higher pitched tone + SOUND 1000, 2 + CASE "2" + ' Generate a tone with a frequency of 1100 Hz + SOUND 1100, 2 + CASE "3" + ' Generate a tone with a frequency of 1200 Hz + SOUND 1200, 2 + CASE "4" + ' Generate a tone with a frequency of 1300 Hz + SOUND 1300, 2 + CASE "5" + ' Generate a tone with a frequency of 1400 Hz + SOUND 1400, 2 + CASE "6" + ' Generate a tone with a frequency of 1500 Hz + SOUND 1500, 2 + CASE "7" + ' Generate a high-pitched tone + SOUND 1600, 2 + CASE "8" + ' Generate a very high-pitched tone + SOUND 1700, 2 + CASE "9" + ' Generate the highest pitched tone available + SOUND 1800, 2 + CASE CHR$(27) + ' Check if the Escape key is pressed to exit the program + SYSTEM + CASE ELSE + ' If any other key is pressed, do nothing + END SELECT + + ' Loop indefinitely until the user decides to exit +LOOP diff --git a/QBasic tutorial/Group 2/15.bas b/QBasic tutorial/Group 2/15.bas new file mode 100755 index 0000000..0f8b2b8 --- /dev/null +++ b/QBasic tutorial/Group 2/15.bas @@ -0,0 +1,26 @@ +' This program demonstrates how to use a FOR loop and the CHR$ function +' in QuickBasic to print out characters from the ASCII table. + +CLS ' Clears the screen before printing + +' The FOR loop iterates over ASCII values starting from 32 (space character) +' up to 255, which is beyond the standard ASCII range but includes extended +' ASCII characters in QuickBasic. +FOR a = 32 TO 255 + ' CHR$ function converts an ASCII value to its corresponding character + PRINT " " + CHR$(a); ' Prints each character with a leading space for readability +NEXT a + +' Print two new lines to separate the ASCII table from the greeting message +PRINT +PRINT + +' Greet the user in a friendly manner +' The CHR$(1) represents the Start of Header (SOH) control character, which is +' typically not visible and may be interpreted differently depending on the +' environment. It is used here for demonstration purposes to show how +' non-printable characters can be included in strings. +PRINT "Hi there! " + CHR$(1) + +' End of the program +END diff --git a/QBasic tutorial/Group 2/16.bas b/QBasic tutorial/Group 2/16.bas new file mode 100755 index 0000000..3ff22a5 --- /dev/null +++ b/QBasic tutorial/Group 2/16.bas @@ -0,0 +1,40 @@ +' This program demonstrates how to capture and process keyboard input in QuickBASIC. +' It listens for a key press, then prints out the character and its ASCII code. +' Special keys like Escape, Enter, Backspace, Tabulator, and Space are given custom names. + +CLS ' Clears the screen before starting the program +PRINT "Press any key..." ' Prompts the user to press a key + +' Main loop starts here +DO + ' Capture a single character of input from the user + a$ = INPUT$(1) + + ' Print the pressed key, if it is a printable character (ASCII code > 32) + PRINT "Pressed key was: "; + IF ASC(a$) > 32 THEN + PRINT a$ + END IF + + ' Check for special keys and print their names + SELECT CASE ASC(a$) + CASE 27 ' ASCII code for Escape key + PRINT "Escape" + CASE 13 ' ASCII code for Enter key + PRINT "Enter" + CASE 8 ' ASCII code for Backspace key + PRINT "Backspace" + CASE 9 ' ASCII code for Tabulator key + PRINT "Tabulator" + CASE 32 ' ASCII code for Space key + PRINT "Space" + CASE ELSE + ' If the key is not special, print its ASCII character + IF ASC(a$) > 32 THEN + PRINT a$ + END IF + END SELECT + + ' Print the ASCII code of the pressed key + PRINT "ASCII code is: "; ASC(a$) +LOOP ' Continue listening for more key presses diff --git a/QBasic tutorial/Group 2/17.bas b/QBasic tutorial/Group 2/17.bas new file mode 100755 index 0000000..899390e --- /dev/null +++ b/QBasic tutorial/Group 2/17.bas @@ -0,0 +1,58 @@ +' This program demonstrates how to handle keyboard input in QuickBasic +' and move a character around the screen using the numeric keypad. + +CLS + +' Inform the user about the controls and how to exit the program +PRINT "Use keys 4, 8, 6, 2 for movement, make sure the NumLock is on" +PRINT "ESC to exit" + +' Clear a line for better visibility +PRINT " " + +' Wait for the user to press any key to start +PRINT "Press any key to continue..." +a$ = INPUT$(1) + +' Set the text color to bright yellow +COLOR 14 + +' Initialize the starting position of the character +x = 40 +y = 10 + +' Main loop for handling input and drawing the character +DO + CLS ' Clear the screen before redrawing + + ' Set the cursor position to the current character coordinates + LOCATE y, x + + ' Print the character at the current position + PRINT CHR$(2); ' The semicolon prevents moving to the next line + + ' Read a single character of input without waiting + a$ = INPUT$(1) + + ' Check for movement inputs and update the character's position + SELECT CASE a$ + CASE "4" ' Left arrow + x = x - 1 + CASE "6" ' Right arrow + x = x + 1 + CASE "8" ' Up arrow + y = y - 1 + CASE "2" ' Down arrow + y = y + 1 + CASE CHR$(27) ' Escape key + ' Exit the program + SYSTEM + END SELECT + + ' Prevent the character from going off-screen + IF x < 1 THEN x = 1 + IF x > 80 THEN x = 80 + IF y < 1 THEN y = 1 + IF y > 25 THEN y = 25 + +LOOP ' Continue the main loop indefinitely diff --git a/QBasic tutorial/Group 2/18.bas b/QBasic tutorial/Group 2/18.bas new file mode 100755 index 0000000..9700d82 --- /dev/null +++ b/QBasic tutorial/Group 2/18.bas @@ -0,0 +1,56 @@ +CLS + +' Main program loop starts here +DO + ' Clear the screen and print the menu options + CLS + PRINT "******** Select action: ********" + PRINT " " + PRINT "1 - Exit program" + PRINT "2 - Make a sound" + PRINT "3 - Draw a box" + + ' Prompt the user to enter their choice and store it in variable 'userChoice' + INPUT "Enter your choice (1-3): ", userChoice + + ' Exit the program if the user chooses option 1 + IF userChoice = 1 THEN + PRINT "Exiting program..." + EXIT DO + END IF + + ' Play a sound if the user chooses option 2 + IF userChoice = 2 THEN + ' Generate a sound with a frequency of 2000 Hz for 2 seconds + SOUND 2000, 2 + + ' Draw a box if the user chooses option 3 + ELSEIF userChoice = 3 THEN + ' Outer loop to draw the top and bottom edges of the box + FOR row = 1 TO 15 + ' Inner loop to draw the left and right edges of the box + FOR col = 1 TO 50 + PRINT "#"; + NEXT col + ' Move to the next line after drawing each row + PRINT + NEXT row + + ' Inform the user if they have entered a number greater than 3 + ELSEIF userChoice > 3 THEN + PRINT "Number too large. Please enter a value between 1 and 3." + + ' Inform the user if they have entered a number less than 1 + ELSEIF userChoice < 1 THEN + PRINT "Number too small. Please enter a value between 1 and 3." + END IF + + ' Wait for the user to press a key before continuing + PRINT "Press any key to continue..." + WHILE INKEY$ = "" + ' Do nothing, just wait for a key press + WEND + +LOOP WHILE TRUE + +' End of program diff --git a/QBasic tutorial/Group 3/00.bas b/QBasic tutorial/Group 3/00.bas new file mode 100755 index 0000000..91414f8 --- /dev/null +++ b/QBasic tutorial/Group 3/00.bas @@ -0,0 +1,7 @@ +SCREEN 13 ' set video mode 320 x 200 256 colors + +PRINT "Hello..." + +PSET (160, 100), 10 ' draws a point + ' x=160 y=100 color=10 + diff --git a/QBasic tutorial/Group 3/01.bas b/QBasic tutorial/Group 3/01.bas new file mode 100755 index 0000000..938bc41 --- /dev/null +++ b/QBasic tutorial/Group 3/01.bas @@ -0,0 +1,9 @@ +SCREEN 13 + +FOR y = 50 TO 150 + FOR x = 100 TO 200 + PSET (x, y), 10 + NEXT x + SOUND y, 1 +NEXT y + diff --git a/QBasic tutorial/Group 3/02.bas b/QBasic tutorial/Group 3/02.bas new file mode 100755 index 0000000..11df674 --- /dev/null +++ b/QBasic tutorial/Group 3/02.bas @@ -0,0 +1,25 @@ +DECLARE SUB box (x1!, y1!, x2!, y2!, c!) + +' Press F2 to see submodules +' Nazmi F2 xtob uvidet SUB moduli +' Vajuta F2 et n„ha SUB mooduleid + + +SCREEN 13 + +box 10, 10, 100, 100, 15 + +box 30, 80, 300, 120, 11 + +box 140, 20, 180, 180, 10 + +SUB box (x1, y1, x2, y2, c) + +FOR y = y1 TO y2 + FOR x = x1 TO x2 + PSET (x, y), c + NEXT x +NEXT y + +END SUB + diff --git a/QBasic tutorial/Group 3/03.bas b/QBasic tutorial/Group 3/03.bas new file mode 100755 index 0000000..8ddb8b2 --- /dev/null +++ b/QBasic tutorial/Group 3/03.bas @@ -0,0 +1,6 @@ +SCREEN 13 + +LINE (10, 10)-(200, 100), 14 + +CIRCLE (100, 100), 80, 10 + diff --git a/QBasic tutorial/Group 3/04.bas b/QBasic tutorial/Group 3/04.bas new file mode 100755 index 0000000..a806541 --- /dev/null +++ b/QBasic tutorial/Group 3/04.bas @@ -0,0 +1,8 @@ +SCREEN 13 + +LINE (10, 10)-(50, 50), 14 ' line + +LINE (100, 10)-(150, 50), 14, B ' box + +LINE (200, 10)-(250, 50), 14, BF ' filled box + diff --git a/QBasic tutorial/Group 3/05.bas b/QBasic tutorial/Group 3/05.bas new file mode 100755 index 0000000..3e87408 --- /dev/null +++ b/QBasic tutorial/Group 3/05.bas @@ -0,0 +1,6 @@ +SCREEN 13 + +FOR x = 0 TO 255 + LINE (x, 50)-(x, 100), x +NEXT x + diff --git a/QBasic tutorial/Group 3/06.bas b/QBasic tutorial/Group 3/06.bas new file mode 100755 index 0000000..5bb13d3 --- /dev/null +++ b/QBasic tutorial/Group 3/06.bas @@ -0,0 +1,12 @@ +SCREEN 13 + + +CIRCLE (160, 100), 80, 15 +LINE (100, 10)-(200, 180), 15 + +PRINT "press any key..." + +a$ = INPUT$(1) + +PAINT (180, 100), 15 + diff --git a/QBasic tutorial/Group 3/07.bas b/QBasic tutorial/Group 3/07.bas new file mode 100755 index 0000000..3c7ba6c --- /dev/null +++ b/QBasic tutorial/Group 3/07.bas @@ -0,0 +1,23 @@ +DECLARE SUB sihik (x!, y!) +SCREEN 13 + +' Press F2 to see submodules list +' Vajuta F2 at n„ha sub moodulite listi +' nazmi F2 xtobe uvidjet sub spisok sub modulei + + +sihik 100, 100 +sihik 200, 50 +sihik 180, 150 + +SUB sihik (x, y) + +CIRCLE (x, y), 10, 15 +CIRCLE (x, y), 20, 15 +CIRCLE (x, y), 30, 15 + +LINE (x, y - 50)-(x, y + 50), 15 +LINE (x - 50, y)-(x + 50, y), 15 + +END SUB + diff --git a/QBasic tutorial/Group 3/08.bas b/QBasic tutorial/Group 3/08.bas new file mode 100755 index 0000000..deff209 --- /dev/null +++ b/QBasic tutorial/Group 3/08.bas @@ -0,0 +1,13 @@ +SCREEN 13 + + +FOR x = 0 TO 319 + + y = SIN(x / 10) * 50 + 100 + PSET (x, y), 14 + + y = COS(x / 10) * 50 + 100 + PSET (x, y), 12 + +NEXT x + diff --git a/QBasic tutorial/Group 3/09.bas b/QBasic tutorial/Group 3/09.bas new file mode 100755 index 0000000..eaea7f8 --- /dev/null +++ b/QBasic tutorial/Group 3/09.bas @@ -0,0 +1,13 @@ +SCREEN 13 + +pi = 3.14 +mi = 7 ' amount of points on circular shape + +FOR a = 0 TO pi * 2 STEP pi * 2 / mi + + x = SIN(a) * 50 + 100 + y = COS(a) * 50 + 100 + PSET (x, y), 10 + +NEXT a + diff --git a/QBasic tutorial/Group 3/10.bas b/QBasic tutorial/Group 3/10.bas new file mode 100755 index 0000000..fc4f497 --- /dev/null +++ b/QBasic tutorial/Group 3/10.bas @@ -0,0 +1,21 @@ +SCREEN 13 + +FOR i = 0 TO 320 STEP 10 + LINE (0, i)-(319, i), 5 + LINE (i, 0)-(i, 199), 5 +NEXT i + +LINE (0, 100)-(319, 100), 10 + +PRINT "press a key..." +a$ = INPUT$(1) + +y = 100 +ys = -1 +FOR t = 0 TO 300 + PSET (t, y), 14 + ys = ys + .01 + y = y + ys + SOUND 300 - y, .1 +NEXT t + diff --git a/QBasic tutorial/Group 3/11.bas b/QBasic tutorial/Group 3/11.bas new file mode 100755 index 0000000..c4e4c5a --- /dev/null +++ b/QBasic tutorial/Group 3/11.bas @@ -0,0 +1,10 @@ +CLS + +a = -12.7 + +PRINT "normal: ", a +PRINT "rounded: ", INT(a) +PRINT "absolute: ", ABS(a) + +PRINT "reminder of 10 / 4 is: ", 10 MOD 4 + diff --git a/QBasic tutorial/group1/00.bas b/QBasic tutorial/group1/00.bas deleted file mode 100755 index fc62f12..0000000 --- a/QBasic tutorial/group1/00.bas +++ /dev/null @@ -1,10 +0,0 @@ -' This program demonstrates a basic "Hello World" example in QuickBasic. -' It is designed to be simple and easy to understand for novice programmers. - -' The following line prints a greeting message to the console. -PRINT "Hello world!" - -' When you run this program, it will output the string "Hello world!" to the screen. -' This is a traditional first step in learning any new programming language. - -' To execute this program, press F5 while in the QuickBasic editor environment. diff --git a/QBasic tutorial/group1/01.bas b/QBasic tutorial/group1/01.bas deleted file mode 100755 index 0760259..0000000 --- a/QBasic tutorial/group1/01.bas +++ /dev/null @@ -1,24 +0,0 @@ -' This QuickBasic program demonstrates basic arithmetic operations -' and the use of variables. It will perform a series of calculations -' on a single variable and print the results after each operation. - -CLS ' Clears the screen to provide a clean output area - -' Initialize a variable with the value 3 -DIM initialValue AS INTEGER -initialValue = 3 - -' Print the current value of initialValue -PRINT "The initial value is: "; initialValue - -' Perform multiplication and assign the result back to initialValue -initialValue = initialValue * 2 - -' Print the new value after multiplication -PRINT "After doubling, the value is: "; initialValue - -' Perform subtraction and decrease initialValue by 1 -initialValue = initialValue - 1 - -' Print the final value after subtraction -PRINT "After decrementing by 1, the value is: "; initialValue diff --git a/QBasic tutorial/group1/02.bas b/QBasic tutorial/group1/02.bas deleted file mode 100755 index ccf5019..0000000 --- a/QBasic tutorial/group1/02.bas +++ /dev/null @@ -1,21 +0,0 @@ -' This program demonstrates basic arithmetic operations in QuickBasic - -CLS ' Clears the screen to provide a clean output area - -' Declare a variable 'a' and assign it the value of 7 -DIM a AS INTEGER -a = 7 - -' Print the current value of 'a' to the console -PRINT "The value contained in variable 'a' is: "; a - -' Perform a series of arithmetic operations on the value of 'a' -' and print the result -PRINT "Performing some calculations with 'a':"; -PRINT (a + 2.1234) / 3 * 4 - 6 - -' Explanation of the calculation: -' 1. Add 2.1234 to 'a' -' 2. Divide the result by 3 -' 3. Multiply the new result by 4 -' 4. Subtract 6 from the final result diff --git a/QBasic tutorial/group1/03.bas b/QBasic tutorial/group1/03.bas deleted file mode 100755 index 6f6cebe..0000000 --- a/QBasic tutorial/group1/03.bas +++ /dev/null @@ -1,34 +0,0 @@ -' This program demonstrates how to use semicolon and comma as separators -' in PRINT statements within Microsoft QuickBasic. - -CLS ' Clears the screen before starting the program - -' Semicolon Separator Example - -' The semicolon is used to print multiple items on the same line, without -' advancing to a new line after each item. It is useful for formatting output -' in a single line of text. - -PRINT "Semicolon separator:" -PRINT 12; 314; 122; 1; 43 ' Prints numbers separated by semicolons on the same line -PRINT 312; 4; 1; 3111; 3 ' Continues printing more numbers on the next line -PRINT 3; 2344; 12231; 1; 12333 ' Final set of numbers printed on the last line - -' Print an empty line for better readability -PRINT ' This statement prints an empty line to separate different sections - -' Comma Separator Example - -' The comma is used as a separator in PRINT statements to print multiple items, -' each followed by a space and advancing to the next tab column (default is 14 -' characters apart). If there are more items than columns, it will start -' a new line. - -PRINT "Comma separator:" -PRINT 12, 314, 122, 1, 43 ' Prints numbers separated by commas, with spacing -PRINT 312, 4, 1, 3111, 3 ' Numbers are printed in tabular form -PRINT 3, 2344, 12231, 1, 12333 ' Continues the tabular output - -' End of program -END ' This statement marks the end of the QuickBasic program - diff --git a/QBasic tutorial/group1/04.bas b/QBasic tutorial/group1/04.bas deleted file mode 100755 index dd1a43d..0000000 --- a/QBasic tutorial/group1/04.bas +++ /dev/null @@ -1,17 +0,0 @@ -' This program prompts the user to enter a number and then prints that number back to the screen. -' It demonstrates basic input/output operations in QuickBasic. - -DEFINT A-Z ' Declare all variables as integers for simplicity - -' Declare a variable to store the user's input -DIM num AS INTEGER - -' Use the INPUT statement to prompt the user and read their input -PRINT "Please enter a number:"; -INPUT num - -' Print a message to the screen along with the entered number -PRINT "You entered: "; num - -' End of program -END diff --git a/QBasic tutorial/group1/05.bas b/QBasic tutorial/group1/05.bas deleted file mode 100755 index 5d56b0c..0000000 --- a/QBasic tutorial/group1/05.bas +++ /dev/null @@ -1,26 +0,0 @@ -REM **** Guess a Number Game **** - -DEFINT A-Z ' Define all variables as integers for performance and clarity - -' Main game loop -DO - ' Prompt the user to enter a number - INPUT "Enter a number between 1 and 10: "; guess - - ' Check if the user guessed the correct number - IF guess = 5 THEN - ' If the guess is correct, congratulate the user and exit the loop - PRINT "Correct!!! You've guessed the secret number." - EXIT DO - ELSEIF guess < 5 THEN - ' If the guess is too low, prompt the user to try a higher number - PRINT "Try a bigger number." - ELSEIF guess > 5 THEN - ' If the guess is too high, prompt the user to try a lower number - PRINT "Try a smaller number." - END IF -LOOP - -' End of the program -PRINT "Thank you for playing! Goodbye." -END diff --git a/QBasic tutorial/group1/06.bas b/QBasic tutorial/group1/06.bas deleted file mode 100755 index 4237cf8..0000000 --- a/QBasic tutorial/group1/06.bas +++ /dev/null @@ -1,22 +0,0 @@ -CLS ' Clear the screen - -' This program demonstrates a simple counting loop in QuickBasic. -' It will print the current value of 'a' and increment it by 1 each time. -' The loop continues until 'a' is no longer less than 10. - -DIM a AS INTEGER ' Declare variable 'a' as an integer - -' Initialize the counter variable 'a' to start at 1 -a = 1 - -' Start of the counting loop -DO WHILE a < 10 - ' Print the current value of 'a' with a label - PRINT "current:"; a - - ' Increment 'a' by 1 - a = a + 1 -LOOP - -' The program will end after the loop finishes -END diff --git a/QBasic tutorial/group1/07.bas b/QBasic tutorial/group1/07.bas deleted file mode 100755 index 9bb214b..0000000 --- a/QBasic tutorial/group1/07.bas +++ /dev/null @@ -1,12 +0,0 @@ -' This program demonstrates a simple FOR loop in Microsoft QuickBasic - -CLS ' Clears the screen, preparing it for output - -' We are about to use a FOR loop to print numbers from 1 to 10 -FOR i = 1 TO 10 ' Initialize a counter variable 'i' starting at 1 - ' For each iteration of the loop, print the current value of 'i' - PRINT "current: "; i ' Outputs the message with the current number -NEXT i ' Increment 'i' by 1 and repeat the loop until 'i' is no longer less than or equal to 10 - -' The program has now finished executing and will end -END ' This marks the end of the QuickBasic program diff --git a/QBasic tutorial/group1/08.bas b/QBasic tutorial/group1/08.bas deleted file mode 100755 index 8df64b6..0000000 --- a/QBasic tutorial/group1/08.bas +++ /dev/null @@ -1,23 +0,0 @@ -' This program demonstrates how to use a FOR loop and the SOUND statement -' in QuickBasic. It plays a series of tones at increasing frequencies -' from 100 Hz to 1000 Hz, in steps of 50 Hz, with each tone lasting for -' one duration unit as defined by the SOUND statement. - -CLS ' Clears the screen before starting the program - -' Initialize the frequency variable to the starting value -LET frequency = 100 - -' Loop from the initial frequency (100 Hz) to the maximum frequency (1000 Hz), -' increasing by 50 Hz on each iteration -FOR frequency = 100 TO 1000 STEP 50 - ' Print the current frequency value to the console - PRINT "Current Frequency:"; frequency; " Hz" - - ' Play a sound at the specified frequency and duration - ' The SOUND statement takes two arguments: frequency and duration - SOUND frequency, 1 ' The duration is set to 1 (shortest possible sound) -NEXT frequency - -' End of program execution -END diff --git a/QBasic tutorial/group1/09.bas b/QBasic tutorial/group1/09.bas deleted file mode 100755 index 1b96f04..0000000 --- a/QBasic tutorial/group1/09.bas +++ /dev/null @@ -1,22 +0,0 @@ -REM This program demonstrates how to generate random numbers -REM and use them to create sound effects in QuickBasic. - -CLS ' Clear the screen before starting the program - -' Define constants for the range of random numbers -FOR i = 1 TO 20 ' Loop 20 times to generate and play 20 random sounds - ' Generate a random floating-point number between LOWER_BOUND and UPPER_BOUND - n = RND * 1000 - ' Print the generated random number to the screen - PRINT "Random number: "; n - - ' Play a sound with a frequency based on the random number - ' The QuickBasic SOUND statement takes two arguments: frequency and duration - ' We add 40 to the random number to shift the frequency range - ' so that it is more audible - SOUND n + 40, 1 ' Play the sound for a short duration (1/89th of a second) - -NEXT i - -END ' End the program - diff --git a/QBasic tutorial/group1/10.bas b/QBasic tutorial/group1/10.bas deleted file mode 100755 index ab4120b..0000000 --- a/QBasic tutorial/group1/10.bas +++ /dev/null @@ -1,25 +0,0 @@ -' This example program demonstrates how to use the WIDTH and COLOR -' statements in QuickBasic to change the text font size and text colors. - -' Set the text window to a smaller font size suitable for displaying -' 50 lines of text within an 80-column width. -WIDTH 80, 50 - -' Define constants for the number of colors available in standard -' QuickBasic color palette. -CONST NumColors = 32 - -' Loop through all possible colors (0 to 31) and display a message -' with each color to illustrate the different text color options. -FOR colorIndex = 0 TO NumColors - 1 - ' Set the current text color using the COLOR statement. - ' Colors range from 0 to 15 are solid, while colors 16 to 31 - ' will blink slowly or quickly depending on the terminal. - COLOR colorIndex - - ' Print a message indicating which color number is currently being used. - ' Note that color numbers 16 and above will produce blinking text. - PRINT "This is text color number "; colorIndex; "." - -NEXT colorIndex - diff --git a/QBasic tutorial/group1/11.bas b/QBasic tutorial/group1/11.bas deleted file mode 100755 index e6f69e6..0000000 --- a/QBasic tutorial/group1/11.bas +++ /dev/null @@ -1,27 +0,0 @@ -' This program demonstrates how to use the COLOR statement and LOCATE function -' in Microsoft QuickBasic to change the text color and cursor position -' on the console screen. - -CLS ' Clears the screen before starting - -' Set the text color to yellow (color code 14) and position the cursor -' at row 1, column 50. Then print a message at that location. -COLOR 14 -LOCATE 1, 50 ' Sets the cursor location to -PRINT "Yellow text at 1, 50" - -' Change the text color to pink (color code 12) and move the cursor -' to row 6, column 5. Print a message with the new color and position. -COLOR 12 -LOCATE 6, 5 ' Sets the cursor location to -PRINT "Pink text at 6, 5" - -' Update the text color to green (color code 10) and set the cursor -' to row 20, column 40. Display a message at this new location. -COLOR 10 -LOCATE 20, 40 ' Sets the cursor location to -PRINT "Green text at 20, 40" - -' The program finishes execution here. Users can add more statements -' below this line to experiment with different colors and positions. -END ' End of the program diff --git a/QBasic tutorial/group1/12.bas b/QBasic tutorial/group1/12.bas deleted file mode 100755 index 3aa9c36..0000000 --- a/QBasic tutorial/group1/12.bas +++ /dev/null @@ -1,24 +0,0 @@ -' This program demonstrates the use of FOR loops, color manipulation, -' and string output in QuickBasic. It also shows how to prevent the -' cursor from moving to a new line after printing a string. - -CLS ' Clears the screen before starting the program - -' The first loop demonstrates changing text colors using the COLOR statement -' inside a FOR loop, which iterates from 1 to 15 (the number of available -' color attributes in QuickBasic). -FOR ColorIndex = 1 TO 15 - COLOR ColorIndex ' Set the current text color to the loop index - PRINT "This is a test" ' Print the string with the new color -NEXT ColorIndex - -PRINT ' Print a blank line for better readability - -' The second loop does the same as the first one, but it uses a semicolon -' at the end of the PRINT statement to prevent the cursor from moving -' to the start of a new line after each string output. This results in -' all strings being printed on the same line. -FOR ColorIndex = 1 TO 15 - COLOR ColorIndex ' Change the text color for each iteration - PRINT "This is a test"; ' Print the string and keep the cursor on the same line -NEXT ColorIndex diff --git a/QBasic tutorial/group1/13.bas b/QBasic tutorial/group1/13.bas deleted file mode 100755 index c778556..0000000 --- a/QBasic tutorial/group1/13.bas +++ /dev/null @@ -1,19 +0,0 @@ -' This example QuickBasic program demonstrates the difference between -' normal division and integer division with rounding. - -CLS ' Clears the screen to provide a clean output area - -' Perform normal division which results in a floating-point number -' and print the result -PRINT "Normal division (70 / 4):"; 70 / 4 - -' Explain the use of backslash (\) for integer division with rounding -' Perform integer division with rounding and print the result -PRINT "Integer division with rounding (70 \ 4):"; 70 \ 4 - -' Provide a brief conclusion to summarize what was demonstrated -PRINT -PRINT "In QuickBasic, '/' performs normal division, while '\' does integer division" -PRINT "and rounds the result to the nearest whole number." - -END ' End of program diff --git a/QBasic tutorial/group1/15.bas b/QBasic tutorial/group1/15.bas deleted file mode 100755 index 242c221..0000000 --- a/QBasic tutorial/group1/15.bas +++ /dev/null @@ -1,18 +0,0 @@ -' This program demonstrates the use of nested FOR loops in QuickBasic -' to draw a simple pattern on the screen. - -CLS ' Clears the screen and prepares for output - -' Outer loop will run 15 times, representing rows -FOR row = 1 TO 15 - - ' Inner loop will run 60 times, representing columns within each row - FOR column = 1 TO 60 - PRINT "#"; ' Print a '#' character followed by no space to create a continuous line - NEXT column - - ' After completing one row, print a newline character to move to the next line - PRINT - -NEXT row - diff --git a/QBasic tutorial/group1/16.bas b/QBasic tutorial/group1/16.bas deleted file mode 100755 index 71f1eaf..0000000 --- a/QBasic tutorial/group1/16.bas +++ /dev/null @@ -1,34 +0,0 @@ -' QuickBasic example program to demonstrate the use of nested loops -' and how to control the flow of a loop using the STEP keyword. - -CLS ' Clears the screen before starting the program - -' This outer loop will iterate from 1 to 10 -FOR b = 1 TO 10 - ' The inner loop will print "A" b times, where b is the current - ' value of the outer loop iterator - FOR a = 1 TO b - PRINT "A"; ' Print "A" followed by a semicolon to prevent newline - NEXT a - - ' After each inner loop iteration, print a newline to start the next line - PRINT -NEXT b - -' Print a blank line to separate the two parts of the demonstration -PRINT - -' This outer loop will iterate from 60 to 0, decrementing by 8 each time -FOR b = 60 TO 0 STEP -8 - ' The inner loop will print "B" b times, where b is the current - ' value of the outer loop iterator - FOR a = 1 TO b - PRINT "B"; ' Print "B" followed by a semicolon to prevent newline - NEXT a - - ' After each inner loop iteration, print a newline to start the next line - PRINT -NEXT b - -' End of the program -END diff --git a/QBasic tutorial/group1/17.bas b/QBasic tutorial/group1/17.bas deleted file mode 100755 index b5e5f35..0000000 --- a/QBasic tutorial/group1/17.bas +++ /dev/null @@ -1,31 +0,0 @@ -' This example QuickBasic program demonstrates how to use the built-in -' timer, as well as how to display the current system time and date. -' It also shows a simple loop structure and the use of the CLS statement -' to clear the screen. - -' To stop the program, press CTRL + PAUSE/BREAK. - -DO - ' Clear the screen to provide a clean display for each iteration. - CLS - - ' Retrieve and print the current value of the system timer. - ' The TIMER function returns the number of seconds that have - ' elapsed since midnight, not counting leap seconds. - PRINT "System Timer: "; TIMER; " seconds since midnight." - - ' Retrieve and print the current system time using TIME$. - ' TIME$ returns a string in the format "HH:MM:SS". - PRINT "Current System Time: "; TIME$; "." - - ' Retrieve and print the current system date using DATE$. - ' DATE$ returns a string in the format "M/D/YYYY" or "DD/MM/YYYY" - ' depending on regional settings. - PRINT "Current System Date: "; DATE$; "." - - ' Pause for a moment to allow the user to see the output before - ' it is cleared again in the next iteration of the loop. - ' The Sleep statement requires including the QB.BI library. - SLEEP 1 - -LOOP diff --git a/QBasic tutorial/group1/18.bas b/QBasic tutorial/group1/18.bas deleted file mode 100755 index 0aec40a..0000000 --- a/QBasic tutorial/group1/18.bas +++ /dev/null @@ -1,31 +0,0 @@ -' This example program demonstrates the use of the RND function -' to generate random numbers in Microsoft QuickBasic. - -' Clear the screen before starting the program -CLS - -' The first loop will print ten random numbers. However, these -' numbers may not seem truly random because the random number -' generator needs to be seeded with a varying value. - -PRINT "First group of 'random' numbers without seeding:" -FOR b = 1 TO 10 - PRINT RND -NEXT b - -' Print an empty line for better readability between the two groups -PRINT - -' Seed the random number generator using the TIMER function, which -' returns the number of seconds since midnight. This ensures that -' subsequent calls to RND will yield different sequences of numbers -' each time the program is run after being restarted. -RANDOMIZE TIMER -PRINT "Second group of truly random numbers with seeding:" - -' Now, print another ten random numbers after seeding the generator -FOR b = 1 TO 10 - PRINT RND -NEXT b - -' End of program diff --git a/QBasic tutorial/group1/19.bas b/QBasic tutorial/group1/19.bas deleted file mode 100755 index 536364b..0000000 --- a/QBasic tutorial/group1/19.bas +++ /dev/null @@ -1,31 +0,0 @@ -' This program demonstrates how to use the QuickBasic functions RND (random number generator), -' COLOR (sets text and background color), LOCATE (positions the cursor on the screen), PRINT (displays text), -' SOUND (generates a tone through the PC speaker) - -CLS ' Clears the screen before starting the program - -' Generate random coordinates (x, y) for text placement on the screen -' and a random color (c) for the text. -' The screen has 80 columns (0-79) and 25 lines (0-24), but we start counting from 1. - - -' INKEY$ returns a string containing any keystroke; if no key is pressed, it returns an empty string -DO WHILE INKEY$ = "" - x = INT(RND * 80) + 1 ' Random column, ensuring it is within the screen width - y = INT(RND * 25) + 1 ' Random line, ensuring it is within the screen height - c = INT(RND * 16) ' Random color index (0-15), where 0 is black and 15 is white - - ' Set the text color to the randomly chosen color - COLOR c - - ' Position the cursor at the random coordinates - LOCATE y, x - - ' Print an "x" character at the current cursor position - PRINT "x"; ' The semicolon prevents advancing to the next line - - ' Generate a sound with a frequency based on the x coordinate and a duration of 0.1 seconds - SOUND x * 100 + 100, 1 - -LOOP - diff --git a/QBasic tutorial/group2/01.bas b/QBasic tutorial/group2/01.bas deleted file mode 100755 index 39b091d..0000000 --- a/QBasic tutorial/group2/01.bas +++ /dev/null @@ -1,20 +0,0 @@ -CLS - -' incareasing frequancy; suurenev sagedus; uvelicevajusijesja xastota -SOUND 1000, 2 -SOUND 2000, 2 -SOUND 3000, 2 - -' incareasing length; suurenev kestvus; uvelicevajusijesja dlitelnost -SOUND 0, 10 -SOUND 1000, 1 - -SOUND 0, 10 -SOUND 1000, 2 - -SOUND 0, 10 -SOUND 1000, 4 - -SOUND 0, 10 -SOUND 1000, 8 - diff --git a/QBasic tutorial/group2/02.bas b/QBasic tutorial/group2/02.bas deleted file mode 100755 index 39b2c4e..0000000 --- a/QBasic tutorial/group2/02.bas +++ /dev/null @@ -1,14 +0,0 @@ -1 -s = s + 1 ' speed -PRINT s; "x" - -FOR a = 100 TO 1000 STEP s - SOUND a, .1 -NEXT a - -FOR a = 1000 TO 100 STEP -s - SOUND a, .1 -NEXT a - -GOTO 1 - diff --git a/QBasic tutorial/group2/03.bas b/QBasic tutorial/group2/03.bas deleted file mode 100755 index f5de99b..0000000 --- a/QBasic tutorial/group2/03.bas +++ /dev/null @@ -1,7 +0,0 @@ -CLS - -INPUT "Hi, what is your name: ", a$ -COLOR 10 -PRINT "Hello " + a$ + " !" -PRINT a$ + " how are you?" - diff --git a/QBasic tutorial/group2/04.bas b/QBasic tutorial/group2/04.bas deleted file mode 100755 index a428f1e..0000000 --- a/QBasic tutorial/group2/04.bas +++ /dev/null @@ -1,11 +0,0 @@ -CLS - -a$ = "-two-" -PRINT a$ - -a$ = a$ + "three" -PRINT a$ - -a$ = "one" + a$ -PRINT a$ - diff --git a/QBasic tutorial/group2/05.bas b/QBasic tutorial/group2/05.bas deleted file mode 100755 index e9623c6..0000000 --- a/QBasic tutorial/group2/05.bas +++ /dev/null @@ -1,24 +0,0 @@ -CLS - -INPUT "Horisontal size (2 to 79):", hs -INPUT "Vertical size (2 to 23):", vs - - -FOR i = 1 TO hs ' make top of the box - PRINT "#"; -NEXT i -PRINT - -FOR y = 1 TO vs - 2 ' make main box area - PRINT "#"; - FOR i = 1 TO hs - 2 - PRINT "."; - NEXT i - PRINT "#" -NEXT y - -FOR i = 1 TO hs ' make last line of the box - PRINT "#"; -NEXT i -PRINT - diff --git a/QBasic tutorial/group2/06.bas b/QBasic tutorial/group2/06.bas deleted file mode 100755 index d7f192d..0000000 --- a/QBasic tutorial/group2/06.bas +++ /dev/null @@ -1,5 +0,0 @@ -' several commans may be at the single line, when separated by colon. - -1 a = a + 1: PRINT a; "x 7 ="; a * 7: IF a < 10 THEN GOTO 1 - - diff --git a/QBasic tutorial/group2/07.bas b/QBasic tutorial/group2/07.bas deleted file mode 100755 index 4a56ab1..0000000 --- a/QBasic tutorial/group2/07.bas +++ /dev/null @@ -1,10 +0,0 @@ -INPUT "enter a number:", n - -IF n < 5 THEN PRINT "this number is smaller than 5" -IF n > 5 THEN PRINT "this number is greater than 5" -IF n = 5 THEN PRINT "this number is equal to 5" -IF n <= 5 THEN PRINT "this number is 5, or less" -IF n >= 5 THEN PRINT "this number is 5, or greater" -IF n <> 5 THEN PRINT "this number is not 5" - - diff --git a/QBasic tutorial/group2/08.bas b/QBasic tutorial/group2/08.bas deleted file mode 100755 index 7ec2867..0000000 --- a/QBasic tutorial/group2/08.bas +++ /dev/null @@ -1,43 +0,0 @@ -CLS - -1 -PRINT "enter password:"; -COLOR 0 ' set temprorarily text color to 0, to hide password - ' black (0) text is invisivle on black backround. -INPUT "", a$ -COLOR 7 ' restore to original text color - -IF a$ <> "jerry" THEN PRINT "wrong password!": GOTO 1 - - -CLS -LOCATE 1, 1 -COLOR 14 -PRINT " ========================================" -PRINT " Welcome to nuclear rocket control system" -PRINT " ========================================" -COLOR 10, 1 -PRINT "..............................................................." -PRINT ".....MMMMMM................MM...MMMMMMM.MMMMMM.MMM..MMMMMMM..MM" -PRINT "MMMMMMMMMMMMMMM...MM.M....MMMMM.MM.MMMMMMMMMMMMMMMMMMMMMMM.MM.." -PRINT ".MMMMMMMMMMM.M.....MMM...MM.....MMMMMMMMMMMMMMMMMMMMMM.M......." -PRINT "..MMMMMMMMMMMM..............MMMMMMMMMMMMMMMMMMMMMMMM..M ......." -PRINT "....MMMMMMMM...............MMMM..MMMMM.MMMMMMMMMMMMM.MM........" -PRINT ".....MMMMMMM.............MMMMMMMM..MMM..MMMMMM.MMMMM.M........." -PRINT "........MM...............MMMMMMMMMM.M.....MM...........M......." -PRINT "......MMMMMM................MMMMMMM....................M......." -PRINT ".....MMMMMMMM.................MMMMMM....................MMM...." -PRINT "......MMMMMMM.................MMMMM...................MMMMMM..." -PRINT "........MMMMMM..................MM....................MMMMMMM.." -PRINT "..........MMMMM ...........................................MM.." - -LOCATE 7, 34 ' display our location -COLOR 12 + 16 -PRINT "*" - -FOR a = 9 TO 23 ' play tune - SOUND 1.5 ^ a, 3 -NEXT a - -COLOR 7, 0 ' restore default color - diff --git a/QBasic tutorial/group2/09.bas b/QBasic tutorial/group2/09.bas deleted file mode 100755 index c155bb9..0000000 --- a/QBasic tutorial/group2/09.bas +++ /dev/null @@ -1,6 +0,0 @@ -a$ = "software" - -PRINT a$ -PRINT LEFT$(a$, 4) ' get left piece -PRINT RIGHT$(a$, 4) ' get right piece - diff --git a/QBasic tutorial/group2/10.bas b/QBasic tutorial/group2/10.bas deleted file mode 100755 index 0cf930b..0000000 --- a/QBasic tutorial/group2/10.bas +++ /dev/null @@ -1,21 +0,0 @@ -CLS - -INPUT "Enter some text:", t$ - -PRINT "You entered:" + t$ -PRINT "You entered:"; t$ -PRINT "You entered:", t$ - - -PRINT "It's length is"; LEN(t$); "letters." - -FOR i = 1 TO LEN(t$) ' get text from left - PRINT LEFT$(t$, i) -NEXT i - -PRINT - -FOR i = 1 TO LEN(t$) ' get text from right - PRINT RIGHT$(t$, i) -NEXT i - diff --git a/QBasic tutorial/group2/11.bas b/QBasic tutorial/group2/11.bas deleted file mode 100755 index 0831a84..0000000 --- a/QBasic tutorial/group2/11.bas +++ /dev/null @@ -1,10 +0,0 @@ -CLS - -INPUT "Enter some text:", t$ - -FOR i = 1 TO LEN(t$) - a$ = LEFT$(t$, i) - b$ = RIGHT$(a$, 1) - PRINT "letter:"; b$ -NEXT i - diff --git a/QBasic tutorial/group2/12.bas b/QBasic tutorial/group2/12.bas deleted file mode 100755 index 9e6ca8c..0000000 --- a/QBasic tutorial/group2/12.bas +++ /dev/null @@ -1,13 +0,0 @@ -y = 10 -ys = 1 - -1 -CLS -y = y + ys -IF y > 20 THEN ys = -1 -IF y < 2 THEN ys = 1 -LOCATE y -PRINT "This is jumping text" -SOUND y * 200 + 100, 1 -GOTO 1 - diff --git a/QBasic tutorial/group2/13.bas b/QBasic tutorial/group2/13.bas deleted file mode 100755 index 38cf3c7..0000000 --- a/QBasic tutorial/group2/13.bas +++ /dev/null @@ -1,27 +0,0 @@ -CLS - -x = 12 ' ball X coordinate -y = 7 ' ball Y coordinate -xs = 1 ' speed on X direction -ys = 1 ' speed on Y direction - -1 -LOCATE y, x ' erase ball -PRINT " " - -x = x + xs ' calculate new ball coordinates -y = y + ys - -LOCATE y, x ' draw ball -PRINT "O" - - -IF x > 79 THEN xs = -1: SOUND 1000, 1 ' check for boundaries -IF x < 2 THEN xs = 1: SOUND 1000, 1 - -IF y > 22 THEN ys = -1: SOUND 1000, 1 -IF y < 2 THEN ys = 1: SOUND 1000, 1 - -SOUND 0, 1 ' wait -GOTO 1 - diff --git a/QBasic tutorial/group2/14.bas b/QBasic tutorial/group2/14.bas deleted file mode 100755 index 14f4695..0000000 --- a/QBasic tutorial/group2/14.bas +++ /dev/null @@ -1,21 +0,0 @@ -CLS -PRINT "press keys 0-9, for sound" -PRINT "press ESC to exit program" - -1 -a$ = INPUT$(1) - -IF a$ = "1" THEN SOUND 1000, 2 -IF a$ = "2" THEN SOUND 1100, 2 -IF a$ = "3" THEN SOUND 1200, 2 -IF a$ = "4" THEN SOUND 1300, 2 -IF a$ = "5" THEN SOUND 1400, 2 -IF a$ = "6" THEN SOUND 1500, 2 -IF a$ = "7" THEN SOUND 1600, 2 -IF a$ = "8" THEN SOUND 1700, 2 -IF a$ = "9" THEN SOUND 1800, 2 -IF a$ = "0" THEN SOUND 1900, 2 -IF a$ = CHR$(27) THEN SYSTEM ' 27 = ESCape key code - -GOTO 1 - diff --git a/QBasic tutorial/group2/15.bas b/QBasic tutorial/group2/15.bas deleted file mode 100755 index f5121f6..0000000 --- a/QBasic tutorial/group2/15.bas +++ /dev/null @@ -1,10 +0,0 @@ -CLS - -FOR a = 32 TO 255 -PRINT " " + CHR$(a); -NEXT a - -PRINT " " -PRINT " " -PRINT "Hi there! " + CHR$(1) - diff --git a/QBasic tutorial/group2/16.bas b/QBasic tutorial/group2/16.bas deleted file mode 100755 index 59bce8a..0000000 --- a/QBasic tutorial/group2/16.bas +++ /dev/null @@ -1,19 +0,0 @@ -CLS -PRINT "Press any key..." - -1 -a$ = INPUT$(1) - -PRINT "pressed key was: "; - -IF ASC(a$) > 32 THEN PRINT a$ - -IF a$ = CHR$(27) THEN PRINT "Escape" -IF a$ = CHR$(13) THEN PRINT "Enter" -IF a$ = CHR$(8) THEN PRINT "Backspace" -IF a$ = CHR$(9) THEN PRINT "Tabulator" -IF a$ = " " THEN PRINT "Space" - -PRINT "ASCII code is: "; ASC(a$) -GOTO 1 - diff --git a/QBasic tutorial/group2/17.bas b/QBasic tutorial/group2/17.bas deleted file mode 100755 index ee9a18c..0000000 --- a/QBasic tutorial/group2/17.bas +++ /dev/null @@ -1,22 +0,0 @@ -CLS -PRINT "Use keys 4, 8, 6, 2 for control, make sure the NumLock is on" -PRINT "ESC to exit" -PRINT " " -PRINT "Press any key to continue..." -a$ = INPUT$(1) - -COLOR 14 -x = 40 -y = 10 -1 -CLS -LOCATE y, x -PRINT CHR$(2) -a$ = INPUT$(1) -IF a$ = "4" THEN x = x - 1 -IF a$ = "6" THEN x = x + 1 -IF a$ = "8" THEN y = y - 1 -IF a$ = "2" THEN y = y + 1 -IF a$ = CHR$(27) THEN SYSTEM -GOTO 1 - diff --git a/QBasic tutorial/group2/18.bas b/QBasic tutorial/group2/18.bas deleted file mode 100755 index 391a349..0000000 --- a/QBasic tutorial/group2/18.bas +++ /dev/null @@ -1,28 +0,0 @@ -CLS -1 - -PRINT "******** Select action: ********" -PRINT " " -PRINT "1 - exit program" -PRINT "2 - make a sound" -PRINT "3 - draw box" - -INPUT "", a - -IF a = 1 THEN SYSTEM - -IF a = 2 THEN SOUND 2000, 2 - -IF a = 3 THEN - FOR c = 1 TO 15 - FOR b = 1 TO 50 - PRINT "#"; - NEXT b - PRINT " " - NEXT c -END IF - -IF a > 3 THEN PRINT "Number too large" -IF a < 1 THEN PRINT "Number too small" -GOTO 1 - diff --git a/QBasic tutorial/group3/00.bas b/QBasic tutorial/group3/00.bas deleted file mode 100755 index 91414f8..0000000 --- a/QBasic tutorial/group3/00.bas +++ /dev/null @@ -1,7 +0,0 @@ -SCREEN 13 ' set video mode 320 x 200 256 colors - -PRINT "Hello..." - -PSET (160, 100), 10 ' draws a point - ' x=160 y=100 color=10 - diff --git a/QBasic tutorial/group3/01.bas b/QBasic tutorial/group3/01.bas deleted file mode 100755 index 938bc41..0000000 --- a/QBasic tutorial/group3/01.bas +++ /dev/null @@ -1,9 +0,0 @@ -SCREEN 13 - -FOR y = 50 TO 150 - FOR x = 100 TO 200 - PSET (x, y), 10 - NEXT x - SOUND y, 1 -NEXT y - diff --git a/QBasic tutorial/group3/02.bas b/QBasic tutorial/group3/02.bas deleted file mode 100755 index 11df674..0000000 --- a/QBasic tutorial/group3/02.bas +++ /dev/null @@ -1,25 +0,0 @@ -DECLARE SUB box (x1!, y1!, x2!, y2!, c!) - -' Press F2 to see submodules -' Nazmi F2 xtob uvidet SUB moduli -' Vajuta F2 et n„ha SUB mooduleid - - -SCREEN 13 - -box 10, 10, 100, 100, 15 - -box 30, 80, 300, 120, 11 - -box 140, 20, 180, 180, 10 - -SUB box (x1, y1, x2, y2, c) - -FOR y = y1 TO y2 - FOR x = x1 TO x2 - PSET (x, y), c - NEXT x -NEXT y - -END SUB - diff --git a/QBasic tutorial/group3/03.bas b/QBasic tutorial/group3/03.bas deleted file mode 100755 index 8ddb8b2..0000000 --- a/QBasic tutorial/group3/03.bas +++ /dev/null @@ -1,6 +0,0 @@ -SCREEN 13 - -LINE (10, 10)-(200, 100), 14 - -CIRCLE (100, 100), 80, 10 - diff --git a/QBasic tutorial/group3/04.bas b/QBasic tutorial/group3/04.bas deleted file mode 100755 index a806541..0000000 --- a/QBasic tutorial/group3/04.bas +++ /dev/null @@ -1,8 +0,0 @@ -SCREEN 13 - -LINE (10, 10)-(50, 50), 14 ' line - -LINE (100, 10)-(150, 50), 14, B ' box - -LINE (200, 10)-(250, 50), 14, BF ' filled box - diff --git a/QBasic tutorial/group3/05.bas b/QBasic tutorial/group3/05.bas deleted file mode 100755 index 3e87408..0000000 --- a/QBasic tutorial/group3/05.bas +++ /dev/null @@ -1,6 +0,0 @@ -SCREEN 13 - -FOR x = 0 TO 255 - LINE (x, 50)-(x, 100), x -NEXT x - diff --git a/QBasic tutorial/group3/06.bas b/QBasic tutorial/group3/06.bas deleted file mode 100755 index 5bb13d3..0000000 --- a/QBasic tutorial/group3/06.bas +++ /dev/null @@ -1,12 +0,0 @@ -SCREEN 13 - - -CIRCLE (160, 100), 80, 15 -LINE (100, 10)-(200, 180), 15 - -PRINT "press any key..." - -a$ = INPUT$(1) - -PAINT (180, 100), 15 - diff --git a/QBasic tutorial/group3/07.bas b/QBasic tutorial/group3/07.bas deleted file mode 100755 index 3c7ba6c..0000000 --- a/QBasic tutorial/group3/07.bas +++ /dev/null @@ -1,23 +0,0 @@ -DECLARE SUB sihik (x!, y!) -SCREEN 13 - -' Press F2 to see submodules list -' Vajuta F2 at n„ha sub moodulite listi -' nazmi F2 xtobe uvidjet sub spisok sub modulei - - -sihik 100, 100 -sihik 200, 50 -sihik 180, 150 - -SUB sihik (x, y) - -CIRCLE (x, y), 10, 15 -CIRCLE (x, y), 20, 15 -CIRCLE (x, y), 30, 15 - -LINE (x, y - 50)-(x, y + 50), 15 -LINE (x - 50, y)-(x + 50, y), 15 - -END SUB - diff --git a/QBasic tutorial/group3/08.bas b/QBasic tutorial/group3/08.bas deleted file mode 100755 index deff209..0000000 --- a/QBasic tutorial/group3/08.bas +++ /dev/null @@ -1,13 +0,0 @@ -SCREEN 13 - - -FOR x = 0 TO 319 - - y = SIN(x / 10) * 50 + 100 - PSET (x, y), 14 - - y = COS(x / 10) * 50 + 100 - PSET (x, y), 12 - -NEXT x - diff --git a/QBasic tutorial/group3/09.bas b/QBasic tutorial/group3/09.bas deleted file mode 100755 index eaea7f8..0000000 --- a/QBasic tutorial/group3/09.bas +++ /dev/null @@ -1,13 +0,0 @@ -SCREEN 13 - -pi = 3.14 -mi = 7 ' amount of points on circular shape - -FOR a = 0 TO pi * 2 STEP pi * 2 / mi - - x = SIN(a) * 50 + 100 - y = COS(a) * 50 + 100 - PSET (x, y), 10 - -NEXT a - diff --git a/QBasic tutorial/group3/10.bas b/QBasic tutorial/group3/10.bas deleted file mode 100755 index fc4f497..0000000 --- a/QBasic tutorial/group3/10.bas +++ /dev/null @@ -1,21 +0,0 @@ -SCREEN 13 - -FOR i = 0 TO 320 STEP 10 - LINE (0, i)-(319, i), 5 - LINE (i, 0)-(i, 199), 5 -NEXT i - -LINE (0, 100)-(319, 100), 10 - -PRINT "press a key..." -a$ = INPUT$(1) - -y = 100 -ys = -1 -FOR t = 0 TO 300 - PSET (t, y), 14 - ys = ys + .01 - y = y + ys - SOUND 300 - y, .1 -NEXT t - diff --git a/QBasic tutorial/group3/11.bas b/QBasic tutorial/group3/11.bas deleted file mode 100755 index c4e4c5a..0000000 --- a/QBasic tutorial/group3/11.bas +++ /dev/null @@ -1,10 +0,0 @@ -CLS - -a = -12.7 - -PRINT "normal: ", a -PRINT "rounded: ", INT(a) -PRINT "absolute: ", ABS(a) - -PRINT "reminder of 10 / 4 is: ", 10 MOD 4 - diff --git a/index.org b/index.org index b5c34e9..8383361 100644 --- a/index.org +++ b/index.org @@ -147,6 +147,14 @@ appear small. To make it bigger: 3. Save the changes and restart DOSBox for the configuration to take effect. +*** Exit mouse capture + +DOSBox detects when a game uses mouse control. When you click on the +screen, it should get locked (confined to the DOSBox window) and work. + +To release mouse lock, press: +: CTRL-F10 + * Applications There are lot of applications. Few examples: