QBasic and QB64 Discussion Board

[QB Forum Archives (1999-2009)/ ] [QB FAQ] [QB Links and Downloads] [Subforums and Chat Room] [Search]

QB64.Net Homepage   QB/QB64 Keywords   QB Graphics Forum   Homework Policy



*Merry Christmas to everyone! o<}} :o) }}}}} (Santa CLASCII).

by (Login qb432l)
R

*

Posted on Dec 25, 2010, 3:42 AM

Respond to this message   

Return to Index


Re: *Merry Christmas to everyone! o<}} :o) }}}}} (Santa CLASCII).

by Norman (no login)

screen _newimage(640,480,32),,1,0



for i=-30 to 30

line (320,100)-step(i,400),_rgb(40,40,0)

next

for j=0 to 8 step .5

for i=.5 to 3.14159-.5 step .001

line (320,320-j*40)-step((200-j*j*3)*cos(i),(100-j*j*1)*sin(i)), _rgb(0,i*50,0)

next

next

screen ,,0,0

do

_limit 30

pcopy 1,0

for i=0 to 500

pset (rnd*640,rnd*480),_rgb(255,255,255)

next

_display

loop until inp(&h60)=1

sleep

system

Posted on Dec 25, 2010, 1:48 PM

Respond to this message   

Return to Index


*Gorgeous!

by (Login qb432l)
R

*

Posted on Dec 25, 2010, 9:14 PM

Respond to this message   

Return to Index


* Thanks Bob, my secret is jojoba oil... oops, wrong response.

by (Login The-Universe)
Admin

Posted on Dec 26, 2010, 11:49 AM

Respond to this message   

Return to Index


My secret to staying young and beautiful is to stay out of the sun...

by (Login qb432l)
R

...or any other location where I might actually be seen.
-Bob

Posted on Dec 27, 2010, 3:15 AM

Respond to this message   

Return to Index


LOL - But then Canada has a proctive barrier against UV radiation from the sun...

by (Login The-Universe)
Admin


It's called 10 feet of snow!

Pete happy.gif

Posted on Dec 27, 2010, 8:13 AM

Respond to this message   

Return to Index


Actually, no.

by Solitaire (Login Solitaire1)
S

All that snow reflects back the sun's rays so you get exposed to radiation from below as well as from above.

Posted on Dec 27, 2010, 8:45 AM

Respond to this message   

Return to Index


*Ah, but not when you're are under it! Unless you are 10'+ tall, then, excuse the reply.

by (Login The-Universe)
Admin

Posted on Dec 27, 2010, 12:05 PM

Respond to this message   

Return to Index


Actually, I've never been particularly frightened of the sun...

by (Login qb432l)
R

...or any of that stuff about the ozone. Isn't that just what's left over when you've finished eating a donut?

-Bob

Posted on Dec 27, 2010, 12:57 PM

Respond to this message   

Return to Index


That theory is unsound...

by (Login The-Universe)
Admin


If you're eatung a jelly donut, or a cream filled!

Pete

Posted on Dec 27, 2010, 6:58 PM

Respond to this message   

Return to Index


* Merry Christmas back at ya Bob, and everyone or two others here.

by (Login The-Universe)
Admin

Posted on Dec 25, 2010, 8:15 PM

Respond to this message   

Return to Index


Network 54's strange idiosyncracies

by (Login MarineDon)
R


Dear Friends:

Introducing ADJUST54.BAS, a program which modifies and
adjusts a QBasic program so as to work with Newwork 54's
strange idiosyncracies. It does four things:

(1) At the top, it places a HTML tag:
"<span style="color:#000000;font-size:10pt;font-family:'Courier New'>"

(2) It places a CHR$(160) for each space in the program.
This is actually a Spanish accented "a".

(3) It places a HTML 60 wherever a "<" is found. The 60
is proceeded by an ampersand, number sign, and two zeros,
and ends with a semicolon.

(4) It places a HTML 62 wherever a ">" is found. The 62
is proceeded by an ampersand, number sign, and two zeros,
and ends with a semicolon.

The program asks for the name of the .BAS file and then works
its magic and presents the newly formatted program as the
file "temptemp.txt" in Notepad. In Notepad, the user would
click on "Edit", "Select All" and then "Edit", "Copy" (or
CTRL-C works as well). The program is then "pasted" into
Network54's "Message Text Box", using "Edit", "Paste" or
CTRL-V. Once Notepad is exited the file "temptemp.txt" is
deleted, so if the file is to be saved, please click "file" and
"save as" with another filename.

The SUB ExistFile (x$, flag) was written by Pete and it's pretty
neat (rhimes). I have my own "exist" SUB but I prefer Pete's.

The ADJUST54.BAS file is below and it has been formatted with the
ADJUST54.BAS scheme.

Christmas Greetings to all, and Happy New Year, Ho, Ho, Ho,
Don Smith

'====================================================================
' ADJUST54.BAS begins here:
'====================================================================
    'ADJUST54.BAS - Public domain program by Don Smith
    'This program adjusts QBasic code for Network 54's strange idiosyncracies
    '
    DECLARE SUB EditText (Text$, Row%, Col%, RCol%, FG%, BG%, TextType$, LenStr%, ExitCode%)
    DECLARE SUB ExistFile (x$, flag)
    DECLARE SUB OneLine (LineRow%, LineCol%, LineFG%, LineBG%, Style%, LenStr%)
    DECLARE SUB TinyBox (ULRow, ULCol, LRRow, LRCol, BoxFGColr, BoxBGColr, SingOrDoub)
begin:
    COLOR 15, 1: CLS
    CALL TinyBox(4, 14, 16, 65, 15, 1, 2)
    CALL TinyBox(10, 24, 12, 56, 15, 1, 1)
    CALL OneLine(6, 14, 15, 1, 4, 51)
    CALL OneLine(14, 14, 15, 1, 4, 51)
    LOCATE 5, 33: COLOR 14, 1: PRINT "ADJUST54.BAS": COLOR 15, 1
    LOCATE 7, 17: PRINT "Enter BASIC filename to convert it to Network's";
    LOCATE 8, 17: PRINT "strange idiosyncracies.";
    LOCATE 15, 23: PRINT "Press <Esc> to exit with no input";
    COLOR 11, 1: LOCATE 15, 29: PRINT "<"; : LOCATE 15, 33: PRINT ">";
    LOCATE 11, 26: PRINT "Enter file name: ";
    CALL EditText(InLine$, 11, 43, 55, 15, 1, "", 12, ExitCode%)
    IF ExitCode% = 27 THEN COLOR 7, 0: CLS : SYSTEM
    CALL ExistFile(InLine$, flag)
    IF flag = 0 THEN
        CALL TinyBox(18, 16, 21, 63, 15, 1, 1)
        LOCATE 19, 19: PRINT "File " + CHR$(34) + InLine$ + CHR$(34) + " Not Found.";
        LOCATE 19, 25: COLOR 14, 1: PRINT InLine$; : COLOR 15, 1
        LOCATE 20, 19: PRINT "Press <Esc> to exit or <Enter> to try again.";
        COLOR 11, 1
        LOCATE 20, 25, 0: PRINT "<"; : LOCATE 20, 29: PRINT ">";
        LOCATE 20, 42, 0: PRINT "<"; : LOCATE 20, 48: PRINT ">";
        DO
            DO
                Pound$ = INKEY$
            LOOP UNTIL LEN(Pound$) > 0
            Pound% = CVI(Pound$ + CHR$(0))
            IF Pound% = 27 THEN
                COLOR 7, 0: CLS : SYSTEM
            ELSEIF Pound% = 13 THEN
                InLine$ = ""
                GOTO begin
            END IF
        LOOP
        SYSTEM
    END IF
    OPEN InLine$ FOR INPUT AS #1
    OPEN "temptemp.txt" FOR OUTPUT AS #2
    PRINT #2, "<span style='color:000000;font-size:10.0pt;font-family:Courier New'>"
    COLOR 15, 1: CLS
    DO
        LINE INPUT #1, Adj$
        FOR LineIn% = 1 TO LEN(Adj$) + 1
            IF LineIn% = LEN(Adj$) + 1 THEN
                PRINT #2, GoDaddy$
                LineIn% = 0
                LineLook$ = ""
                GoDaddy$ = ""
                Adj$ = ""
                EXIT FOR
            END IF
            LineLook$ = MID$(Adj$, LineIn%, 1)
            IF LineLook$ = CHR$(32) THEN         'empty space is Spanish accented "a" character              
                LineLook$ = CHR$(160)
            ELSEIF LineLook$ = "<" THEN          '<   < LESS-THAN SIGN
                IF MID$(Adj$, LineIn% + 1, 4) <> "span" THEN
                    LineLook$ = "<"
                END IF
            ELSEIF LineLook$ = ">" THEN          '>   < GREATER THAN SIGN
                IF MID$(Adj$, LineIn% - 2, 2) <> "w'" THEN
                    LineLook$ = ">"
                END IF
            END IF
            GoDaddy$ = GoDaddy$ + LineLook$
        NEXT
    LOOP UNTIL EOF(1)
    PRINT #2, "</span>"
    CLOSE #1: CLOSE #2
    SHELL "notepad.exe" + " " + "temptemp.txt"
    KILL "temptemp.txt"
    SYSTEM

DEFINT A-Z
SUB EditText (Text$, Row%, Col%, RCol%, FG%, BG%, TextType$, LenStr%, ExitCode%)
    ' +---------------------------------------------------------------------+
    ' |                    -  S U B   E d i t T e x t  -                    |
    ' +-----------+---------------------------------------------------------+
    ' | Row%      |  The screen row.                                        |
    ' +-----------+---------------------------------------------------------+
    ' | Col%      |  The screen column.                                     |
    ' +-----------+---------------------------------------------------------+
    ' | RCol%     |  The right far column.                                  |
    ' +-----------+---------------------------------------------------------+
    ' | Text$     |  The text that is sent and returned from the edit line. |
    ' +-----------+---------------------------------------------------------+
    ' | TextType$ |  For all ASCII characers 32 to 255, TypeOfText = ""     |
    ' |           |  For numbers only, TypeOfText$ = "1234567890"           |
    ' |           |  For numbers with commas and decimals points,           |
    ' |           |  TypeOfText$ = ".,1234567890"                           |
    ' |           |  For Yes or No answers, TypeOfText$ = "YNyn"            |
    ' |           |  Whatever is included within the parethesis             |
    ' |           |  is what will be accepted by the SUB EditText.          |
    ' +-----------+---------------------------------------------------------+
    ' | LenStr%   |  The length of the Text$ to be edit.                    |
    ' +-----------+---------------------------------------------------------+
    ' | ExitCode% |  Returned positive number of the key that was used      |
    ' |           |  to exit the edit call.                                 |
    ' +-----------+---------------------------------------------------------+
    LOCATE Row%, Col%: COLOR FG%, BG%: PRINT SPACE$(LenStr%);
    TText$ = LEFT$(Text$ + STRING$(LenStr%, 32), LenStr%)
    CPosition% = LEN(Text$) + 1
    LenStr% = LenStr% + 1
    TRUE = 1
    Insert = 0
    DO
        IF Insert THEN
             Insert = -1
             LOCATE , , 1, 4, 7
        ELSEIF NOT Insert THEN
             Insert = 0
             LOCATE , , 1, 6, 7
        END IF
        LLen% = RCol% - Col%
        NRow% = CINT(LenStr% / LLen% + .5)
        NRow% = Row%
        Creek% = CPosition% \ LLen% + 1
        IF Creek% > 1 THEN
            Cp = (CPosition% MOD (Creek% - 1) * LLen%)
            IF Cp = 0 THEN
                Creek% = Creek% - 1
                Cp = LLen%
            END IF
        ELSE
            Cp = CPosition%
        END IF
        R = Row%
        FOR x = 1 TO NRow%
            LOCATE R, Col%: PRINT MID$(TText$, x * LLen% - LLen% + 1, LLen%);
            R = R + 1
            IF CPosition% >= LenStr% THEN
                CPosition% = 1
            END IF
        NEXT
        LOCATE Row% + Creek% - 1, Col% + Cp - 1
        DO
            KeyCode$ = INKEY$
        LOOP UNTIL LEN(KeyCode$)
        KeyCode% = CVI(KeyCode$ + CHR$(0))
        IF KeyCode% > 31 AND KeyCode% < 255 THEN   'ASCII characters 32 to 254  
            IF CPosition% <= LenStr% AND Insert THEN
                LOCATE , , 1, 4, 7
                TText$ = LEFT$(TText$, CPosition% - 1) + KeyCode$ + MID$(TText$, CPosition%, LenStr% - CPosition%)
                CPosition% = CPosition% + 1
            END IF
            IF CPosition% <= LenStr% AND NOT Insert THEN
                MID$(TText$, CPosition%, 1) = KeyCode$
                CPosition% = CPosition% + 1
            END IF
        ELSEIF KeyCode% = 8 THEN                           '<BackSpace>
            IF CPosition% > 1 THEN
                CPosition% = CPosition% - 1
                TText$ = LEFT$(TText$, CPosition% - 1) + MID$(TText$, CPosition% + 1, LenStr% - CPosition%) + " "
            END IF
        ELSEIF KeyCode% = 21248 THEN                       '<Delete>
            TText$ = LEFT$(TText$, CPosition% - 1) + MID$(TText$, CPosition% + 1, LenStr% - CPosition%) + " "
        ELSEIF KeyCode% = 20224 THEN                       '<End>
            FOR xx = LenStr% TO 1 STEP -1
                IF MID$(TText$, xx, 1) > CHR$(32) THEN
                    CPosition% = xx + 1
                    EXIT FOR
                END IF
            NEXT
        ELSEIF KeyCode% = 27 THEN                          '<Esc>
            ExitCode% = KeyCode%
            GOTO ExitRoutine
        ELSEIF KeyCode% = 13 THEN                          '<Enter>
            Creek% = (CPosition% / LLen% + .5)
            CPosition% = Creek% * LLen% + 1
            ExitCode% = KeyCode%
            GOTO ExitRoutine
        ELSEIF KeyCode% = 18176 THEN                       '<Home>
            CPosition% = 1
        ELSEIF KeyCode% = 20992 THEN                       '<Insert>
            Insert = NOT Insert
        ELSEIF KeyCode% = 19200 THEN                       '<LeftArrow>
            IF CPosition% > 1 THEN
                CPosition% = CPosition% - 1
            END IF
        ELSEIF KeyCode% = 19712 THEN                       '<RightArrow>
            IF CPosition% < LenStr% THEN
               CPosition% = CPosition% + 1
            END IF
        END IF
    LOOP WHILE TRUE
ExitRoutine:
   ExitCode% = KeyCode%
   Text$ = RTRIM$(TText$)
END SUB

DEFSNG A-Z
SUB ExistFile (x$, flag)
    ' ============================================
    ' | SUB ExistFile code written by            |
    ' | Pete (Admin) at the QBasic Forum.        |
    ' ============================================
    ' |  x$ is the file name or file type:       |
    ' |  File name example: MM.BAS               |
    ' |  File type example: *.BAS                |
    ' ============================================
    ' |  CASE -1: PRINT "File exists"            |
    ' |  CASE -2: PRINT "File type exists"       |
    ' |  CASE 0: PRINT "File not found."         |
    ' ============================================
    flag = 0
    SHELL "dir /b " + x$ + ">tmp.tmp"
    ff1% = FREEFILE
    OPEN "tmp.tmp" FOR INPUT AS #ff1%
    DO UNTIL EOF(ff1%)
        LINE INPUT #ff1%, filename$
        IF UCASE$(filename$) = UCASE$(x$) THEN
            flag = -1
            EXIT DO
        ELSEIF INSTR(x$, "*") < 0 OR INSTR(x$, "*") <> 0 THEN
            flag = -2
            EXIT DO
        ELSE
            flag = 0
        END IF
    LOOP
    CLOSE #ff1%
    KILL "tmp.tmp"
END SUB

SUB OneLine (LineRow%, LineCol%, LineFG%, LineBG%, Style%, LenStr%)
    ' +-------------------------------------------------------------------+
    ' |                           SUB OneLine                             |
    ' +-------------------------------------------------------------------+
    ' |  Not counting REM (') lines, SUB OneLine has 12 lines.            |
    ' +-------------------------------------------------------------------+
    ' |  SUB OneLine will place one line on screen.  There are 4 types    |
    ' |  of lines to choose from.  See Style% below.                      |
    ' +---------------+---------------------------------------------------+
    ' |  LineRow%     |   Row to place line.                              |
    ' +---------------+---------------------------------------------------+
    ' |  LineCol%     |   Column to place line.                           |
    ' +---------------+---------------------------------------------------+
    ' |  LineFG%      |   Foreground color of line.                       |
    ' +---------------+---------------------------------------------------+
    ' |  LineBG%      |   Background color of line.                       |
    ' +---------------+---------------------------------------------------+
    ' |  Style%       |  Style% = 1   ÃÄÄÄ´                               |
    ' |               +---------------------------------------------------+
    ' |               |  Style% = 2   ÆÍÍ͵                               |
    ' |               +---------------------------------------------------+
    ' |               |  Style% = 3   ÌÍÍ͹                               |
    ' |               +---------------------------------------------------+
    ' |               |  Style% = 4   ÇÄÄĶ                               |
    ' +---------------+---------------------------------------------------+
    ' |  LenStr%      |  Length of string (line).                         |
    ' +-------------------------------------------------------------------+
    IF Style% = 1 THEN         'ÃÄÄÄ´
        SingLine$ = CHR$(195) + STRING$(LenStr%, CHR$(196)) + CHR$(180)
    ELSEIF Style% = 2 THEN     'ÆÍÍ͵
        SingLine$ = CHR$(198) + STRING$(LenStr%, CHR$(205)) + CHR$(181)
    ELSEIF Style% = 3 THEN     'ÌÍÍ͹
        SingLine$ = CHR$(204) + STRING$(LenStr%, CHR$(205)) + CHR$(185)
    ELSEIF Style% = 4 THEN     'ÇÄÄĶ
        SingLine$ = CHR$(199) + STRING$(LenStr%, CHR$(196)) + CHR$(182)
    END IF
    LOCATE LineRow%, LineCol%
    COLOR LineFG%, LineBG%
    PRINT SingLine$;
END SUB

SUB TinyBox (ULRow, ULCol, LRRow, LRCol, BoxFGColr, BoxBGColr, SingOrDoub)
    ' +----------------------------------------------------------------------+
    ' |                          SUB TinyBox                                 |
    ' +----------------------------------------------------------------------+
    ' |  ULRow = Upper Left Row.  ULCol = Upper Left Column.                 |
    ' |  LRRow = Lower Right Row. LRCol = Lower Right Column.                |
    ' |  BoxFGColr = The Foreground Color The Box.                           |
    ' |  BoxBGColr = The Back Ground Color Of The Box.                       |
    ' |  SingOrDoub = 1 (Single Line Box). SingOrDoub = 2 (Double Line Box). |
    ' +----------------------------------------------------------------------+
    COLOR BoxFGColr, BoxBGColr
    IF SingOrDoub = 1 THEN
        LOCATE ULRow, ULCol
        PRINT CHR$(218) + STRING$(LRCol - ULCol, CHR$(196)) + CHR$(191);
        FOR BoxY = ULRow + 1 TO LRRow - 1
            LOCATE BoxY, ULCol
            PRINT CHR$(179) + STRING$(LRCol - ULCol, " ") + CHR$(179);
        NEXT
        LOCATE LRRow, ULCol
        PRINT CHR$(192) + STRING$(LRCol - ULCol, CHR$(196)) + CHR$(217);
    ELSEIF SingOrDoub = 2 THEN
        LOCATE ULRow, ULCol
        PRINT CHR$(201) + STRING$(LRCol - ULCol, CHR$(205)) + CHR$(187);
        FOR BoxY = ULRow + 1 TO LRRow - 1
            LOCATE BoxY, ULCol
            PRINT CHR$(186) + STRING$(LRCol - ULCol, " ") + CHR$(186);
        NEXT
        LOCATE LRRow, ULCol
        PRINT CHR$(200) + STRING$(LRCol - ULCol, CHR$(205)) + CHR$(188);
    END IF
END SUB

Posted on Dec 24, 2010, 1:45 PM

Respond to this message   

Return to Index


Re: Network 54's strange idiosyncracies

by (Login MarineDon)
R

This is to practice with ADJUST54.BAS to see if it really works.
Below is the QB45 file IdealMen.Bas. Don Smith

    DEFINT A-Z
    DECLARE SUB IdealMenu (IMenu$(), Choice, Row, Col, FG, BG, SD, ExitCode)
    Choice = 1 'Choice is placed before "begin:"
begin:
    COLOR 15, 1: CLS
    LOCATE 2, 30: PRINT "Ideal Menu Demo";
    LOCATE 20, 30: PRINT "Press <Esc> To Exit";
    REDIM M$(7)
    M$(1) = "1. One"
    M$(2) = "2. Two"
    M$(3) = "3. Three"
    M$(4) = "4. Four"
    M$(5) = "5. Five"
    M$(6) = "6. Six"
    M$(7) = "7. Seven"
    '-----------Setup for SUB IdealMenu---------------
    Row = 5  '.....Row to place menu
    Col = 34 '.....Column to place menu
    FG = 15  '.....Foreground color
    BG = 1   '.....Background color
    SD = 2   '.....SD=1 (single space) SD=2 (double space)
    ExitCode = 0
    CALL IdealMenu(M$(), Choice, Row, Col, FG, BG, SD, ExitCode)
    IF ExitCode = 27 THEN
        CLS : SYSTEM
    ELSE
        COLOR 15, 1: CLS : PRINT M$(Choice)
    END IF
    DO: LOOP WHILE INKEY$ = ""
    GOTO begin

SUB IdealMenu (IMenu$(), Choice, Row, Col, FG, BG, SD, ExitCode) STATIC
    MaxNum = UBOUND(IMenu$)
    FOR XYZ = 1 TO MaxNum
        LOCATE Row + (XYZ * SD) - SD, Col, 0
        PRINT IMenu$(XYZ);
    NEXT
    IF SD = 0 THEN SD = 1
    DO
        DisPlayFG = 15: DisPlayBG = 4 'HiLite color
        GOSUB Display
        DO
            Hit$ = INKEY$
        LOOP UNTIL LEN(Hit$) > 0
        Hit% = CVI(Hit$ + CHR$(0)) 'CVI code numbers!
        DisPlayFG = FG: DisPlayBG = BG 'regular color
        GOSUB Display
        IF Hit% = 13 THEN                        '<Enter>
            EXIT SUB
        ELSEIF Hit% = 27 THEN                    '<Esc>
            ExitCode = 27
            EXIT SUB
        ELSEIF Hit% > 48 AND Hit% < 48 + MaxNum + 1 THEN '<press a number>
            Choice = Hit% - 48 '0 = 48 and 9 = 57
            EXIT SUB
        ELSEIF Hit% = 18432 THEN                 '<UpArrow>
            Choice = Choice - 1
            IF Choice < 1 THEN Choice = MaxNum
        ELSEIF Hit% = 20480 THEN                 '<DnArrow>
            Choice = Choice + 1
            IF Choice > MaxNum THEN Choice = 1
        END IF
    LOOP
Display:
    COLOR DisPlayFG, DisPlayBG
    LOCATE Row + (Choice * SD) - SD, Col - 1, 0
    PRINT " " + IMenu$(Choice) + " ";
    RETURN
END SUB

Posted on Dec 24, 2010, 1:52 PM

Respond to this message   

Return to Index


*Thanks, Don (and Pete) -- seems to work great. Merry Christmas to you, too.

by (Login qb432l)
R

*

Posted on Dec 25, 2010, 1:13 AM

Respond to this message   

Return to Index


Indirect addressing not working

by (no login)

Hello

Trying to do some basic indirect addressing

Do I need to declair something to make it work.

Looking to do something like this

100 X=X+1
110 A(X)= 0
120 IF X < 100 THEN GOTO 100

THE QBASIC GIVE ME A FAULT AT 110 BECAUSE OF THE BRACKETS ?

SEEMS TO TAKE THE INDRECT ADDRESSING WITH NO FAULT FOR THE BELOW

IF I USE FOR TESTING

Z1= 100
X=1
A=Z(X)

BUT DOES NOT STORE THE VALUE OF Z1 INTO A

THANKS FOR ANY INPUT

Posted on Dec 20, 2010, 4:59 PM

Respond to this message   

Return to Index


What are you using brackets for?

by (Login burger2227)
R

If you say an array, then you are on to something. DIM the array at the start of the program. The number specifies how many values it can hold.

DIM A(100)

100 X = X + 1 'I bet there is a GOTO 100 somewhere or you'll never be back :-)
110 A(X) = 0 'sets index number X to zero
120 IF X < 100 THEN GOTO 100 'will GOTO 100, 100 times

First, you don't need line numbers in QB unless you are using GOTO to move around. Do yourself a favor and try to do things with loops instead.
GOTO will cripple your programming abilities!

Z1 = 100
X = 1
A = Z(X)

In your second example, Z1 has NOTHING to do with the Z array as far as Qbasic is concerned. You MUST reference an index inside of the brackets.

Z(1) = 100
X = 1
A = Z(X)

PRINT A 'displays 100

Ted


Posted on Dec 20, 2010, 7:21 PM

Respond to this message   

Return to Index


Re: Indirect addressing not working

by (Login MCalkins)
Moderator

qbasic requires that arrays with an upper bound above 10 be declared. as clippy showed you, use the DIM keyword to declare an array. if you do not declare an array, qbasic assumes an upper bound of 10. that is why your first example generated an "subscript out of range" error. notice that x is 11 when the error occurs. even though qbasic does not require that all arrays be declared, you should do so anyway.

dim arrayname (lowerbound to upperbound) as type

dim a(0 to 100) as integer
'this is a single dimension array of 101 integers. the lower bound is 0. the upper bound is 100.


dim c(0 to 7) as string
'this is a single dimension array of 8 variable length strings.

dim chessboard(0 to 7, 0 to 7) as integer
'this is a 2 dimension array of 64 integers. access the first element like this:
chessboard(0,0)=1

type employeetype
empname as string * 32
jobdesc as string * 32
wage as integer 'pennies per hour
end type
dim employee(0 to 9) as employeetype
'this array uses a user defined data type.

employee(0).empname = "sally"
employee(0).jobdesc = "clerk"
employee(0).wage = 725


here is a program that stores all 26 capital letters in an array:

defint a-z
dim letters(0 to 25) as string * 1
for i = 0 to 25
letters(i)=chr$(65 + i)
next i
for i = 0 to 25
print letters(i);
next i
print
system

Posted on Jan 10, 2011, 9:09 PM

Respond to this message   

Return to Index


Any batch file experts still alive?

by (Login burger2227)
R

I'm trying to change the name of a file so that I can copy it from one place to another after the BAS file becomes an EXE file. I also need two paths which I can get, but I need the filename by itself instead of with the whole path. Then I can just add the filename to both paths.

Drag and drop a text file on the BAT file using the code below:

REM returns absolute path and filename
set FILE=%1
REM returns current path W/O filename
set OLDIR=%CD%
REM displays values
echo.file %FILE%
echo.path %OLDIR%

REM TRY to remove current path from full file and path string
set str1=%FILE%
set str2=%OLDIR%
echo.%str1%
set str1=%str1:str2=%
echo.file %str1%
echo.old %str2%

REM This is how it should work using a literal string:
set str=the cat in the hat
echo.%str%
set str=%str:the =%
echo.%str%
pause

I'm trying to use values the batch file found instead of just taking a literal string out of the file path. Then I can add the \filename to the 2 paths in another folder.

Have any ideas?

Thanks,

Ted

Posted on Dec 19, 2010, 9:36 PM

Respond to this message   

Return to Index


Re: Any batch file experts still alive?

by (Login MCalkins)
Moderator

Notice that below, %CD% is not the same folder that the file is in. wouldn't that be a problem?

why can't you use a qbasic program to do it?

regards,
michael


C:\Documents and Settings\Administrator>REM returns absolute path and filename

C:\Documents and Settings\Administrator>set FILE="C:\Documents and Settings\Admi
nistrator\My Documents\hello.asm"

C:\Documents and Settings\Administrator>REM returns current path W/O filename

C:\Documents and Settings\Administrator>set OLDIR=C:\Documents and Settings\Admi
nistrator

C:\Documents and Settings\Administrator>REM displays values

C:\Documents and Settings\Administrator>echo.file "C:\Documents and Settings\Adm
inistrator\My Documents\hello.asm"
file "C:\Documents and Settings\Administrator\My Documents\hello.asm"

C:\Documents and Settings\Administrator>echo.path C:\Documents and Settings\Admi
nistrator
path C:\Documents and Settings\Administrator

C:\Documents and Settings\Administrator>REM TRY to remove current path from full
file and path string

C:\Documents and Settings\Administrator>set str1="C:\Documents and Settings\Admi
nistrator\My Documents\hello.asm"

C:\Documents and Settings\Administrator>set str2=C:\Documents and Settings\Admin
istrator

C:\Documents and Settings\Administrator>echo."C:\Documents and Settings\Administ
rator\My Documents\hello.asm"
"C:\Documents and Settings\Administrator\My Documents\hello.asm"

C:\Documents and Settings\Administrator>set str1="C:\Documents and Settings\Admi
nistrator\My Documents\hello.asm"

C:\Documents and Settings\Administrator>echo.file "C:\Documents and Settings\Adm
inistrator\My Documents\hello.asm"
file "C:\Documents and Settings\Administrator\My Documents\hello.asm"

C:\Documents and Settings\Administrator>echo.old C:\Documents and Settings\Admin
istrator
old C:\Documents and Settings\Administrator

C:\Documents and Settings\Administrator>REM This is how it should work using a l
iteral string:

C:\Documents and Settings\Administrator>set str=the cat in the hat

C:\Documents and Settings\Administrator>echo.the cat in the hat
the cat in the hat

C:\Documents and Settings\Administrator>set str=cat in hat

C:\Documents and Settings\Administrator>echo.cat in hat
cat in hat

C:\Documents and Settings\Administrator>pause
Press any key to continue . . .

Posted on Jan 10, 2011, 9:24 PM

Respond to this message   

Return to Index


POKEing graphics in SCREEN 12

by Pharoah (no login)

It's been a while, but I've had the idea that I want to write a (somewhat) optimized windowing system in QuickBasic. Since the whole program will end up being somewhat complicated, I want to optimize little things along the way, like drawing the windows themselves. My understanding is that PSET and LINE are fairly slow, so I want to POKE my information to the screen, but I can't find any information specifically pertaining to screen 12.

I'm still going to try to work it out on my own, but so far no luck. Any help, would be greatly appreciated. All I really need is an example of how to plot a single pixel.

Posted on Dec 19, 2010, 5:10 PM

Respond to this message   

Return to Index


oh no

by Ben (no login)

Posted on Dec 19, 2010, 5:30 PM

Respond to this message   

Return to Index


This seems to work for ploting a pixel

by Pharoah (no login)

But it's a bit complicated. It remains to be seen whether this is actually any faster than just PSETting the whole thing
to the screen:

'========================================BEGIN
SUB plot (x, y, c)
'Calculate byte address
l = 80 * y + x \ 8
'Calculate bitshift
s = x MOD 8
'Create mask for setting color
mask = (2 ^ (7 - s))
'Deconstruct color into four plane values
bcp = mask * (c AND 1)
c = c \ 2
gcp = mask * (c AND 1)
c = c \ 2
rcp = mask * (c AND 1)
c = c \ 2
icp = mask * (c AND 1)
'Create mask for preserving part of background
mask = NOT mask
'Write everything to the screen
DEF SEG = &HA000
OUT &H3CE, 4 'Enable first bitplane for reading
OUT &H3CF, 0
OUT &H3C4, 2 'Enable first bitplane for writing
OUT &H3C5, 1
POKE l, (PEEK(l) AND mask) OR bcp
OUT &H3CE, 4 'Enable second bitplane for reading
OUT &H3CF, 1
OUT &H3C4, 2 'Enable second bitplane
OUT &H3C5, 2
POKE l, (PEEK(l) AND mask) OR gcp
OUT &H3CE, 4 'Enable third bitplane for reading
OUT &H3CF, 2
OUT &H3C4, 2 'Enable third bitplane
OUT &H3C5, 4
POKE l, (PEEK(l) AND mask) OR rcp
OUT &H3CE, 4 'Enable fourth bitplane for reading
OUT &H3CF, 3
OUT &H3C4, 2 'Enable fourth bitplane
OUT &H3C5, 8
POKE l, (PEEK(l) AND mask) OR icp
END SUB
'========================================END

If only QB had proper bitshift operations

Posted on Dec 19, 2010, 6:21 PM

Respond to this message   

Return to Index


hey its Ben

by Ben (no login)

its gonna be very difficult to make one faster than pset in pure QB. And LINE is fast and so is GET & PUT compared to what can be achieved using POKE and QB. BTW, I keep hearing a low man's voice repeating all my thoughts like he is mocking me, and I can't stop it. Pretty strange huh.


DECLARE SUB plot (x%, y%, c%)
DEFINT A-Z
SCREEN 12

FOR i = 0 TO 640
plot i, 100 + 100 * SIN(i / 20), 12
NEXT

SUB plot (x, y, c)
DEF SEG = &HA000
o& = y * 80 + x \ 8
mask = 2 ^ (7 - (x AND 7))
OUT &H3CE, &H0
OUT &H3CF, c
OUT &H3CE, &H8
OUT &H3CF, mask
OUT &H3C4, &H2
OUT &H3C5, c XOR 15
POKE o&, PEEK(o&) AND (mask XOR 255)
OUT &H3C4, &H2
OUT &H3C5, c
POKE o&, PEEK(o&) OR mask
DEF SEG
END SUB

Posted on Dec 19, 2010, 9:31 PM

Respond to this message   

Return to Index


*Could you explain how your PLOT works?

by Pharoah (no login)

Posted on Dec 20, 2010, 9:26 AM

Respond to this message   

Return to Index


same as yours except

by Ben (no login)

there is latch that stores whatever was last read (PEEK) from memory and uses it to do logical operation & bitmask with in write mode 0 (default in qbasic) before writing to memory. 3ce,8 is bitmask field. xor was used to invert the right bits.

Posted on Dec 21, 2010, 11:09 AM

Respond to this message   

Return to Index


Read this stuff...

by (Login Mikrondel)
R

http://www.osdever.net/FreeVGA/vga/vga.htm

> All I really need is an example of how to plot a single pixel.

Not at all. Trying to hide the details of SCREEN 12 behind a PSET-like abstraction is misguided. This operation is not what the hardware was designed to be good at! QB already provides you an optimised PSET, and an optimised LINE anyhow.


You can improve performance only by taking advantage of the special operations the hardware lets you do. I'm sure there are many opportunities for this in a windowing system, but finding them is no easy task. You need to read the specification and not only understand the features provided, but also appreciate how they can be useful.

So read all about it at the link I provided above. If you can't see the significance of certain hardware features let me know and I'll discuss.

Posted on Dec 20, 2010, 4:36 AM

Respond to this message   

Return to Index


have you seen this book

by Ben (no login)

part 2 chapter 23

http://www.phatcode.net/res/224/files/html/index.html

Posted on Dec 20, 2010, 8:20 AM

Respond to this message   

Return to Index


That was interesting

by Pharoah (no login)

I'm not planning on writing any assembly (PEEK and POKE are about as low level as I'd like to get), but I'm always fascinated by how people used to squeeze so much performance out of the slow old 16 bit processors.

Posted on Dec 20, 2010, 9:34 AM

Respond to this message   

Return to Index


Hey, great find, Ben!

by (Login Mikrondel)
R

And it says - "Wringing the best performance from the VGA is no simple task, and it’s impossible unless you really understand how the VGA works—unless you have the internals down cold."

Which agrees with what I said. Heed it.

Posted on Dec 20, 2010, 3:10 PM

Respond to this message   

Return to Index


It's planar graphic

by angros47 (no login)

Screen 12 uses planar graphic: it's hard to program it directly.

I talked about it here:

http://imortisoft.no-ip.org/b2b/?Issue_%234:Retro_Tricks_II

Posted on Dec 23, 2010, 5:29 AM

Respond to this message   

Return to Index


Startup with whole computer dedicated to qb or Qb64

by (no login)

I am sure I am not the first with this question! Please tolerate with mercy.

In the bad old days you could (in DOS?) do a QB /AH and dedicate a HUGE amount of memory to basic
This at one stroke rid you of
Bill's crap
Isolated you (from the evil world) and let you get on with the job

So HOW do we implement on an SP2 stick
DUAL startup choice
either (a) Windows
or (b) QB


I ask this for me (XP) and for friends defiled with Windows 7

Many thanks
John

Posted on Dec 18, 2010, 2:04 AM

Respond to this message   

Return to Index


Install GNU/Linux

by (Login Mikrondel)
R

You can probably run pure DOS on your computer. Then you can use QB. The easiest way to run DOS is to boot off a floppy disk, but many computers don't possess floppy drives. Another option is to create a FAT partition on your hard disk and install some incarnation of DOS (such as FreeDOS) on it.

But QB64 requires either Windows or GNU/Linux.

GNU/Linux is a popular Free (as in "free speech") operating system. All the source code is available. It is extremely customisable and there are many different distributions, maintained by different people, catering to different needs and tastes. A decent place to start is Ubuntu. If you want to know more please post in our "Linux club" subforum.

Posted on Dec 18, 2010, 2:52 AM

Respond to this message   

Return to Index


If Qbasic cannot run fullscreen in XP try this fix.

by (Login burger2227)
R

Galleon will be upgrading QB64 in January and has stated that the Linux version should be caught up soon. The Qbasic keywords should work the same in both versions.

ON KEY should be the next keyword that will be added.

QB64 does not have the memory or speed limitations that Qbasic had. If you are having problems with Qbasic on XP, try this upgrade:

http://dl.dropbox.com/u/8440706/XPvideoFix.zip

Also try copying Autoexec.NT from C:\Windows\Repair to C:\Windows\System32

Posted on Dec 18, 2010, 6:56 AM

Respond to this message   

Return to Index


Re: Install GNU/Linux

by john (no login)

Many thanks Artelius

Posted on Dec 18, 2010, 11:25 PM

Respond to this message   

Return to Index


Re: Startup with whole computer dedicated to qb or Qb64

by (Login MCalkins)
Moderator

being a qbasic 1.1 person, not a qb 4.5 person, what exactly does /AH do? a quick search seems to indicate it makes large (>64K) dynamic arrays possible. if that's all it does, that's not quite dedicating the whole computer to qbasic. it seems you could get around that anyway by requesting extra memory with xms. does /AH not work in xp?

why would you need the whole computer dedicated to qbasic? the advantage to running qbasic inside windows is that you can copy and paste to other programs, be reading documentation at the same time, be debugging output, etc. the ideal qbasic programming environment is a windows 98se computer. it offers strong dos compatibility and the advantages of a windowed, multitasking environment.

if you're just trying to get around ntvdm's stupidity, then either do what artelius said (install freedos on a fat partition, and use a bootloader like SBM (i would think ntldr would be capable, but i'm not sure)), or use dosbox or bochs with freedos. but none of those are going to help you around qbasic's environment limits, including it's real mode nature.

regards,
michael

Posted on Jan 10, 2011, 9:46 PM

Respond to this message   

Return to Index


I thought AH was something from FreeBasic...

by (Login The-Universe)
Admin


Actually, I'm kidding. It does what your research results discovered. I needed to use it once to get a little extra memory to make a large application run.

Pete

Posted on Jan 11, 2011, 11:12 AM

Respond to this message   

Return to Index


John replied by email instead of on the forum.

by (Login MCalkins)
Moderator

Hi Michael

Thank you for your advice to my message titled "Startup with whole computer dedicated to qb or Qb64"
At: http://network54.com/Forum/message?messageid=1292666660&forumid=648955


/AH mode allows "arrays huge" and gives increased memory access "up to the whole computer"

It is not that we want to exclude Windows - it is a kluge and malware risk and we hate it, but use it - it is simply the Bill Gates in his Windows 7 does not ALLOW you to run QB (except in dreadfully slow DosBox)

We want "dual bootup" - a CHOICE between Windows or QBASIC.
But Bill has never heard of memory sticks and has deleted floppy disk startups!

For Windows XP there are ways around Bill and then you CAN run QB within Windows.
For Windows 7 he implies that by buying an external floppy drive you can boot up without windows (but you can't).
We want to run QB at FULL SPEED under Windows 7 (or else put Windows 7 in the trash where it belongs and replace it with XP).

In either case the modern way is to load from a memory stick (one for each mode of operation it you like)

I hope this has made clearer what we are trying to do.
At present my US friend cannot run the QB progs I write (planetary simulations) because he is FORCED to do so under DosBox which is hundreds of times slower.

Many thanks for any ideas and suggestions
John

Posted on Jan 11, 2011, 2:11 PM

Respond to this message   

Return to Index


Re: John replied by email instead of on the forum.

by (Login MCalkins)
Moderator

>/AH mode allows "arrays huge" and gives increased memory access "up to the whole computer"

i'm guessing here, but i don't think qb 4.5 lets you get extended memory directly. i think pds 7.1 lets you get ems. you can get xms in qbasic 1.1 or qb 4.5 by using assembly routines to interact with the xmm. all the qb versions (qb, qbasic, and pds) are real mode, meaning they operating in 16 bit segmented memory addressing mode. they are inherently limited to just over 1 mb. real mode programs can use xms or ems to indirectly access memory above 1 mb.

qb64 and freebasic use protected mode. they should allow you to use as much memory as you need.

>it is simply the Bill Gates in his Windows 7 does not ALLOW you to run QB (except in dreadfully slow DosBox)

probably x64, then. if i remember right, x64 version from xp on don't have ntvdm.

>We want "dual bootup" - a CHOICE between Windows or QBASIC.

then your best option is to resize your ntfs partition, create a fat partition, install freedos, and use a boot manager.

>For Windows 7 he implies that by buying an external floppy drive you can boot up without windows (but you can't).

the ability or inability to boot to a floppy drive is a bios issue, not a windows issue. perhaps SBM (smart boot manager) might be able to help.

it is also possible to burn a cd to boot into a mode that emulates a floppy. the windows 98se installation cd, for example, uses that mode, to boot dos.

regards,
michael

p.s. i'm not sure, but having a sata hdd might complicate an attempt to use dos on it. i don't know if freedos has sata compatibility. you might need to change you hdd sata mode in your bios.

Posted on Jan 11, 2011, 2:24 PM

Respond to this message   

Return to Index


Clippy you got email

by (no login)

Clippy you got email.
OlDosLover

Posted on Dec 17, 2010, 10:23 AM

Respond to this message   

Return to Index


LOL

by Unseen Machine (no login)

I love that you think clippy will check here before he checks his emails!!!

Posted on Dec 17, 2010, 2:01 PM

Respond to this message   

Return to Index


* He was right! I did...

by Clippy (Login burger2227)
R

Posted on Dec 17, 2010, 3:12 PM

Respond to this message   

Return to Index


Help Please

by Zack (no login)

I have a few questions.

I found out how to use the _ROUND(#) function, but is there a way to specifically round up or down rather than to the nearest whole number?

I have a program where you input data and it solves a mathmatical problem. I used IF commands for the input and also used ELSE. When they enter a number, I made it check if it is valid like:
---
BLAH:
INPUT ": ", A
IF A >= 0 AND A <= 50 THEN
PRINT "Blah"
ELSE
GOTO BLAH
END IF
---
This works well, however, if you enter like 5.738759265 it will take it. How can I get it to only accept whole numbers. Also, is there a way to the previously mentioned but only accept an input up to 2 decimals (ex/ 4.67 works, but 4.677 would not work)?

How can I get the program to wait until the song has finished playing to move to the next command?

How can I set a picture as the background rather than just a color?

And is there a way to Print a picture in Screen 0 along with text, or do you have to switch to Screen 13?

Thank you very much for any help you give me and thanks so much to the people who have already helped me before. Without you guys, i probably would have never been able to figure it out.

Posted on Dec 16, 2010, 7:19 PM

Respond to this message   

Return to Index


Some answers

by (Login Mikrondel)
R

> I found out how to use the _ROUND(#) function, but is there a way to
> specifically round up or down rather than to the nearest whole number?

For small numbers (up to 32767) you can use INT to round down and FIX to round towards zero. I'll let you figure out how to round upwards.


> How can I get it to only accept whole numbers.

INPUT is quite limited. INKEY$ lets you detect individual keypresses which can be used to build something that does exactly what you want.


> How can I get the program to wait until the song has finished playing to move to the next command?

How are you playing sound? If you use _SNDPLAY then you can do something like

DO
LOOP WHILE _SNDPLAYING


> How can I set a picture as the background rather than just a color?

Not directly (as far as I know). You basically need to "draw" the background yourself whenever you put anything on the screen. There are some techniques to help.


> And is there a way to Print a picture in Screen 0 along with text, or do you have to switch to Screen 13?

SCREEN 0 is text only. In DOS (and therefore QB) the graphics card was in a special, fast, text-only mode. In QB64 that isn't the case but for compatibility I don't think SCREEN 0 supports images.

You're not stuck with SCREEN 13, though. QB64 offers much more flexible screen modes. Refer to http://qb64.net/wiki/index.php?title=SCREEN_(statement)

Posted on Dec 17, 2010, 12:11 AM

Respond to this message   

Return to Index


Thanks

by Zack (no login)

That helped alot, thanks. But can someone elaborate on the INKEY$ usage in this situation. Also, if there isnt a way to make a picture in the background, is there a program that can be used to design the interface thats compatuble with QB64?

Posted on Dec 17, 2010, 2:13 AM

Respond to this message   

Return to Index


Rounding up

by Solitaire (Login Solitaire1)
S

CINT will only work with small numbers (up to 32767). For larger numbers, you can use CLNG. Both these functions will round to the nearest even number (Banker's Rounding) if the midpoint is 5.

INT will work with any number up to 7 digits before the decimal point. It will truncate anything to the right of the decimal point.

downnum = INT(decnum)

To get the next higher number, you can do this:

upnum = INT(decnum) + 1

In Visual Basic (and in Excel), these Math methods are called Floor and Ceiling.

In order to round up to the nearest whole number if the midpoint is 5, then add .5 to the number before INT. Example:

wholenum = INT(decnum + .5)

Posted on Dec 17, 2010, 5:32 AM

Respond to this message   

Return to Index


* I think I hear Moneo coming! :-)

by (Login burger2227)
R

Posted on Dec 17, 2010, 10:06 PM

Respond to this message   

Return to Index


*Thanks for the warning

by (Login Mikrondel)
R

Posted on Dec 18, 2010, 12:35 AM

Respond to this message   

Return to Index


I give up

by Moneo (no login)

I think I've beaten the subject of rounding to death, and even wrote an extensive tutorial. However, it seems that people still want to do rounding their own way. I guess it has to do with the "not invented here syndrome".

Regards... Moneo

Posted on Dec 18, 2010, 11:12 AM

Respond to this message   

Return to Index


Well Moneo, like I always say... If you can't beat 'em...

by (Login The-Universe)
Admin


You aren't hitting them hard enough! happy.gif

Pete

- Merry Christmas to you and your family.

Posted on Dec 18, 2010, 9:39 PM

Respond to this message   

Return to Index


Re: Well Moneo, like I always say... If you can't beat 'em...

by moneo (no login)

Thanks for the words of wisdom.

And a very Merry Christmas to you and yours.

Warm regards... Moneo

Posted on Dec 19, 2010, 11:06 AM

Respond to this message   

Return to Index


How to get numbers out of QBASIC

by (no login)

With Qbasic I can generate a stream of numbers
To what memory location do I send them to be read EXTERNALLY at one of the sockets on my XP computer in real time (less than one second delay)?

Either after D/A or before.

Everyone says "Can't be done - Bill prevents this!"

Many thanks
john

Posted on Dec 16, 2010, 2:56 AM

Respond to this message   

Return to Index


* Try a file.

by Clippy (Login burger2227)
R

Posted on Dec 16, 2010, 3:22 PM

Respond to this message   

Return to Index


*I think he wants to send it out on serial/parallel port

by (Login Mikrondel)
R

Posted on Dec 16, 2010, 4:14 PM

Respond to this message   

Return to Index


* I thought the same.

by (Login The-Universe)
Admin

Posted on Dec 16, 2010, 4:36 PM

Respond to this message   

Return to Index


yes, I want to HEAR it (for example on phones)

by (no login)

I generate a stream of modulated pulses of varying shape.
Now I want to feed them to an audio amp under test and measure the results in real time as I wary the pulses.
John

Posted on Dec 16, 2010, 11:01 PM

Respond to this message   

Return to Index


* What port and what OS? Look for LPT or COM component settings.

by Clippy (Login burger2227)
R

Posted on Dec 16, 2010, 9:50 PM

Respond to this message   

Return to Index


Re: * What port and what OS? Look for LPT or COM component settings.

by (no login)

Sorry, Clippy, I do not understand

I operate under Windows XP, and defeat Bill in order to run QB.

What is a "component setting"
If I send to the line printer then between which two wires does the number-stream appear?
Won't it be data codes (digital) for letters of the alphabet?

If I write a "file", can it be numbers?
Is there an internal D/A I can use, or must it be external?

Can it be read from a computer port to the outside world (which one?)while still being added to?
Which memory address do I send the numbers to?

Many thanks
John

Posted on Dec 16, 2010, 11:34 PM

Respond to this message   

Return to Index


What do YOU want to use?

by Clippy (Login burger2227)
R

Do you have a parallel port? What do you want to do? You are telling us nothing! Give us your idea!

I have been running QB on my 32 bit XP for 5 years without a problem. What did you have to do?

The port settings are in Control Panel - Performance and Maintenance - System - Hardware - Device Manager. The HEX addresses for LPT or COM are listed there when you click on them.

Posted on Dec 17, 2010, 12:03 AM

Respond to this message   

Return to Index


Re: What do YOU want to use?

by john (no login)

Clippy
You have hit on a central problem of computer use.

UNTIL you have experience, HOW can you tell what you want to use?

I just want to get the job done - I care not how.

The job is to send an actively real-time-computed waveform to the outside world (as volts)
So what hardware and software is the best way to do that (or even a good way)please?

As I have a thingy called "audio output socket", let's use that if we can defeat the obstacles Bill gates puts in our way?

Any suggestions you have would be greatly appreciated. Is line printer LPR a good way? Why? How? Which two wires?

Many thanks
John

Posted on Dec 18, 2010, 11:38 PM

Respond to this message   

Return to Index


What's between you and Bill Gates for crying out loud!

by (Login burger2227)
R

BILL GATES HAS NOTHING TO DO WITH THIS! A MAC would have the SAME problem!

Computers don't send out amplified VOLTAGE. They can send only on-off pulses of the same voltage that you would have a hard time regulating. AN LPT or COM port sends out data at set speeds. You may delay sending them, but you cannot get the timing accuracy to create certain notes.

What do you mean by an "audio output socket"? Where does that PLUG IN? The audio card can't connect to a port. It IS a port to the speakers! Your NOT gonna drive a speaker with the LPT or COM port.

Voltage has nothing to do with sound. Frequency does! You don't want ANY port voltage on the speaker as it would burn up the PC.

Posted on Dec 19, 2010, 1:35 AM

Respond to this message   

Return to Index


Not sure about all that...

by (Login Mikrondel)
R

> BILL GATES HAS NOTHING TO DO WITH THIS! A MAC would have the SAME problem!

Macs don't have parallel ports :) Different problem.

That said, blaming Bill Gates for every one of your computer problems (and meaning it) is a bit childish. Microsoft does some evil things and some incompetent things but changing APIs in order to facilitate multiprogramming and make crashes and hangs less likely isn't one of them.


> Computers don't send out amplified VOLTAGE.

Well, they can. Not on a parallel port of course. But an audio-out port, say.


> They can send only on-off pulses of the same voltage that you would have a hard time regulating. AN LPT or COM port sends out data at set speeds. You may delay sending them, but you cannot get the timing accuracy to create certain notes.

Maybe not under Windows, but in pure DOS you can get pretty high frequencies.


> What do you mean by an "audio output socket"? Where does that PLUG IN? The audio card can't connect to a port. It IS a port to the speakers!

I think that's the point! Playing waves using the sound card! (Actually you can use your sound card as a primitive oscilloscope by connecting something to the microphone port.)

> Voltage has nothing to do with sound. Frequency does! You don't want ANY port voltage on the speaker as it would burn up the PC.

Voltage has a lot to do with sound! Because there's a linear relationship between voltage and diaphragm displacement. Generating audio on a PC involves generating a sequence of voltages.

The frequency domain is used for compression and effects but sound must be expressed in the time domain before being turned into electrical signals.

Posted on Dec 19, 2010, 2:34 AM

Respond to this message   

Return to Index


Voltages

by (Login burger2227)
R

Sure, you need some kind of voltage, but a parallel port only can send 5 volts and a COM port sends the same voltage while it transmits ranging up to 25 volts perhaps. So if the voltages can't be altered, the only thing left is frequency modulation.

Speakers work on changes in voltage from on to off. You can put a capacitor in line with the output of a sound card to isolate the DC voltage from the speaker and still get sound. An LPT port would probably burn up trying to run the current draw of a speaker.

So you point by point me and THEN provide NO solution or code anyhow? What good does that do? I already KNEW you were smart, so don't EVEN TRY to impress ME! happy.gif

Ted

Posted on Dec 19, 2010, 8:11 AM

Respond to this message   

Return to Index


I DID provide a link to a related program...

by (Login Mikrondel)
R

> if the voltages can't be altered, the only thing left is frequency modulation.

True, but the OP never said he was restricted to use LPT or COM ports.

Posted on Dec 20, 2010, 4:07 AM

Respond to this message   

Return to Index


This reminds me of a joke

by qbguy (no login)

How do you do a fast Fourier transform on Windows Vista?

You can't -- as soon as you run Windows it stops being fast.

Posted on Dec 21, 2010, 12:47 PM

Respond to this message   

Return to Index


Not true! To the Cloud to respond with my Windows Live....

by (Login The-Universe)
Admin


S...e...e, I.... c....a..n................................................................

N54 Messenger: Sorry, stale post. Please try to redo your response.

Posted on Dec 21, 2010, 4:17 PM

Respond to this message   

Return to Index


Re: What's between you and Bill Gates for crying out loud!

by john (no login)

Thanks Clippy for trying to help.

Sound is caused by motion and IS waves in the air

Motion can be caused by a transducer.
If we send this transducer energy pulses it will make sound.
It generates a wave whose amplitude (and thus shape - the timbre of the sound) can be controlled by the pulses

If you want all pulses of fixed height, then use Pulse-width modulation.
So our basic prog could generate digital 1 pulses that deliver a wave (total energy volts squared times time)E per microsecond by altering the pulse-spacings.

My qbas prog does that, so all we need is a way to feed them to headphones.
But Bill says Not Allowed.

John

Posted on Dec 19, 2010, 4:13 AM

Respond to this message   

Return to Index


Bill retired, but M$ is still pulling in the reins...

by (Login burger2227)
R

Yes, from what I have heard Windows 7 is even more "secure". They don't want people accessing ports or the sound cards anymore. I gather that a LOT of people blamed M$ for their ignorance about how to access them correctly so they shut them down.

There MUST be a way however as they are still making programs that can read the sound frequencies and display them. Some people at QB64 were trying to create sounds too. They only got a few things to make NOISE. Not exactly what they had in mind.

QB64 has an extended PLAY function that can now control the volume and make multiple notes using a comma so that they play simultaneously. Perhaps you could try that.

Ted

Posted on Dec 19, 2010, 12:06 PM

Respond to this message   

Return to Index


Re: Bill retired, but M$ is still pulling in the reins...

by john (no login)

I am sorry that as a complete newbie to your QB64 I can only admire and ask questions.
I have not got farther than loading qb64 and running a dozen of my QB progs and finding that some run while the others (in QB64) "cannot be found".

I am no where NEAR providing solutions (yet alone code) within qb64.

All I am any good at is writing QBASIC progs to solve engineering and physics and maths problems by simulation and finding out "what happens if...."

One day I shall be able to help, but for now I am a parasite. Also as the great Hungariam maths chap said on his gravestone "At last, no longer the stupider I get"
Thanks for you help and patience
John

Posted on Dec 19, 2010, 8:42 PM

Respond to this message   

Return to Index


Are you putting the files in the QB64 folder?

by (Login burger2227)
R

You can make a BAT file to run it from anywhere, but QB64 looks for BAS files in that folder.

Here is a program to create the batch file:

http://dl.dropbox.com/u/8440706/QB64BAT.zip

If you add it to the BAS Right click menu you can compile from any folder by Right clicking and Open With...

All BAS files must be saved as TEXT readable in QB4.5.

Posted on Dec 19, 2010, 9:20 PM

Respond to this message   

Return to Index


Use QB64?

by (Login Mikrondel)
R

I made a tone generator that goes through the horrible process of generating a WAV file on the fly. But it does the job. Give the program a try to see what I mean. If you want help in modifying the program let me know.

http://www.qb64.net/forum/index.php?topic=1168.0

Posted on Dec 17, 2010, 2:31 PM

Respond to this message   

Return to Index


Re: Use QB64?

by (no login)

WOW, Artelius, I am impressed!!
You guys have been working on this for some time! Congratulations.

I am fascinated by your post, and prog, and the many replies and ideas and comments you received!

One I liked best was "Never think small!"
Knowing that oscillators revolutionised electronics, back in 1960s I built a chemical oscillator. A chap secretly behind the iron curtain beat me to it, and was ridiculed: it was (like all new things) KNOWN to be impossible.

In the days I first used computers (1961) I was fascinated by the need for progs that would SELF-improve! Evolve! Mess with themselves and breed only those that worked better.
Dead simple if only you can say what is "better" and in those days get any of your mutants to run at all.

It has ALL to do with "feedback" - how flutes, organ pipes and lasers work!

And nowadays we can SIMULATE any feedback ideas we have in real time!



OK, HOW do I download your QB64 (not obvious to me! - can't see how or where or which "version"). Is it better than QB that I do all my simulations on?

Ok "Don't think small"
I want to generate dynamically changing real-time sound
BE a Lady Ga Ga. Transcend her! Self-optimise her!

Please help me
John

Posted on Dec 18, 2010, 1:15 AM

Respond to this message   

Return to Index


You can get QB64 from here...

by (Login Mikrondel)
R

http://www.qb64.net/forum/index.php?board=2.0

Get the latest version.

> Is it better than QB that I do all my simulations on?

Yes. It has very good QB compatibility (if you have any issues let us know and we'll help you work through them). However it runs as a 32-bit program so it's faster and has access to much more memory.

One of our members, Galleon, created QB64 and is the main developer.


> It has ALL to do with "feedback" - how flutes, organ pipes and lasers work!

Yes it does. You've no idea how relevant that statement is to me right now :D

Posted on Dec 18, 2010, 1:28 AM

Respond to this message   

Return to Index


Getting QB64 - there is a typo

by (no login)

I have been telling all my friends abt qb64

They are having problems as this copied below does NOT work!

QB64 V0.91 is released (source code too!)
0
Posted in Uncategorized by Qbasicnews.com - QB/FB News
August 11, 2010

The QB64 project is moving right along with a new release! This new version includes an update feature that updates the compiler package when new files are added/changed. It comes with a "classic" Qbasic looking IDE. QB64 is now a self-compiling compiler and SOURCE CODE IS INCLUDED!

The project has a growing community of active & helful Qbasic fans and a decent wiki. Most Qbasic/QB BAS code will compile with QB64.

For details on this release and for a QB64 download just go here:
[url=ht...

TYPO HERE?

Posted on Dec 18, 2010, 11:06 PM

Respond to this message   

Return to Index


*I'm confused as to what the problem is. Did you go to the link I provided?

by (Login Mikrondel)
R

Posted on Dec 19, 2010, 12:02 AM

Respond to this message   

Return to Index


Re: *I'm confused as to what the problem is. Did you go to the link I provided?

by john (no login)

The problem is the typo I copied for you: the site many people discover you on does NOT have a working download.

Yes, for myself, thank you very much - you told me how and that one DID work!

I am just trying to warn you that the other one does NOT work, and often it is THAT one newcomers discover QB64 in and cannot download it so give up

Maybe my message giving details never arrived?
Is there not some way I can SEE what I am replying to? See if my message is missing from the list.

Posted on Dec 19, 2010, 12:30 AM

Respond to this message   

Return to Index


Re: *I'm confused as to what the problem is. Did you go to the link I provided?

by john (no login)

For details on this release and for a QB64 download just go here:
[url=ht...

TYPO HERE?
This is what doesn't work [url=ht...

Posted on Dec 19, 2010, 12:34 AM

Respond to this message   

Return to Index


*Which site is that on?

by (Login Mikrondel)
R

Posted on Dec 19, 2010, 1:00 AM

Respond to this message   

Return to Index


non wkg download

by john (no login)

http://www.qbasic.com/

Posted on Dec 19, 2010, 3:59 AM

Respond to this message   

Return to Index


So Please please say more!!!

by john (no login)

in reply to my
> It has ALL to do with "feedback" - how flutes, organ pipes and lasers work!

You said:-
Yes it does. You've no idea how relevant that statement is to me right now :D

Please expand.

If I pass ONE THING on to my grandson it will be this:-
WHATEVER the subject FEEDBACK is VITAL and central to new invention.

Posted on Dec 18, 2010, 11:17 PM

Respond to this message   

Return to Index


More

by (Login Mikrondel)
R

The importance of feedback has demonstrated itself to me many times.

But recently I've become involved with a new development in computer technology - a radically different approach with the potential to have a huge impact on the industry. I can't reveal any more, suffice to say that feedback is critical.


Also, Australia seems to have been minimally affected but the economic downturn. I don't know much about it but my belief is that we have the right feedback mechanism. At the core of it is our target inflation rate of 2 to 3%.

Posted on Dec 30, 2010, 12:43 AM

Respond to this message   

Return to Index


Let me guess, your top-secret project is...

by (Login The-Universe)
Admin


A product that hangs over your ears and allows you to see a heads up holographic image in front of you... and it will be called...

The iGlasses

Pete happy.gif

Posted on Dec 30, 2010, 7:08 PM

Respond to this message   

Return to Index


More meaning for EVERYTHING

by john (no login)

Artelius

My project is yet more secret than yours!
All I can say is it comes in TWO REVELATIONS:-
1. NOTHING is linear (all that schools stuff is crap)
2. Feedback is the KEY to the wonders of the world, understanding and simulating them and being impressed by them

I am working to simulate the UK economy - starting from "the Bank" and its "inflation policy"

I agree that Australia is the place to be!
My daughter Samantha EVENTUALLY realised that UK was doomed after trying v hard for 30 years. She now lives in Perth WA happily with GREAT people that VALUE her and have given 4 promotions in 18 months.

Australia is simply ALIVE - with "can do" people


At Samantha's ultimate UK interview she was summoned on high by the "boss of bosses" and told these very words:-

Congratulations, we are promoting you to "Pincipal Surveyor".
No salary increase but a GREAT jump in well-deserved status"

To the proffered handshake she replied
"Well, Sir, You did that LAST YEAR - don't you remember?"

My son too is going to Australia, taking my Grandson.


Posted on Dec 31, 2010, 2:01 AM

Respond to this message   

Return to Index


trying to use qb64

by john (no login)

My friend Delmer in USA (a QB vereran) is using Windows Vista and HAS downloaded your qb64 but CANNOT unzip it
This is what he says:-

Finally been able to find and download the QB64 zip file; the computer said that it would take over six hours, so I did it overnight. But now I can't UNzip it! My computer just says that it can't do it, and my PKUNZIP program will unzip only the "audio.txt" part of the program, which is just some instructions for audio. How do you unzip it? I can't find any unzip routine in Windows Vista.

Please help. Mine unzipped OK - but I am on XP
Many thanks
John

Posted on Dec 28, 2010, 1:43 AM

Respond to this message   

Return to Index


Tell your friend to try downloading 7-Zip

by (Login The-Universe)
Admin


But if he can't open the archive with 7-Zip, then something went wrong with the QB64 download, and the file is corrupt.

What I wish Galleon would do is take my advice and make a stripped down version, without that darn example folder, which is freakin' huge and would take anyone on dial up forever to download, as I suspect happened in this case.

Maybe someone could zip the essential files and put them on a file share service like Send File?

Well, don't give up hope, the project is really worth having and if Galleon, the creator, doesn't respond here shortly, you can also post or link to this post at QB64.net.

Welcome to the forum,

Pete

Posted on Dec 28, 2010, 2:02 AM

Respond to this message   

Return to Index


* Maybe he should just post the Example download separately from the QB64 one.

by (Login burger2227)
R

Posted on Dec 28, 2010, 9:26 AM

Respond to this message   

Return to Index


* Exactly

by (Login The-Universe)
Admin

Posted on Dec 28, 2010, 9:49 AM

Respond to this message   

Return to Index


*Clippy Clause? You must work in some cat grooming place :o)

by (Login qb432l)
R

*

Posted on Dec 28, 2010, 12:45 PM

Respond to this message   

Return to Index


BILL GATES STOPS HIM

by John (no login)

My friend tried your advice with 7-Zip and says:

Can't even download the 7-Zip program. Tried, but no luck. Apparently "Uncle Bill" does not think that I should download any real programs, that have a BAS or EXE extension.

My friend Delmer and I get round this by changing the .exe to idiot .eyz and often this DOES get past the Windows7 secret police.

HOW can I send him a copy of 7-zip that the thought police allow him to receive?

And someone asked WHY we hate Bill!!!!!!!

john

Posted on Dec 31, 2010, 1:42 AM

Respond to this message   

Return to Index


Re: Use QB64?

by john (no login)

I Like your prog.

So any "music prog" like 'orrid Windows MediaPlayer can put out one of your 3 waveforms on the headphones socket or "burn" it to whatever.

That is a GREAT start.
Now how about a dynamically-changing waveform generated by a .bas prog on the fly?
How about reading it WHILE new waveform is being fed in?
No temp storage please.

Would that be difficult with your prog?

John

Posted on Dec 19, 2010, 12:21 AM

Respond to this message   

Return to Index


You can use the mouse to modify the tones

by (Login Mikrondel)
R

The sound changes in almost real time. Which I think is what you wanted.

Posted on Dec 19, 2010, 1:02 AM

Respond to this message   

Return to Index


Re: You can use the mouse to modify the tones

by john (no login)

It sounds extremely promising!

So rather, than the mouse, can I feed it a digital number-stream (from Qbas) to control the wave-shape?

What problems would I face?
john

Posted on Dec 19, 2010, 4:18 AM

Respond to this message   

Return to Index


It shows the principle...

by (Login Mikrondel)
R

Nothing particularly mysterious going on. The program just updates a WAV file and then gets QB64 to play it. It would be easy to get rid of the mouse interface and generate the waves some other way.

Unfortunately there is a slight delay when you change the WAV file, so playing continuously changing sounds is a bit problematic. You could of course create a longer WAV file, this would reduce that problem, but then you can't change the sound in "real time".

I'm tempted to implement a change to QB64 that fixes this.

Posted on Dec 20, 2010, 4:21 AM

Respond to this message   

Return to Index


continuous variable .wav sound

by john (no login)

Artelius,

Yes, please do modify QB64 to eliminate the delay-per-change.
That would be GREAT! The basis for a truly exciting music prog.

But I am still not sure if we are talking at cross-purposes, for your prog, under mouse control, changes the ENTIRE sound (from one waveform to another): a kind of static change - once per mouse click.

In CONTRAST the numbers generated by my QBASIC are continuously added "at the front end" and get to be played dynamically as part of the changing sound after a small delay (say 1/4 second)

I don't know HOW the various progs that let you copy a sound CD do this - but you can play the music WHILE the copy is being made.

Many thanks for your help and ideas on this
John

Posted on Dec 29, 2010, 11:21 PM

Respond to this message   

Return to Index


Re: continuous variable .wav sound

by john (no login)

How do I get the above message to be blue - showing I'd like an answer?

Posted on Dec 31, 2010, 2:05 AM

Respond to this message   

Return to Index


*Messages you've read are purple, those you haven't are blue. That's all.

by (Login Mikrondel)
R

Posted on Dec 31, 2010, 10:26 PM

Respond to this message   

Return to Index


Some advise needed with making a search tool..

by (no login)

Hello for a project of mine i need to replace some value's in a file with other value's.

There for i need to program a replace tool which reads a given variable recalculate its value and replaces it trough out the hole file.

I made a start but i cant figure out how to do it right, maby there is some sample code for doing this...

All help is welcome,

PeterEdlin.

Posted on Dec 15, 2010, 11:01 AM

Respond to this message   

Return to Index


* Read the data, fix, then put it in a TEMP file. After closing it NAME AS old name.

by (Login burger2227)
R

Posted on Dec 15, 2010, 12:21 PM

Respond to this message   

Return to Index


Hey guys, Im back with more questions =P

by Zack (no login)

My program is going well, however I do have a few questions.

1-How do you get a song to loop? I can get it to play using _SNDPLAYFILE but on the wiki page it saya to use h& _SNDLOOP. I know h& means it wants me to set a handle, but in what syntax, it doesnt explain that very well.

2-How do you make a header and footer kind aof thing? I would like to have a bar at the bottom that always displays the version number and my name, and one at the top like a menu bar. On the menu bar, I would like it to have a few tabs that open up and depending on which you click, it will run scrilt to do different things.

Any help will be greatly appreciated.

Posted on Dec 13, 2010, 7:23 PM

Respond to this message   

Return to Index


Sound handles are created by _SNDOPEN

by Clippy (Login burger2227)
R

Posted on Dec 13, 2010, 10:31 PM

Respond to this message   

Return to Index


Ok, but

by Zack (no login)

I have looked through all of those. That wasnt really the question I was asking. I cannot figure out how to actually make it work. I tried:

---
sound_handle1 = _SNDOPEN(song.mp3)
_SNDLOOP (handle1)
---

But that didnt work. I just need an example of the syntax where it would work.

And also, for future reference, when it says h&, what does it mean. If I was to guess Id say the h means handle and the & is asking for a number, but it is confusing on the wiki page.

Posted on Dec 14, 2010, 12:14 PM

Respond to this message   

Return to Index


The & is a type identifier...

by (Login qb432l)
R

In other words, the handle is a long integer, so:

Theme& = _SNDOPEN("song.mp3", "VOL") 'capabilities list follows song name (optional)
_SNDLOOP Theme&

...and then if you want it to stop looping while the program is still running:

_SNDSTOP Theme&

BTW, if you're going to use the handle& in a sub program, be sure to DIM it as SHARED at the top of your program.

-Bob

Posted on Dec 14, 2010, 12:23 PM

Respond to this message   

Return to Index


Thanks

by Zack (no login)

Yay, it works now thank you :DDD

Posted on Dec 16, 2010, 7:02 PM

Respond to this message   

Return to Index


* Could the h& be a formatting code for hexadecimal?

by Solitaire (Login Solitaire1)
S

Posted on Dec 14, 2010, 5:49 PM

Respond to this message   

Return to Index


*No -- the "h" just stands for "handle" -- an example long-integer variable name

by (Login qb432l)
R

*

Posted on Dec 14, 2010, 6:06 PM

Respond to this message   

Return to Index


VIEW PRINT to freeze part of the screen.

by Solitaire (Login Solitaire1)
S

To freeze the screen and allow scrolling only in the rows between x and y:

VIEW PRINT x TO y

To unfreeze, use VIEW PRINT alone. Here is an example program:

==========================================================================
CLS  'Set scroll area with VIEW PRINT; freeze top and bottom lines
PRINT "The top line will stay frozen. To unfreeze, press the Tab key."
LOCATE 24: PRINT "The bottom line will stay frozen";
VIEW PRINT 3 TO 23

PRINT "The center of the screen will scroll text entries."
PRINT "The top and bottom lines will be frozen and won't scroll."
PRINT "Keep pressing any key to speed up the scrolling."
count = 0
DO
    count = count + 1
    PRINT "This is repeat # "; count
    K$ = INKEY$
    SLEEP 1
LOOP UNTIL K$ = CHR$(9)
VIEW PRINT  'This will unfreeze the screen
DO
    PRINT "Press Esc when you are ready to end program."
    K$ = INKEY$
    SLEEP 1
LOOP UNTIL K$ = CHR$(27)
END

Posted on Dec 13, 2010, 10:48 PM

Respond to this message   

Return to Index


* I take it you use SLEEP 1 to reduce CPU usage.

by (Login The-Universe)
Admin

Posted on Dec 13, 2010, 11:37 PM

Respond to this message   

Return to Index


No, it's just to slow things down so you can see each line.

by Solitaire (Login Solitaire1)
S

After all, it's only a demo intended to show how the top and bottom of the screen stay put while the content in the center changes. The actual content in the center is what the OP intends to display.

Posted on Dec 14, 2010, 12:28 AM

Respond to this message   

Return to Index


Apparently in QB 4.5, SLEEP doesn't decrease CPU usage.

by (Login The-Universe)
Admin


I didn't see the PRINT statement in the loop before. I have my resolution set to super squint vision these days. It allows me to open a lot of windows, but it is very hard on my eyes.

Just for fun, I ran it this morning to fiddle with the possibility that SLEEP might affect CPU usage. Although in QB46 delays like _DELAY, and SLEEP decrease CPU usage, in QB4.5 it doesn't seem to matter. At least it didn't in this example, running uncompiled. Maybe a compiled version with and without SLEEP would yield different results.

I use VIEW PRINT a lot to scroll screens and popups. It is a wonderful BASIC statementfor SCREEN Zero Heros.

Thanks for posting it,

Pete

Posted on Dec 14, 2010, 7:46 AM

Respond to this message   

Return to Index


NOT IN THE VISBASICS

by OPRESION (no login)

QUICKBASIC 7.1 AND QBASIC 1.1 (IN SPANISH) ALSO HAVE THAT PROBLEM
MAKING TO RUN THE PROCESSOR TO 100% WHEN YOU USE JUST 'SLEEP'.

THAT DOESN'T HAPPEN WITH BOTH VISBASICS FOR MS-DOS, IT'S FIXED.
BOTH VISBASICS CAN RUN AND COMPILE ALMOST ANY CODE FOR THE
QB4.5 AND THE 7.1; EXCEPT IF YOUR CODE IT'S MADE FOR THE
OS/2 IN THE QB7.1, THAT OPTION IT'S DISSAPPERED IN THE VISBASICS.

Posted on Dec 14, 2010, 7:07 PM

Respond to this message   

Return to Index


* WHY DON"T YOU EVER USE LOWER CASE EL STUPIDO!

by CLIPPY (Login burger2227)
R

Posted on Dec 14, 2010, 7:42 PM

Respond to this message   

Return to Index


MY PLEASURE (URL)*

by OPRESION (no login)

http://basic.phatcode.net/

Posted on Dec 14, 2010, 8:16 PM

Respond to this message   

Return to Index


* You are NOT fooling me! You copied and pasted that Link! :-P

by Clippy (Login burger2227)
R

Posted on Dec 14, 2010, 10:26 PM

Respond to this message   

Return to Index


Interesting about UC...

by (Login qb432l)
R

When I first started programming in QBasic, all my programs were in UC. Not sure why -- maybe I thought it was more "programmy" since QB commands were all UC, not sure. Anyway, I stopped after a few programs and haven't done it since. I'm sort of glad I did them in UC, though, because now when I look at them, they're distinct from my later stuff, so the memories are heightened.

-Bob

Posted on Dec 14, 2010, 11:15 PM

Respond to this message   

Return to Index


Please don't refer to other people who try to help as stupid, because relatively speaking

by (Login The-Universe)
Admin


... think where that puts you.

Clippy
Don't want to take my word for it? Well then let's check this theory out with QB, just to be sure...


IF "Clippy"

See? You can't argue with science!

Pete happy.gif

Posted on Dec 14, 2010, 10:46 PM

Respond to this message   

Return to Index


Attention all Personnel... Network54 account

by (Login The-Universe)
Admin


I renewed the forum account today, but changed the account number (not the plan, same plan, different billing number). N54 does not autorespond to the correctness of the information entered, or to the approval of processing; so I have to wait to see if it was changed and processed, correctly. I'm just posting this in case there is a glitch and ads show up this month. If so, the glitch will be fixed and the ads, removed.

That is all, except for...

Merry Christmas, Happy Holidays, etc.

Pete

Posted on Dec 12, 2010, 9:41 AM

Respond to this message   

Return to Index


*Same to you, Radar -- and Happy Holidays to your puppet master Pete, too.

by (Login qb432l)
R

*

Posted on Dec 12, 2010, 1:41 PM

Respond to this message   

Return to Index


One day I hope to be a real boy...

by (Login The-Universe)
Admin

Just like Obama hopes to be a real President. I figure if he can be President, any dummy can do anything it wants!

Ouch, hey watch where you're pulling that middle string!

Radar

Posted on Dec 12, 2010, 6:35 PM

Respond to this message   

Return to Index


How can I run VBScript files with a BAS file?

by Clippy (Login burger2227)
R

I tried running them by SHELLing to BAT files, but it seems that a BAS file cannot get the BAT files to execute the VBS code. At least not on my machine.

Or is this something ELSE that is wrong with my XP machine?

So I compiled the batch file into an EXE file to get the code to execute. That EXE file is 80K while that BAT file is less than 200 bytes. What's a poor person to do?

Any ideas are welcome. I am using VBS files to create program shortcuts. The VBS code finds the program paths to create LNK files on the Desktop and in the program folder. The code can be added to any program.

I also tried URL links, but they need BAT files to run BAS files because you cannot call QB.EXE with any parameters using them. LNK files allow parameters.

If anybody is interested in seeing how I got them working they can download my QB Demo here:

http://dl.dropbox.com/u/8440706/Q-Basics.zip


Thanks,

Ted

Posted on Dec 12, 2010, 5:01 AM

Respond to this message   

Return to Index


Try this

by lawgin (no login)

If your vbs file is c:\xyz.vbs, put this line into your batch file:

cscript c:\xyz.vbs



Posted on Dec 12, 2010, 10:24 AM

Respond to this message   

Return to Index


DAM, I just tried it again and it worked!

by Clippy (Login burger2227)
R

Yesterday, it wouldn't work at all! I didn't even tell it the path either!

Well that's 80K and an EXE file off of my mind anyhow.

My PC couldn't make URLs with icons a few days ago, but my old 98 had no problem.

STRANGE, but thanks anyhow.

Ted

Posted on Dec 12, 2010, 1:59 PM

Respond to this message   

Return to Index


*Uh-huh!

by lawgin (no login)

Posted on Dec 12, 2010, 2:20 PM

Respond to this message   

Return to Index


Setting System Environment Variables

by David P. (no login)

Hello. I am making a REALLY simple program for an old PCDOS system that takes input from the user and puts it into a system variable so a batch script can access what was typed. (PCDOS doesn't seem to have anything like this.) I have the following code so far:


PRINT "Whatever argument 1 is" 'Put text on screen from command line argument 1 (if any)
INPUT A$ 'Take input (duh!)
ENVIRON$("Whatever argument 2 is"=A$) 'Put input into system variable


The only things I am having problems with is setting system variables and taking command line arguments.

When I try to use the ENVIRON$ function, QB just says "Out of memory" before the program even runs. Why is this?

How do I retrieve the command line arguments so I can stuff them into variables?

Thanks!

Posted on Dec 10, 2010, 4:51 PM

Respond to this message   

Return to Index


SHELL to DOS commands

by Solitaire (Login Solitaire1)
S

You need to use the SHELL keyword in order to access DOS commands, which are placed inside quotes. Example:

SHELL "DIR"

You can also use SHELL to run a batch file. It will return to QB when it finishes running.

Posted on Dec 10, 2010, 6:26 PM

Respond to this message   

Return to Index


Why you wanna do that?

by (Login burger2227)
R

Please splain why you wanna do that. There is absolutely no need to add anything to the environment anyhow. EVEN IF it worked, the value will not stay there. It is removed by QB when your program closes.

So your program would have to assign the value EVERY TIME it is run! You could just as easily assign the value to a variable and be done with it.

Besides, Windows does not NEED anything that you add!

Ted

Posted on Dec 10, 2010, 9:36 PM

Respond to this message   

Return to Index


*Command-line arguments should be available as COMMAND$

by (Login Mikrondel)
R

Posted on Dec 10, 2010, 10:50 PM

Respond to this message   

Return to Index


Because...

by David P (no login)

Clippy: You asked why. This program is for a PSDOS system. In batch scripts, I often need to take input on-the-fly from the user. This program would do this. From the batch script, you would call it like:

ASK [variable]

Where the variable is the environment variable into which you want to put the stuff that was types into ASK.EXE by the user.

Artelius: Thanks. That solved that one of the problems!

Solitaire: Thanks also. That solved the other problem. I don't know why I didn't think of that too! Duh! So I guess if QBASIC's ENVIRON function doesn't work, I could use:

SHELL "SET "; COMMAND$; "=";A$

Is this correct?

Thanks for all of the replies!

Posted on Dec 12, 2010, 6:59 PM

Respond to this message   

Return to Index


hello, david p

by (Login MCalkins)
Moderator

first if all, my programing experience is with ms-dos, not pc-dos. however, pc-dos should be pretty similar.

i do not know why qbasic's environ statement causes a memory error. i have run into that before. it must be a qbasic bug.

you can access the environment block directly. the address to it is in the program segment prefix. a qbasic program can find the address of qbasic.exe's PSP with a call to int 0x21, function 0x62.

the problem with the whole concept is that each program gets its own environment block. when you run qbasic.exe, it receives a copy of command.com's environment block. so any changes qbasic makes to the environment block are to its own copy.

shell "set" is even worse. that just creates a new instance of command.com which inherits yet another copy of the environment block from qbasic.exe, changes it, and immediately terminates.

does pc-dos not have choice? choice was an executable that batch files could call which would present the user with options, and then return a return code which a batch file could access with errorlevel.

regards,
michael

p.s.

http://fornax.elf.stuba.sk/SUPERMAN/SYSTEMS/DOS/advdos.txt

has information.

Posted on Jan 19, 2011, 11:11 PM

Respond to this message   

Return to Index


A RND alternative?

by lawgin (no login)

The 7 lines of code below uses the so-called logistics equation: y=kx(1-x) to produce an output that mimics the RND function. With k=4 and an initial value of x=.2, iterating the equation produces a seemingly random output of numbers between 0 and 1. Seeding with a different value, say x=.22, produces a completely different sequence. Interesting.


x = .2
PRINT "Press a key to display a random number"
DO
y = 4 * x * (1 - x)
IF INKEY$ <> "" THEN PRINT y
x = y
LOOP

Posted on Dec 7, 2010, 10:43 AM

Respond to this message   

Return to Index


* SO WHAT? The ONLY thing RANDOM is the time between key presses!

by Clippy (Login burger2227)
R

Posted on Dec 7, 2010, 1:19 PM

Respond to this message   

Return to Index


You're wrong -- try it without keypresses...

by lawgin (no login)

x = .2
DO
y = 4 * x * (1 - x)
PRINT y
x = y
LOOP

Posted on Dec 7, 2010, 3:05 PM

Respond to this message   

Return to Index


Not quite random...

by (Login qb432l)
R

I PSET the points defined by the output and it drew a portrait of George Washington crossing the Delaware!
(j/k)
Actually, it's very interesting.

-Bob

Posted on Dec 7, 2010, 6:26 PM

Respond to this message   

Return to Index


Funny...

by (Login The-Universe)
Admin


I got a picture of George Washington's cross dressing undereware!

Pete happy.gif

Posted on Dec 7, 2010, 7:14 PM

Respond to this message   

Return to Index


*Apparently his teeth weren't really wood, so you may be right about his undies :-|

by (Login qb432l)
R

*

Posted on Dec 8, 2010, 7:54 AM

Respond to this message   

Return to Index


Quite a revelation

by lawgin (no login)

I'm amazed that Leutze was running BASIC way back then. Probably on an Apple I.

Posted on Dec 8, 2010, 9:03 AM

Respond to this message   

Return to Index


*it repeats every 431 iterations

by David (no login)

.

Posted on Dec 8, 2010, 4:07 AM

Respond to this message   

Return to Index


linear feedback shift register

by david (no login)

Qbasic is not very good with bit-wise operations so the implementation is a bit messy. It produces a pseudo-random byte (0-255).

seed1 = 123
seed2 = 146
10 tap1 = (seed2 AND 128) \ 128
tap2 = (seed2 AND 32) \ 32
tap3 = (seed2 AND 16) \ 16
tap4 = (seed2 AND 4) \ 4
i1 = tap1 XOR tap2
i2 = i1 XOR tap3
i3 = i2 XOR tap4
j1 = (seed1 AND 128) \ 128
seed1 = (seed1 AND 127) * 2
seed1 = seed1 + i3
seed2 = (seed2 AND 127) * 2
seed2 = seed2 + j1
m = m + 1
IF m MOD 9 <> 0 THEN 10
PRINT seed1;
x$ = INKEY$
IF x$ = CHR$(27) THEN END
GOTO 10

Posted on Dec 8, 2010, 7:13 AM

Respond to this message   

Return to Index


*period is 21845

by lawgin (no login)

Posted on Dec 8, 2010, 12:16 PM

Respond to this message   

Return to Index


Re: *it repeats every 431 iterations

by lawgin (no login)

The repeat was inevitable, but I was hoping it would last longer than 431. A complete bifurcation diagram of this equation can be found here:

http://www.stsci.edu/~lbradley/seminar/logdiffeqn.html

Posted on Dec 8, 2010, 9:06 AM

Respond to this message   

Return to Index

 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement