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



QB64.exe Does Not Recognize One DLL File

by (no login)

I am running MS Windows7 with Pro Pkg, 8Gb ram and Intel i3 processor. Every time I download and unzip QB64 and try to start QB64.exe, I get an error message stating that: "Program cannot start because file SDL_image.dll is missing from your computer" when in fact it is listed three files down the listing so it is most definitely there. What is the problem that it is not being recognized? I am in dire need of QB and this is maddening. Thanks!

Posted on Jul 14, 2012, 9:18 PM

Respond to this message   

Return to Index


one thing to try:

by (Login MCalkins)
Moderator

try creating an empty file with this exact name:

qb64.exe.local

in the qb64 folder. See if that lets you start QB64. If that works, you would probably need to create a .local file also for the various executables that you produce.

What folder do you have QB64 installed in? Do you have full permission for that folder?

Are any other programs on your computer using "SDL_image.dll"?

Regards,
Michael

Posted on Jul 14, 2012, 9:51 PM

Respond to this message   

Return to Index


a few more possible experiments

by (Login MCalkins)
Moderator

First of all, please download sha1sum.exe:
ftp://ftp.gnupg.org/gcrypt/binary/sha1sum.exe

and then, from the command line in your QB64 folder, run:

sha1sum sdl_image.dll

it should say:

cf6d995c8caa0e6b8545c4df4b0cd4b0ff2409fe  sdl_image.dll

If not, then your sdl_image.dll is corrupt.

Otherwise, proceed to the next experiment...

--------------------------------

#include <windows.h>
#include <stdio.h>

HMODULE hm;
CHAR fn[MAX_PATH + 1] = {};

int main(void) {
 hm = LoadLibraryW(L"sdl_mixer.dll");
 if (! hm) {
  printf("LoadLibraryW() failed. Error: 0x%x\n", GetLastError());
  return 0;
 }
 if (! GetModuleFileNameA(hm, fn, MAX_PATH)) {
  printf("GetModuleFileNameA() failed. Error: 0x%x\n", GetLastError());
 }
 printf(fn);
 printf("\n");
 return 0;
}

--------------------------------

save that (between the hypen lines) as "delme.cpp" in your qb64 folder, and then from the command prompt, from your QB64 folder, run:

internal\c\bin\g++ -s delme.cpp -o delme.exe

which will create "delme.exe". Then, still from the command line, run:

delme.exe

from your qb64 folder. It will try to load "sdl_mixer.dll". If it fails, it will give you an error code. If it succeeds, it should give you the full path of the file that it loaded.

If it can't find "sdl_mixer.dll", it will fail with error 0x7e, which is "ERROR_MOD_NOT_FOUND".

Regards,
Michael



    
This message has been edited by MCalkins on Jul 15, 2012 12:53 AM
This message has been edited by MCalkins on Jul 15, 2012 12:49 AM
This message has been edited by MCalkins on Jul 15, 2012 12:48 AM

Posted on Jul 15, 2012, 12:48 AM

Respond to this message   

Return to Index


have you had any success?

by (Login MCalkins)
Moderator

At least one person on the other forums ( http://www.qb64.net/forum/ ) has reported a similar problem, which seemed to be related to Adobe Reader in some way. However, I was and am skeptical about whether Adobe Reader is related.

Regards,
Michael

Posted on Jul 17, 2012, 12:26 AM

Respond to this message   

Return to Index


Antialiasing in QB64

by (no login)

How would I implement anti-aliasing in QB64?

Posted on Jul 12, 2012, 11:03 AM

Respond to this message   

Return to Index


Update

by (no login)

I made a blurring subroutine but it blurs the entire image instead of just edges. How would I get it to blur only the edges of objects? I posted my source code below.


'This is very,very,very inefficient. On quality 8 it takes at least 10 seconds PER FRAME.
x = 1280
y = 720
INPUT "Set quality level (1-8)"; qual
SCREEN _NEWIMAGE(x, y, 32)
FOR sd = 1 TO qual' blurred image on the left. non-blurred on the right
LINE (640, 0)-(640, 720)
CIRCLE (100, 100), 50, _RGB(255, 0, 0)
PAINT (100, 100), _RGB(255, 0, 0), _RGB(255, 0, 0)
CIRCLE (1180, 100), 50, _RGB(255, 0, 0)
PAINT (1180, 100), _RGB(255, 0, 0), _RGB(255, 0, 0)
CALL blur(x / 2, y)
NEXT sd


SUB blur (x, y)
FOR cx = 1 TO x - 1 STEP 1
FOR cy = 1 TO y - 1 STEP 1
redaverage = _RED32(POINT(cx, cy)) + _RED32(POINT(cx + 1, cy + 1)) + _RED32(POINT(cx + 1, cy)) + _RED32(POINT(cx + 1, cy - 1)) + _RED32(POINT(cx, cy - 1)) + _RED32(POINT(cx, cy + 1)) + _RED32(POINT(cx - 1, cy)) + _RED32(POINT(cx - 1, cy + 1)) + _RED32(POINT(cx - 1, cy - 1))
redaverage = redaverage / 9
greenaverage = _GREEN32(POINT(cx, cy)) + _GREEN32(POINT(cx + 1, cy + 1)) + _GREEN32(POINT(cx + 1, cy)) + _GREEN32(POINT(cx + 1, cy - 1)) + _GREEN32(POINT(cx, cy - 1)) + _GREEN32(POINT(cx, cy + 1)) + _GREEN32(POINT(cx - 1, cy)) + _GREEN32(POINT(cx - 1, cy + 1)) + _GREEN32(POINT(cx - 1, cy - 1))
greenaverage = greenaverage / 9
blueaverage = _BLUE32(POINT(cx, cy)) + _BLUE32(POINT(cx + 1, cy + 1)) + _BLUE32(POINT(cx + 1, cy)) + _BLUE32(POINT(cx + 1, cy - 1)) + _BLUE32(POINT(cx, cy - 1)) + _BLUE32(POINT(cx, cy + 1)) + _BLUE32(POINT(cx - 1, cy)) + _BLUE32(POINT(cx - 1, cy + 1)) + _BLUE32(POINT(cx - 1, cy - 1))
blueaverage = blueaverage / 9
PSET (cx, cy), _RGB(redaverage, greenaverage, blueaverage)
NEXT cy
NEXT cx
END SUB

Posted on Jul 14, 2012, 9:49 AM

Respond to this message   

Return to Index


Do a search for certain conditions, first...

by (Login qb432l)
R

Edge pixels have a background pixel adjacent to them, so you should be able to establish that with a simple scan test. Also, I wouldn't go to the same depth as you do with the antialiasing. The overall effect is not antialiasing, but "rounding" of the edge. Just concentrate on individual adjacent background pixels and make them half-and-half foreground/background in hue.

-Bob



    
This message has been edited by qb432l on Jul 14, 2012 9:02 PM

Posted on Jul 14, 2012, 9:01 PM

Respond to this message   

Return to Index


Re: Do a search for certain conditions, first...

by (no login)

How do I check if it's a background pixel or foreground pixel though?

Posted on Jul 15, 2012, 6:52 AM

Respond to this message   

Return to Index


Just test for either attribute number, or RGB differences...

by (Login qb432l)
R

If Pixel A is significantly different in RGB value from Pixel B, then you have an edge. It doesn't really matter which is "foreground" and which is "background", only that the edge be rendered in a neutral shade.

I'm not sure how this code will be applied, however. If it's meant to be applied to many images, rather than a specific image you're familiar with, then it becomes tricky. Also, it depends on whether the colors are relatively uniform, or varied as in a bitmap. All of my antialasing experience has been "hands on". I've never written code to accomplish it automatically.

-Bob

Posted on Jul 15, 2012, 10:35 AM

Respond to this message   

Return to Index


Re: Just test for either attribute number, or RGB differences...

by (no login)

So would I have to compare the RGB value of a pixel with the 8 pixels surrounding it? If so, is there an efficient way to do that? (Preferably one that does not involve writing a separate statement for each coordinate). Also, after the scan, I want to blur area where the background meets the object/image rather than the image itself. (I tried using my blurring algorithm on a diagonal line and the line became gray, so I want to blur the area where the background meets the line rather than the line itself).

What I'm thinking right now is to keep an array for the coordinates of the pixels which need blurring. (The pixels will be found after the scan) and blur those using my blur subroutine. The problem is I don't know how to find the border of the image (excluding any part of the image itself).

Posted on Jul 15, 2012, 11:08 AM

Respond to this message   

Return to Index


The array might be the way to go...

by (Login qb432l)
R

Unfortunately, you will have to test all adjacent pixels, but I wouldn't bother with diagonals - they wouldn't be a major contributor to aliasing.

I really wish I could help you more, but all of my experience involved working with a limited number of attributes (SCREEN 12) where you already know the hue of each attribute and create antialiasing values in advance.

To be honest, I'm amazed at the efficiency of certain code in professional Photo/Paint apps. Converting bit depth, resizing images -- it all seems so instantaneous. I, on the other hand, am a self-taught programmer, so most of my code is pretty obvious and time-consuming.

Sorry I can't be of more help,
-Bob

Posted on Jul 15, 2012, 9:43 PM

Respond to this message   

Return to Index


Can QB64 use the gpu?

by (no login)

I think the reason that professional paint apps are so fast is that they can take advantage of the gpu. Is there any way to allow QB64 to use the GPU? On my computer, QB64 seems to use just one cpu core and I think this might be the reason for the slow graphical effects.

nVidia uses an antialiasing algorithm call FXAA. It consumes no additional memory and it is supposed to be 60% faster than other antialiasing methods.. Do you know which algorithm they use?

Also, How should I compare the pixel to its adjacent pixels? Right now I am comparing the red, green, and blue values of a pixel to the red, green and blue values of each of its adjacent pixels. So i end up having three statements to compare 2 pixels with each other. Is there a better way to do this? Can I use the value provided by the POINT function directly instead of extracting the RGB values from it?

Posted on Jul 16, 2012, 8:07 AM

Respond to this message   

Return to Index


Re: Can QB64 use the gpu?

by (Login MCalkins)
Moderator

>On my computer, QB64 seems to use just one cpu core

This is because the QB64 code that you write is executed in one thread.

>I think this might be the reason for the slow graphical effects.

One thing to do to slightly improve the performance of QB64 code is to use:

$CHECKING:OFF

>Is there any way to allow QB64 to use the GPU?

I'm sure there is. You would probably want to go through a library. OpenGL and Direct3D are the main graphics libraries. I have no idea what their anti-aliasing capabilities are.

You might try asking on the other forums:

http://www.qb64.net/forum/

A few of the people there have OpenGL experience.

Regards,
Michael

Posted on Jul 16, 2012, 8:37 AM

Respond to this message   

Return to Index


Re: Can QB64 use the gpu?

by (no login)

What does the $CHECKING:OFF statement do?

Thanks

Posted on Jul 16, 2012, 9:19 AM

Respond to this message   

Return to Index


It disables some of the error checking.

by (Login MCalkins)
Moderator

QB64 usually generates extra code to handle errors. $CHECKING:OFF disables that.

Compare "internal\temp\main.txt" with and without...

Regards,
Michael

Posted on Jul 16, 2012, 9:31 AM

Respond to this message   

Return to Index


*Oh ok

by (no login)

Posted on Jul 16, 2012, 11:12 AM

Respond to this message   

Return to Index


New computer using QuickBasic

by (Login emoneo)

I'm thinking of buying a new computer. My present computer has Windows XP, and runs QuickBasic just fine when I run from the commandline of Windows DOS. Most new machines come with Windows 7. Will I still be able to run QuickBAsic from the commandline using Windows DOS, or will I have to use something like DOSBox?

Thanks and regards..... Moneo

Posted on Jul 12, 2012, 10:32 AM

Respond to this message   

Return to Index


Re: New computer using QuickBasic

by Pete (no login)

You will need to use DOSBox or set up something like VirtualBox and install Windows XP on it. Check into Win 7 Professional, there is supposed to be some option to run older XP programs, but if NTVDM is not included in that release, it won't work for QuickBasic.

Pete

Posted on Jul 12, 2012, 1:58 PM

Respond to this message   

Return to Index


Re: New computer using QuickBasic

by (Login emoneo)

Thanks for the info, Pete. I was afraid something like this would be the case.

Regards..... Moneo

Posted on Jul 12, 2012, 3:33 PM

Respond to this message   

Return to Index


* Thanks, Pete.

by (Login emoneo)

Posted on Jul 13, 2012, 4:55 PM

Respond to this message   

Return to Index


Re: New computer using QuickBasic

by (Login MCalkins)
Moderator

It depends on whether the Windows "7" is 32 bit or 64 bit.
If 32 bit, it will have NTVDM, and you can run QBASIC text mode programs, but not in full screen, only in a window. I don't think that you could run graphical programs.
If 64 bit, then there is no NTVDM.

Either way, you could use DOSBox, which works reasonably well, but is a bit slow.

You could boot to a FreeDOS CD or something.

You could, of course, use QB64.

Regards,
Michael

Posted on Jul 12, 2012, 6:29 PM

Respond to this message   

Return to Index


* Thanks, Michael.

by (Login emoneo)

Posted on Jul 13, 2012, 11:09 AM

Respond to this message   

Return to Index


*yw

by (Login MCalkins)
Moderator

Posted on Jul 13, 2012, 6:49 PM

Respond to this message   

Return to Index


Poke???

by (no login)

hello all, could someone explain to me what Poke is used for? I looked up the definition but I still don't understand. Does anyone have any simple programs that demonstrate its use?

Posted on Jul 10, 2012, 4:11 PM

Respond to this message   

Return to Index


It's for writing to memory.

by (Login MCalkins)
Moderator

first of all, are you familiar with hexadecimal numbers? If not, it would be a good idea to become familiar with them, as memory addresses are almost always in hexadecimal numbers. In QBASIC, hexadecimal numbers are preceded by &H, whereas in almost everything else, they are preceded by 0x. In short, it is a base 16 number system, using numerals "0" to "f".

http://en.wikipedia.org/wiki/Hexadecimal

QBASIC 1.1 was designed to run in x86 "real mode".

This means that memory addresses will have a 16 bit segment and a 16 bit offset. These are usually separated by a colon. So, for example, the CGA color text mode buffer starts at memory address:

&hb800 : &h0

Where &hb800 is the segment, and &h0 is the offset.

In "real mode", the linear memory address is determined by multiplying the segment by 16 (hex: &h10), and adding it to the offset. So the linear address would be &hb80000. You could, for example, get the same linear address with a segment/offset of &hb7ff:&h10, but there's usually no reason to mess around like that.

Let's say that you want to write directly to the CGA color text buffer. It starts at &hb800:0000, and it is an array of byte pairs. One byte for the character value, the next byte for the color attribute.

In QBASIC, you set the segment with DEF SEG, like this:

DEF SEG = &HB800

Then you can PEEK and POKE while specifying the offsets.

CLS
DEF SEG = &HB800        ' CGA color text buffer
POKE 0, 1               ' smiley face chr$(1)
POKE 1, &H1F            ' blue, bright white
POKE 2, 4               ' diamond chr$(4)
POKE 3, &HCE            ' blinking, red, bright yellow
END

Have a look at the program in this post:
http://www.network54.com/Forum/632471/message/1231888944/

It should be said that the x86 "real mode" is quite obsolete. QB64 gives you 32 bit (or 64 bit) offsets.

Regards,
Michael



    
This message has been edited by MCalkins on Jul 10, 2012 4:44 PM

Posted on Jul 10, 2012, 4:43 PM

Respond to this message   

Return to Index


thanks

by nick (no login)

That was an excellent explanation. Thank you! :)

Posted on Jul 18, 2012, 6:15 AM

Respond to this message   

Return to Index


a little more...

by (Login MCalkins)
Moderator

You're welcome.

One other thing:

You can use VARSEG() and VARPTR() to find the address of variables. This works well for numeric variables and fixed length strings.

fixed length string example:

----------

DECLARE FUNCTION hexb$ (n AS INTEGER)
DIM i AS INTEGER
DIM t AS STRING * 5

t = "abcde"

CLS

DEF SEG = VARSEG(t)

FOR i = 0 TO LEN(t) - 1
 PRINT "&h"; hexb(PEEK(VARPTR(t) + i)); ",";
NEXT i
PRINT

POKE VARPTR(t) + 2, 2 'insert a smiley face in the middle of the string

PRINT t
END

FUNCTION hexb$ (n AS INTEGER)
 DIM t AS STRING
 t = LCASE$(HEX$(n))
 IF 1 = LEN(t) THEN t = "0" + t
 hexb = t
END FUNCTION

----------

You can do the same with the numeric types. INTEGERs are 2 bytes long, LONGs and SINGLEs are 4 bytes, DOUBLEs are 8 bytes. You can see how the numbers are actually stored. The integers (INTEGER and LONG) are stored in little endian (meaining the bytes are in low to high order). The floats (SINGLE and DOUBLE) are in IEEE 757-1985 format.

(You'll find that this concept is related to the ASC, CVI, CVL, CVS, CVD, CHR$, MKI$, MKL$, MKS$, MKD$ family of functions.)

Here is an example demonstrating reading a LONG:

----------

DECLARE FUNCTION hexb$ (n AS INTEGER)
DIM i AS INTEGER
DIM t AS LONG

t = &H12345678

CLS

DEF SEG = VARSEG(t)

FOR i = 0 TO LEN(t) - 1
 PRINT "&h"; hexb(PEEK(VARPTR(t) + i)); ",";
NEXT i
PRINT
END

FUNCTION hexb$ (n AS INTEGER)
 DIM t AS STRING
 t = LCASE$(HEX$(n))
 IF 1 = LEN(t) THEN t = "0" + t
 hexb = t
END FUNCTION

----------

Variable length strings are a little trickier. There is a function, SADD(), that returns the actual address of the string, but you want to be careful with that, because QBASIC moves variable length strings around. You should consider the address of the string to be fairly volatile. VARPTR() will give you the location of the string descriptor, which is a 4 byte structure that contains both the address of the string, and it's current length. You shouldn't manipulate the descriptor manually, and you should only use the address of the string itself if you are confident that it won't move while you're using it.

Also, dynamic arrays can move when you resize them (the segment can change).

Note: this all applies to QBASIC 1.1. PDS/QBX 7.1 added far strings. QB64, while it does a good job of emulating QBASIC 1.1, has it's own abilities and ways of doing things, although some of the same concepts apply.

----------

If you like playing around with direct memory access, you might like to have a browse through the rest of the assembly language forum:

http://www.network54.com/Forum/632471/

(The link that I gave you before was to a post I had written as part of a mini-"tutorial" in that forum.)

In that forum, Artelius gave a link to a book:
http://www.petesqbsite.com/sections/tutorials/tutorials/winer.zip

Just keep in mind that anything dealing with real mode memory access and/or DOS is pretty much obsolete. If you decide to learn assembly language, for example, don't get stuck on just the real mode and/or DOS stuff.

Regards,
Michael

Posted on Jul 18, 2012, 8:35 AM

Respond to this message   

Return to Index


using locate for printer

by (no login)

I have redirected LPT1 printer port to my USB printer. This works fine for printing the program listing from qbasic. When I use LPRINT it will print but only one position on the paper. Using the locate cmd does not seem to do any thing.
Any Ideas?
Leon

Posted on Jul 10, 2012, 12:08 PM

Respond to this message   

Return to Index


A printer prints down the page

by (Login burger2227)
R

You cannot LOCATE the printer head position. To indent use spaces.

Posted on Jul 10, 2012, 1:31 PM

Respond to this message   

Return to Index


printer

by Leon Schrecengost (no login)

Thanks

Posted on Jul 10, 2012, 2:37 PM

Respond to this message   

Return to Index


Printing to a printer

by Solitaire (Login Solitaire1)
S

I wrote the following program over 10 years ago, for printing a document of several pages to an LPT printer. Don't know if it applies to your present situation, but maybe this can give you some hints:

==========================================================================
DIM N AS INTEGER, t AS INTEGER, j AS INTEGER, sentence AS STRING
DIM wrongflag AS INTEGER, pp AS INTEGER, row AS INTEGER, page AS INTEGER
CONST FALSE = 0, TRUE = NOT FALSE: wrongflag = FALSE
CLS   'Prints multiple pages with page numbers; ejects each page
PRINT "Number of lines to a page vary for each printer."
PRINT "Default for inkjet printers is 61, dot matrix is 65."
INPUT "Enter number of lines to a page for your printer:  ", pp
INPUT "Enter number of items to list:  ", N
ON ERROR GOTO continue
LPRINT TAB(30); "THIS IS THE HEADING"; TAB(70); "Page 1"
IF wrongflag = TRUE THEN
    wrongflag = FALSE
    PRINT : BEEP
    PRINT "Printer error.  Printer not connected "
    PRINT "or incompatible with software."
    END
END IF
LPRINT
sentence$ = "This is a sample line printout."
row = 2: page = 1
FOR t = 1 TO N
    row = row + 1
    LPRINT t; TAB(10); sentence$
    IF N > pp AND row = pp THEN
        row = 4
        page = page + 1
        LPRINT CHR$(12)
        LPRINT TAB(30); "NEW PAGE HEADING"; TAB(70); "Page"; page
        LPRINT
    END IF
NEXT t
FOR j = row TO pp  'ejects paper from printer
    LPRINT
NEXT j
END

continue:
wrongflag = TRUE
RESUME NEXT

Posted on Jul 12, 2012, 8:53 AM

Respond to this message   

Return to Index


Online BASIC system with subroutines and REPL

by foo (no login)

http://repl.it

It has SUBs and FUNCTIONs but GOSUB doesn't seem to work. There is no graphics capability; only line-oriented text output. I guess you can use it to solve math or science problems if you are on a computer where you can't install anything. It also has Python and Scheme interpreters available online.

Posted on Jul 4, 2012, 3:47 PM

Respond to this message   

Return to Index


Missing file?

by (no login)

When I downloaded QB64 the folder DATA was not included. The tutorials keep mentioning the need for that folder. This is confusing to me and I would really appreciate getting that folder if it is in fact essential to building programs. Thank you for the QB64.

Posted on Jul 4, 2012, 6:51 AM

Respond to this message   

Return to Index


what tutorials?

by (Login MCalkins)
Moderator

Here is the folder structure of QB64. The only "data" folder is in one of Pete's samples.

Regards,
Michael

└───qb64
    ├───internal
    │   ├───c
    │   │   ├───bin
    │   │   ├───i
    │   │   ├───i686-w64-mingw32
    │   │   │   ├───bin
    │   │   │   ├───include
    │   │   │   │   ├───ddk
    │   │   │   │   ├───GL
    │   │   │   │   ├───psdk_inc
    │   │   │   │   ├───sdks
    │   │   │   │   ├───sec_api
    │   │   │   │   │   └───sys
    │   │   │   │   └───sys
    │   │   │   └───lib
    │   │   │       └───ldscripts
    │   │   ├───include
    │   │   │   └───c++
    │   │   │       └───4.6.1
    │   │   │           ├───backward
    │   │   │           ├───bits
    │   │   │           ├───debug
    │   │   │           ├───decimal
    │   │   │           ├───ext
    │   │   │           │   └───pb_ds
    │   │   │           │       └───detail
    │   │   │           │           ├───basic_tree_policy
    │   │   │           │           ├───binary_heap_
    │   │   │           │           ├───binomial_heap_
    │   │   │           │           ├───binomial_heap_base_
    │   │   │           │           ├───bin_search_tree_
    │   │   │           │           ├───cc_hash_table_map_
    │   │   │           │           ├───eq_fn
    │   │   │           │           ├───gp_hash_table_map_
    │   │   │           │           ├───hash_fn
    │   │   │           │           ├───left_child_next_sibling_heap_
    │   │   │           │           ├───list_update_map_
    │   │   │           │           ├───list_update_policy
    │   │   │           │           ├───ov_tree_map_
    │   │   │           │           ├───pairing_heap_
    │   │   │           │           ├───pat_trie_
    │   │   │           │           ├───rb_tree_map_
    │   │   │           │           ├───rc_binomial_heap_
    │   │   │           │           ├───resize_policy
    │   │   │           │           ├───splay_tree_
    │   │   │           │           ├───thin_heap_
    │   │   │           │           ├───tree_policy
    │   │   │           │           ├───trie_policy
    │   │   │           │           └───unordered_iterator
    │   │   │           ├───i686-w64-mingw32
    │   │   │           │   └───bits
    │   │   │           ├───profile
    │   │   │           │   └───impl
    │   │   │           └───tr1
    │   │   ├───l
    │   │   ├───lib
    │   │   │   └───gcc
    │   │   │       └───i686-w64-mingw32
    │   │   │           └───4.6.1
    │   │   │               ├───include
    │   │   │               │   ├───objc
    │   │   │               │   │   └───deprecated
    │   │   │               │   └───ssp
    │   │   │               ├───include-fixed
    │   │   │               └───install-tools
    │   │   │                   └───include
    │   │   ├───libexec
    │   │   │   └───gcc
    │   │   │       └───i686-w64-mingw32
    │   │   │           └───4.6.1
    │   │   │               └───install-tools
    │   │   ├───mingw
    │   │   │   ├───bin
    │   │   │   ├───include
    │   │   │   │   ├───ddk
    │   │   │   │   ├───GL
    │   │   │   │   ├───psdk_inc
    │   │   │   │   ├───sdks
    │   │   │   │   ├───sec_api
    │   │   │   │   │   └───sys
    │   │   │   │   └───sys
    │   │   │   └───lib
    │   │   │       └───ldscripts
    │   │   └───share
    │   │       ├───gcc-4.6.1
    │   │       │   └───python
    │   │       │       └───libstdcxx
    │   │       │           └───v6
    │   │       ├───gdb
    │   │       │   ├───python
    │   │       │   │   └───gdb
    │   │       │   │       └───command
    │   │       │   └───syscalls
    │   │       ├───info
    │   │       └───man
    │   │           ├───man1
    │   │           └───man7
    │   ├───help
    │   ├───temp
    │   └───update
    │       └───downloads
    ├───samples
    │   ├───n54
    │   │   └───big
    │   │       └───3dsviewer
    │   ├───pete
    │   │   ├───25lines
    │   │   ├───beatdown
    │   │   ├───booger
    │   │   │   ├───data
    │   │   │   └───levels
    │   │   ├───cr
    │   │   ├───darpong
    │   │   ├───hgm30e
    │   │   ├───html
    │   │   ├───invader1
    │   │   ├───monopoly
    │   │   ├───mooncr
    │   │   ├───nlcm2006
    │   │   ├───optimus
    │   │   ├───pongtennis
    │   │   ├───pp256
    │   │   │   ├───clips
    │   │   │   ├───grads
    │   │   │   ├───images
    │   │   │   ├───palettes
    │   │   │   └───screens
    │   │   ├───rectong
    │   │   │   └───gfx
    │   │   ├───roboraid
    │   │   ├───simpire
    │   │   ├───su2
    │   │   ├───tank
    │   │   ├───tor
    │   │   └───wetspot
    │   ├───qb45com
    │   │   └───action
    │   │       ├───arcdemo
    │   │       ├───arqanoid
    │   │       │   ├───images
    │   │       │   ├───levels
    │   │       │   └───saves
    │   │       ├───assault
    │   │       │   ├───backgrnd
    │   │       │   └───sound
    │   │       └───sfb2
    │   ├───qb64
    │   │   └───original
    │   └───thebob
    │       ├───abacus
    │       ├───animax
    │       ├───biochart
    │       ├───chess
    │       ├───chopper
    │       ├───kong
    │       ├───leapfrog
    │       ├───minigolf
    │       ├───monopoly
    │       ├───pongg
    │       ├───rattler
    │       └───sol
    └───source



    
This message has been edited by MCalkins on Jul 4, 2012 7:22 AM

Posted on Jul 4, 2012, 7:19 AM

Respond to this message   

Return to Index


Perhaps in an earlier release of QB64? ...

by (Login qb432l)
R

I have an installation of QB64 that includes a DATA folder.

\data
\GL
\internal
\newfile
\samples
\SFML
\smileyface
\source

-Bob



    
This message has been edited by qb432l on Jul 4, 2012 9:06 AM

Posted on Jul 4, 2012, 7:53 AM

Respond to this message   

Return to Index


If you never physically removed it, it will still be there...

by (Login burger2227)
R

Newer versions of QB64 don't need the Data folder anymore. All it held was images.

Posted on Jul 4, 2012, 8:45 PM

Respond to this message   

Return to Index


Random Names

by (Login STBasic)

I have eight names that i need to pick into 8 groups.

can this be done within a sub

and how is done

Posted on Jul 3, 2012, 2:33 AM

Respond to this message   

Return to Index


Re: Random Names

by (Login MCalkins)
Moderator

You're going to have to be more specific. Is this a homework assignment?

What do you mean "8 groups"? Do you mean 8 groups of 1 name each? Or 8 groups of the same 8 names, but in different orders?

Most things can be done in a SUB, or several SUBs/FUNCTIONs. Please be more specific.

Regards,
Michael

Posted on Jul 3, 2012, 7:07 AM

Respond to this message   

Return to Index


Forcing Fullscreen Toggle via Code

by (no login)

I am interested in being able to write some code that would invoke the ALT + ENTER full screen toggle in QBasic. I have looked into using the POKE command to modify the status byte of the keyboard with no luck. The built in POKE example in QBasic that simply toggles the NumLock, Caps Lock, and Scroll Lock on\off doesn't even function correctly with my keyboard(I think it's my keyboard). I believe this is because my keyboard device is of type HID and the location of the keyboard's status byte may be in a different location. This is just a theory.

I think the keyboard status byte is the key to this solution but does anyone know if the location of the keyboard status byte changes from keyboard to keyboard? Does anyone know of quick way to force QBasic to ALT + ENTER itself using code? Thanks in advance everyone and I appreciate any and all efforts to help me with my situation! (:

Posted on Jul 1, 2012, 10:10 AM

Respond to this message   

Return to Index


re: (added 1 PS)

by (Login MCalkins)
Moderator

I don't think QBASIC 1.1 could do this directly. If a Win32 program could do it, you might be able to SHELL to the win32 program to do it...

I strongly suspect that you could do something like that, though not with POKE, in QB64, but I'm not sure the exact method.

Regards,
Michael

P.S.

http://www.qb64.net/wiki/index.php?title=FULLSCREEN



    
This message has been edited by MCalkins on Jul 1, 2012 1:49 PM

Posted on Jul 1, 2012, 1:46 PM

Respond to this message   

Return to Index


response

by (no login)

I am unfortunatley using a 32 bit system, yet would QB64 work anyway?

Also, QBasic can run in windowed mode and when a program executes and does a SCREEN 12 command, the console window automatically goes fullscreen. Is there source code somewhere on how the SCREEN command works in order to accomplish this? If I could utilize such code, perhaps I could reverse the algorithm in order to be able to force a windowed mode( or vica versa).

Thanks for responding so quickly earlier by the way!

Posted on Jul 1, 2012, 4:40 PM

Respond to this message   

Return to Index


Re: response

by (Login MCalkins)
Moderator

Yes, the Windows version of QB64 creates 32 bit programs that will run on 32 or 64 bit Windows. They will run on XP and later, including Vista and "7". (It is possible to jump through hoops to get it to run on Windows 2000, but it won't do so by default.)

forums:
http://www.qb64.net/forum/

version 0.954 (current at this time):
http://www.qb64.net/forum/index.php?topic=6007.0

I recommend the .7z file, because it is significantly smaller. You can get 7-zip here:
http://www.7-zip.org/

-----

QBasic, as with other DOS programs, has no knowledge of running in a window. When it switches to Screen 12, all it knows is that it just told the BIOS to switch the VGA adapter from a text mode to a graphical mode. It has no knowledge of Windows.

Meanwhile, Windows is running QBASIC in a virtual DOS machine, sees the request to switch the graphics mode, and decides to make the program full screen.

-----

Here is a C++ program that will call the Windows API's SetConsoleDisplayMode() function.

http://msdn.microsoft.com/en-us/library/ms686028%28v=vs.85%29

Note that it requires Windows XP or 2003. (Vista/"7" don't do fullscreen consoles.)

conwfs.cpp --------------------------------

// public domain, 2012 july, michael calkins
// http://www.network54.com/Forum/648955/message/1341162659/

#include <windows.h>
// #include <stdio.h>

// MinGW's wincon.h seems to be missing some things...

#if !defined CONSOLE_FULLSCREEN_MODE
 #define CONSOLE_FULLSCREEN_MODE 1
#endif
#if !defined CONSOLE_WINDOWED_MODE
 #define CONSOLE_WINDOWED_MODE 2
#endif
#if !defined SetConsoleDisplayMode
 extern "C" { WINBASEAPI BOOL WINAPI SetConsoleDisplayMode(HANDLE hConsoleOutput, DWORD dwFlags, PCOORD lpNewScreenBufferDimensions); }
#endif

HANDLE hsb;
SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), 0, 0};
COORD d;

int main(int argc, char * argv[]) {              // MinGW does not support wmain()

 hsb = CreateFileW( L"CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, & sa, OPEN_EXISTING, 0, 0);
 if (hsb == INVALID_HANDLE_VALUE) {
  // printf("CreateFileW failed. 0x%x\n", GetLastError());
  return 1;                                      // CreateFileW() failed.
 }
 if (argc < 2) return 2;                         // Missing command line parameter.

 switch (*argv[1]) {
  case '1':
   if (SetConsoleDisplayMode(hsb, CONSOLE_FULLSCREEN_MODE, & d)) return 0;
   break;
  case '2':
   if (SetConsoleDisplayMode(hsb, CONSOLE_WINDOWED_MODE, & d)) return 0;
   break;
  default:
   return 3;                                     // Invalid command line parameter.
 }
 // printf("SetConsoleDisplayMode failed. 0x%x\n", GetLastError());
 // seems to fail with 0x57 if you're already in that mode...
 return 4;                                       // SetConsoleDisplayMode() failed.
}

--------------------------------

You'll need a C++ compiler with Windows headers to compile it. If you have QB64, then you can execute:

internal\c\bin\g++ -s conwfs.cpp -o conwfs.exe

where "internal" is a subfolder of the QB64 folder.

I could upload the executable (12KB) to my website, but I am reluctant to do so without a good reason. I would prefer that you compile it from source, if possible.

-----

The program expects 1 parameter, of which it checks the first character:

conwfs.exe 1
to go to full screen.

conwfs.exe 2
to go to a window.

The program returns exit codes that you can check from a .BAT file using echo %errorlevel%. A code of 0 means success. A code of 1 means it couldn't open "CONOUT$" using CreateFileW(). A code of 2 means you forgot the parameter. A code of 3 means the first character of the parameter was something other than "1" or "2". A code of 4 means the call to SetConsoleDisplayMode() failed. If you want to see the Windows error codes, uncomment the #include <stdio> and the two printf() lines.

-----

Here is a QBASIC 1.1 program that SHELLs to it to alternate modes every 3 seconds:

DO
 SHELL "conwfs.exe 1" 'full screen
 ' WIDTH 80, 25
 SLEEP 3
 IF LEN(INKEY$) THEN EXIT DO
 SHELL "conwfs.exe 2" 'windowed
 SLEEP 3
LOOP UNTIL LEN(INKEY$)
SYSTEM

-----

Regards,
Michael

Posted on Jul 2, 2012, 6:32 AM

Respond to this message   

Return to Index


response

by (no login)

This code looks exactly like what I have been looking for! I will test it out tonight, but I had one more question with regard to the keyboard status byte. Do you know if the memory location of the keyboard status byte is different for HID keyboard devices? The QBasic example(and every example I've found online) uses POKE to modify the bits around &417 and &418 to toggle NumLock, etc. on\off. The examples run yet don't seem to do anything. Are you able to get a result with such examples?

Posted on Jul 2, 2012, 10:26 AM

Respond to this message   

Return to Index


Re: response

by (Login MCalkins)
Moderator

I don't think that the type of keyboard matters. Windows is providing, through NTVDM, an emulated DOS / IBM BIOS environment to the DOS programs, including QBASIC. It seems that NTVDM will let you read the status byte, but seems to ignore writes to it.

You can correctly read the byte at 0000:0417, you just can't set the locks by writing to it, right?

I wrote a QB64 program here:

http://www.qb64.net/forum/index.php?topic=5878.msg60700#msg60700

that uses the Windows API function SendInput() to simulate pressing the lock keys.

http://msdn.microsoft.com/en-us/library/ms646310%28v=vs.85%29

Let me know if you need a C++ program to SHELL to from QBASIC 1.1. However, you might prefer switching to QB64.

Regards,
Michael



    
This message has been edited by MCalkins on Jul 3, 2012 7:05 AM

Posted on Jul 3, 2012, 7:03 AM

Respond to this message   

Return to Index


MAYBE HERE ...

by OPRESION (no login)

IN "DAV'S QBAISC SITE" LOOK FOR:

'Force Full-Screen DOS Box'

BUT THAT CODE NEVER HAVE WORKED FOR ME.

ALSO IN THIS FORUM IN THE 'ARCHIVE SECTION' GO TO:

http://www.network54.com/Forum/13959/message/1122752595/Here---

YOU WILL FIND THE EXECUTABLE THAT I AM USING.
IT WORKS FOR ME BECAUSE I AM USING WINDOWS 98SE.

Posted on Jul 1, 2012, 11:20 PM

Respond to this message   

Return to Index


Copy files & folders according to list ?

by (no login)

For syncing a main drive with a backup drive. Anyway i'm so scared to mess up every thing that i go manual.

Posted on Jun 28, 2012, 7:34 AM

Respond to this message   

Return to Index


Re: Copy files & folders according to list ?

by (no login)

Could you give a little more information, I'm not sure what your'e asking.

Posted on Jun 30, 2012, 9:12 AM

Respond to this message   

Return to Index


ok

by (no login)

On my main PC, one drive is full. So i plugged in another drive. The problem is to keep the backup drive (an usb device) synchronised with the changes on the PC.

So for example, i will move a bunch of files and folders to the new drive on the main PC, but i have to keep track about this in order to move the same files on the backup drive... which keeps the same folder structure, as the PC, logically since it's a backup drive;

This is rather a job for a batch program... or manually.

Posted on Jul 1, 2012, 6:27 AM

Respond to this message   

Return to Index


Re: ok

by (Login MCalkins)
Moderator

yeah, there are various ways of doing that.

Back in the old DOS days, when a file was modified the "A" (archive) attribute would be set. You could then copy all the files with the "A" attribute, and then remove the attribute from the source files.

You could write a QBASIC program to dump "dir" lists to files, and parse the files, looking for new files, or files with mismatching sizes and datestamps.

If you wanted to be extra sure, you could do binary comparisons of the files, or make a list of SHA-1 hashes of the backup files, then check the hashes of the new files against the list to see if there are new files. You could also use a list of hashes to detect duplicate files.

You might look into seeing if anyone else has written good synchronization software, rather that writing your own. (I know this is a programming forum with a strong hobby leaning, but sometimes it's easier and better to use someone else's program, unless you really want to write your own.)

Regards,
Michael

Posted on Jul 1, 2012, 1:42 PM

Respond to this message   

Return to Index


Full backup versus partial backup

by (Login emoneo)

Partial or selective backups are error-prone in my opinion and experience.
Given the speed of today's computers and devices, the best solution for backups is a full backup. This method ensures that you have an exact copy of all the sub-directories and their respective files. To eliminate the possibility of underlay (old) directories and files, clear the destination before performing the copy-backup. At the end of the copy-backup, do a DIR of the source and destination to ensure that the size and number of files match.
Regards..... Moneo

Posted on Jul 1, 2012, 5:27 PM

Respond to this message   

Return to Index


More regarding backups

by Moneo (no login)

Hi lisztfr,
I did some more thinking about your backup needs.
If you choose not to use the full backup that I mentioned in my last post, perhaps because you are dealing with too many files, then I suggest using the XCOPY command.
To view the help information on the XCOPY command, do: XCOPY /?
To get this help info onto a text file for easy reading,do:
XCOPY /? > xcopy.txt
NOTES:
1) Before your very first backup, you need to backup ALL your files just once, as follows:
XCOPY source destination
This establishes your initial "database" which you will selectively update.
2) In general, I recommend NOT using the archive attribute for selecting recently changed files, since there is much chance for error.
3) In order to selectively backup your files on or after the date of 08-31-2012, for example, use XCOPY as follows:
XCOPY source destination /d:08-31-2012
4) I did some simple testing, and it works fine.
5) Note in the help information that XCOPY will handle directories and sub-directories. I didn't test this.
6) If you wish, you might create a simple batch file which substitutes the date as a parameter.
Good luck..... Moneo

Posted on Aug 31, 2012, 5:09 PM

Respond to this message   

Return to Index


Thanks Moneo

by (no login)

The trick with the date attribute is nice, i didn't know this...

I was already using xxcopy sometimes, with exclude list too. In someway i solved my problems, manually.

Something else : my Freecom 750 GB drive seems underpowered, on windows, while on linux (Puppy) it is still readable ! Previously Windows XP could access it, but now, i don't know why, suddenly my IBM T43 seems to have not enough power (Also other laptops). While Puppy can read is very nicely...

Cheers, l

Posted on Sep 4, 2012, 2:37 AM

Respond to this message   

Return to Index


Ideas

by (no login)

I am bored and looking for a new project to work on. Any ideas of programs i could make?

Posted on Jun 27, 2012, 8:42 PM

Respond to this message   

Return to Index


write a graphing calculator of some sort

by Cock (no login)

Posted on Jun 28, 2012, 12:07 AM

Respond to this message   

Return to Index


Toast

by Solitaire (no login)

User enters degree of darkness to toast a slice of bread. Gradually darken a rectangle from beige to brown, up the the user's input. When done, display "Toast is ready."

(I wrote this program in VB. Can you do it in QB?)

Posted on Jun 28, 2012, 7:56 AM

Respond to this message   

Return to Index


*url inside

by Solitaire (no login)

Toast:

http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/cc5e9255-b80a-4814-bb20-b3fb79ebe943

Posted on Jun 28, 2012, 7:58 AM

Respond to this message   

Return to Index


Re: Toast

by (no login)

Here :)
100 seems to make some nice toast.


_TITLE "Toast"
SCREEN _NEWIMAGE(640, 480, 32)
DO
CLEAR
REDIM toasts(307200)
DO
_LIMIT 64
CLS
k$ = INKEY$
PRINT "Enter a value to toast the bread: "; toastdeg$
IF k$ >= CHR$(32) AND k$ <= CHR$(126) THEN toastdeg$ = toastdeg$ + k$
IF k$ = CHR$(8) AND LEN(toastdeg$) <> 0 THEN toastdeg$ = MID$(toastdeg$, 1, (LEN(toastdeg$) - 1))
IF k$ = (CHR$(0) + CHR$(83)) THEN toastdeg$ = ""
IF k$ = CHR$(27) THEN SYSTEM
_DISPLAY
LOOP UNTIL k$ = CHR$(13)
toastdeg = VAL(toastdeg$)
DO
_LIMIT 10
CLS
k$ = INKEY$
PAINT (1, 1), _RGBA(238, 232, 170, 255)
u = 0
FOR x = 0 TO 639
FOR y = 0 TO 478
u = u + 1
nowtoast = toasts(u)
z = INT(RND * 2 + 1)
IF z = 1 THEN nowtoast = nowtoast + 1
IF nowtoast < 40 THEN nowtoast = 40
PSET (x, y), _RGBA(1, 1, 1, nowtoast)
toasts(u) = nowtoast
NEXT y
NEXT x
i = i + 1
_PRINTMODE _KEEPBACKGROUND
_PRINTSTRING (1, 1), STR$(i)
IF k$ = CHR$(27) THEN SYSTEM
_DISPLAY
LOOP UNTIL i = toastdeg
_PRINTMODE _KEEPBACKGROUND
_PRINTSTRING (260, 192), "Toast is ready."
_DISPLAY
_DELAY 3
_PRINTMODE _KEEPBACKGROUND
_PRINTSTRING (176, 208), "Would you like to toast again? (y/n)"
_DISPLAY
DO
_LIMIT 64
k$ = INKEY$
LOOP UNTIL k$ = CHR$(121) OR k$ = CHR$(89) OR k$ = CHR$(110) OR k$ = CHR$(78)
LOOP UNTIL k$ = CHR$(110) OR k$ = CHR$(78)
SYSTEM

Posted on Jun 30, 2012, 9:10 AM

Respond to this message   

Return to Index


Proper Case of Name (project idea; could be a challenge)

by Solitaire (no login)

Write a program that will take user's input of a full name and display it in Proper Case -- each name starting with an uppercase letter and remaining letters in lowercase. In addition, if name begins with Mc, Mac, or includes a ', the letter coming after that should also be in uppercase.

I wrote such a program over 4 years ago. Now do it yourself. I'm curious as to how your code will differ from mine. Please use code that is compatible with QB, not QB64.

Sorry, I haven't been able to run your version of the Toast program, as it doesn't work with QB and I don't have QB64 installed on my laptop. (My desktop computer is in the attic and it's stifling hot up there during the current heat wave, so I won't turn it on.)


Please respond to the subforum, so other programmers may participate:

http://www.network54.com/Forum/202193/message/1341242170/Proper+Case+of+Name



    
This message has been edited by Solitaire1 on Jul 2, 2012 9:01 AM
This message has been edited by Solitaire1 on Jul 2, 2012 9:00 AM

Posted on Jul 2, 2012, 8:09 AM

Respond to this message   

Return to Index


Re: Proper Case of Name (project idea; could be a challenge)

by (Login emoneo)

Not all last names begin with an uppercase letter. Last names originating in other languages can begin with lowercase letters. Examples:
Peter van der Lee
Ernesto de la Cueva
Michael de la Rosa

Sometimes multiple last names in Spanish contain a "y" meaning "and", like:
Juan Perez y Sanchez

All these combinations are possible in the USA which has names for people originating in different countries.

Regards..... Moneo

Posted on Jul 2, 2012, 6:04 PM

Respond to this message   

Return to Index


* Also, beware of diacritical marks on letters

by (Login emoneo)

*



    
This message has been edited by Solitaire1 on Jul 3, 2012 8:49 AM

Posted on Jul 2, 2012, 6:14 PM

Respond to this message   

Return to Index


There are many exceptions. (another challenge)

by Solitaire (Login Solitaire1)
S

Yes, I was aware of that, especially after looking over the list of names in the Manhattan phone book. But there's so much that needs to be considered that would require a great deal of code. I simply included the most common exceptions to work by, and asked the user to add a ~ for bypassing the rule. If you have more rules, you could list them and ask the user if he wants to make certain exceptions.

I also wrote a similar program (in VB) to use Title Case for titles of books, etc. If you Google "Title Case" you will find a confusing array of rules for which words should be left in lowercase. This is even more challenging than the program for proper name case.

Zack, you may want to try that version next.



    
This message has been edited by Solitaire1 on Jul 3, 2012 9:02 AM

Posted on Jul 3, 2012, 9:01 AM

Respond to this message   

Return to Index


Re: Proper Case of Name (project idea; could be a challenge)

by (no login)

This works, I tested it a little and it didn't make any mistakes. I would test it more but it is getting late, maybe tomorrow. It was actually more work than I thought it would be ;D I don't use QBasic, nor have I ever, so I to try and make it compatible I didn't use any _ commands. Sorry if it is still incompatible.

SCREEN 12
DO
CLEAR
DO
CLS
PRINT "Enter your name: "; name$
DO
k$ = INKEY$
LOOP UNTIL k$ = ""
DO
k$ = INKEY$
LOOP UNTIL LEN(k$)
IF k$ >= CHR$(32) AND k$ <= CHR$(126) THEN name$ = name$ + k$
IF k$ = CHR$(8) AND LEN(name$) <> 0 THEN name$ = MID$(name$, 1, (LEN(name$) - 1))
IF LEN(name$) > 64 THEN name$ = MID$(name$, 1, (LEN(name$) - 1))
LOOP UNTIL k$ = CHR$(13)
namesave$ = name$
FOR lowercase = 1 TO LEN(name$)
character$ = MID$(name$, lowercase, 1)
IF character$ >= CHR$(65) AND character$ <= CHR$(90) THEN character$ = CHR$((ASC(character$) + 32))
IF character$ = CHR$(32) OR character$ = CHR$(39) OR character$ = CHR$(45) OR character$ = CHR$(46) OR (character$ >= CHR$(65) AND character$ <= CHR$(90)) OR (character$ >= CHR$(97) AND character$ <= CHR$(122)) OR (character$ >= CHR$(128) AND character$ <= CHR$(154)) OR (character$ >= CHR$(160) AND character$ <= CHR$(165)) THEN namex$ = namex$ + character$
NEXT lowercase
name$ = namex$
DO
nodisturb = 0
IF INSTR(name$, "mr") AND MID$(name$, (INSTR(name$, "mr") + 2), 1) <> CHR$(46) THEN
name$ = MID$(name$, 1, (INSTR(name$, "mr") + 1)) + "." + MID$(name$, (INSTR(name$, "mr") + 2), LEN(name$))
nodisturb = 1
END IF
IF INSTR(name$, "dr") AND MID$(name$, (INSTR(name$, "dr") + 2), 1) <> CHR$(46) THEN
name$ = MID$(name$, 1, (INSTR(name$, "dr") + 1)) + "." + MID$(name$, (INSTR(name$, "dr") + 2), LEN(name$))
nodisturb = 1
END IF
IF INSTR(name$, "ms") AND MID$(name$, (INSTR(name$, "ms") + 2), 1) <> CHR$(46) THEN
name$ = MID$(name$, 1, (INSTR(name$, "ms") + 1)) + "." + MID$(name$, (INSTR(name$, "ms") + 2), LEN(name$))
nodisturb = 1
END IF
IF INSTR(name$, "mrs") AND MID$(name$, (INSTR(name$, "mrs") + 3), 1) <> CHR$(46) THEN
name$ = MID$(name$, 1, (INSTR(name$, "mrs") + 2)) + "." + MID$(name$, (INSTR(name$, "mrs") + 3), LEN(name$))
nodisturb = 1
END IF
IF INSTR(name$, "rev") AND MID$(name$, (INSTR(name$, "rev") + 3), 1) <> CHR$(46) THEN
name$ = MID$(name$, 1, (INSTR(name$, "rev") + 2)) + "." + MID$(name$, (INSTR(name$, "rev") + 3), LEN(name$))
nodisturb = 1
END IF
IF INSTR(name$, "phd") AND MID$(name$, (INSTR(name$, "phd") + 3), 1) <> CHR$(46) THEN
name$ = MID$(name$, 1, (INSTR(name$, "phd") + 2)) + "." + MID$(name$, (INSTR(name$, "phd") + 3), LEN(name$))
nodisturb = 1
END IF
IF INSTR(name$, "prof") AND MID$(name$, (INSTR(name$, "prof") + 4), 1) <> CHR$(46) THEN
name$ = MID$(name$, 1, (INSTR(name$, "prof") + 3)) + "." + MID$(name$, (INSTR(name$, "prof") + 4), LEN(name$))
nodisturb = 1
END IF
LOOP UNTIL nodisturb = 0
REDIM namesplit$(64)
FOR namesplit = 1 TO LEN(name$)
namesplit$(namesplit) = MID$(name$, namesplit, 1)
NEXT namesplit
REDIM spacecheck$(64)
FOR spacecheck = 1 TO namesplit
DO
IF namesplit$(spacecheck) = CHR$(32) AND namesplit$(spacecheck + 1) = CHR$(32) THEN EXIT DO
spacechecks = spacechecks + 1
spacecheck$(spacechecks) = namesplit$(spacecheck)
EXIT DO
LOOP
NEXT spacecheck
FOR cap = 1 TO spacechecks
IF cap = 1 THEN spacecheck$(cap) = uc$(spacecheck$(cap))
IF spacecheck$(cap) = CHR$(32) THEN
cap = cap + 1
spacecheck$(cap) = uc$(spacecheck$(cap))
END IF
IF spacecheck$(cap) = CHR$(39) THEN
cap = cap + 1
spacecheck$(cap) = uc$(spacecheck$(cap))
END IF
IF cap > 3 THEN
IF (spacecheck$(cap) = CHR$(99) AND spacecheck$(cap - 1) = CHR$(97) AND spacecheck$(cap - 2) = CHR$(77)) THEN
cap = cap + 1
spacecheck$(cap) = uc$(spacecheck$(cap))
END IF
END IF
IF cap > 2 THEN
IF (spacecheck$(cap) = CHR$(99) AND spacecheck$(cap - 1) = CHR$(77)) THEN
cap = cap + 1
spacecheck$(cap) = uc$(spacecheck$(cap))
END IF
END IF
NEXT cap
FOR sew = 1 TO spacechecks
namere$ = namere$ + spacecheck$(sew)
NEXT sew
name$ = namere$
REDIM chunks$(64)
FOR chunker = 1 TO LEN(name$)
chunk$ = MID$(name$, chunker, 1)
IF chunk$ <> CHR$(32) THEN
chunks = chunks + 1
chunker = chunker - 1
DO
chunker = chunker + 1
chunk$ = MID$(name$, chunker, 1)
IF chunk$ = CHR$(32) THEN EXIT DO
chunks$(chunks) = chunks$(chunks) + chunk$
LOOP UNTIL chunker = LEN(name$)
END IF
NEXT chunker
FOR chunkmod = 1 TO chunks
SELECT CASE chunks$(chunkmod)
CASE "Von"
chunks$(chunkmod) = "von"
CASE "De"
chunks$(chunkmod) = "de"
CASE "Ver"
chunks$(chunkmod) = "ver"
CASE "La"
chunks$(chunkmod) = "la"
CASE "Del"
chunks$(chunkmod) = "del"
CASE "Van"
chunks$(chunkmod) = "van"
CASE "Der"
chunks$(chunkmod) = "der"
END SELECT
NEXT chunkmod
FOR chunksew = 1 TO chunks
nameer$ = nameer$ + chunks$(chunksew) + CHR$(32)
NEXT chunksew
name$ = nameer$
name$ = MID$(name$, 1, (LEN(name$) - 1))
CLS
PRINT "Orignal Name: "; namesave$
PRINT "Formatted Name: "; name$
PRINT "Would you like to format another name? (y/n)"
DO
k$ = INKEY$
IF k$ = CHR$(121) OR k$ = CHR$(89) OR k$ = CHR$(110) OR k$ = CHR$(78) THEN EXIT DO
LOOP
LOOP UNTIL k$ = CHR$(110) OR k$ = CHR$(78)
SYSTEM

FUNCTION lc$ (ucc$)
SELECT CASE ASC(ucc$)
CASE 65 TO 90
lc$ = CHR$((ASC(ucc$) + 32))
CASE 128
lc$ = CHR$(135)
CASE 142
lc$ = CHR$(132)
CASE 143
lc$ = CHR$(134)
CASE 144
lc$ = CHR$(130)
CASE 146
lc$ = CHR$(145)
CASE 153
lc$ = CHR$(148)
CASE 154
lc$ = CHR$(129)
CASE 165
lc$ = CHR$(164)
CASE ELSE
lc$ = ucc$
END SELECT
END FUNCTION

FUNCTION uc$ (lcc$)
SELECT CASE ASC(lcc$)
CASE 97 TO 122
uc$ = CHR$((ASC(lcc$) - 32))
CASE 135
uc$ = CHR$(128)
CASE 132
uc$ = CHR$(142)
CASE 134
uc$ = CHR$(143)
CASE 130
uc$ = CHR$(144)
CASE 145
uc$ = CHR$(146)
CASE 148
uc$ = CHR$(153)
CASE 129
uc$ = CHR$(154)
CASE 164
uc$ = CHR$(165)
CASE ELSE
uc$ = lcc$
END SELECT
END FUNCTION

Posted on Jul 2, 2012, 10:21 PM

Respond to this message   

Return to Index


* Very nice. It does work with QB. Your code is a whole lot different than mine.

by Solitaire (Login Solitaire1)
S

Posted on Jul 3, 2012, 8:48 AM

Respond to this message   

Return to Index


some more ideas:

by (Login MCalkins)
Moderator

a card game (skip-bo, hearts, spades, or free cell). In case of freecell, maybe you could make a solver. In the case of one of the other three, maybe you could make a computer AI player, or even human vs human multiplayer capability across a network.

a monopoly game, allowing normal variations in the rules. Again, you could do computer AI players or network multiplayer capability.

perhaps an interpreter / script host / virtual machine of some kind. Perhaps invent your own language. Perhaps simulate a multitasking CPU.

perhaps a good hex editor, capable of editing multiple large files. You could give it search, as well as cut/copy/paste in the same file and between files.

perhaps, investigate, understand, and implement various algorithms, such as cryptographic hashes like SHA-1 and SHA-2. Perhaps symmetric key ciphers like AES. Perhaps asymmetric key ciphers, like RSA, or ciphers basic on elliptic curves. Perhaps pseudo-random number generators. Perhaps compression algorithms.

Regards,
Michael

Posted on Jul 3, 2012, 9:39 AM

Respond to this message   

Return to Index


simple compiler for newer computers

by (no login)

Anybody know of a simple compiler program for a Qbasic program that works with newer computers AND that doesn't require the end user to have a bunch of files they more than likely don't have? Tried freebasic and it won't compile because it tells me my program has a bunch of errors (despite the fact the program runs fine in qb64). Qb64 requires the end user to have a bunch of .dll files.

Is there some way to so people can just click on the .exe file and run the program? I know in the original qbasic you could do that but with newer 64-bit OS's they don't work anymore.

I don't understand why freebasic doesn't want to compile. The message it gave me was telling me statements like:

let note1$ = "1"

were invalid and couldn't compile.

Anyways made up a little text adventure I would like to pass around to some friends and family and none of them are computer savvy. I all ready know they are not going to try and download a bunch of external files just to play this game. If they can't just click it and run they won't mess with it.

Posted on Jun 21, 2012, 12:30 PM

Respond to this message   

Return to Index


not really

by (Login MCalkins)
Moderator

FreeBASIC is not sufficiently QBASIC compatible.

QB64 is currently the only free QBASIC compatible compiler that I know of. I believe that Galleon is or soon will be working on reducing the SDL dependence of QB64, but it may take him a while.

In the meantime, the simplest solution would probably be to zip the .EXE file and the necessary .DLLs into a .ZIP file. If the end users could unzip the contents into a folder, they should then be able to run the .EXE.

As sort of a custom solution, if you want to post the code, I might be able to come up with a hacked version of the QB64 runtime library that would allow you to distribute your program as one .EXE file, with no SDL dependence. No guarantees. It would still be your code, just compiled with a hacked library with minimal functionality. I've been quite busy lately, so I might not be able to get to it this week.

Regards,
Michael

Posted on Jun 21, 2012, 1:08 PM

Respond to this message   

Return to Index


* Call FreeBASIC in QBASIC mode using fbc -lang qb instead of fbc

by anon (no login)

Posted on Jun 21, 2012, 6:28 PM

Respond to this message   

Return to Index


Die Forelle, Schubert

by Ima Fish (no login)

PLAY "t100"
PLAY "l8 a- > d- d- f f l4d- < l8a- p16 l16a- l8a-. l16a- > l16e- d- c < b- l4a- p8 l8a-"
PLAY "l8 > d-. l16d- l8 f f l4d- < l8a- > l8d- c < l16b- > l16c l8d- < g l4a- p8 l8a-"
PLAY "l8 > c c l16d- c < b- > c l4d- < l8a- > d- c c l16c g- e- c l4d-. l8d- <"
PLAY "l8 b- b- b- > d- l4d- < l8a- a- a-. l16a- > l8e- c l4d- l8d- <"
PLAY "l16 > c < b- l8b- l16b- > d- c e- l4d- < l8a- a- a-. l16a- > l8 e- c l4d- p4"

Posted on Jun 19, 2012, 5:42 PM

Respond to this message   

Return to Index


Very nice, however...

by (Login qb432l)
R

I would recommend changing the "t100" to "t100 o2" or "t100 o3", setting the starting octave to lower than default. As it is, the pitch is very high. Otherwise, very nice.

-Bob

Posted on Jun 19, 2012, 7:09 PM

Respond to this message   

Return to Index


* and very loud on ibm x41 :-)

by (no login)

*

Posted on Jun 20, 2012, 7:09 AM

Respond to this message   

Return to Index


Embed Arrays in Type...

by (no login)

DIM ARRAY(2, 7, 36) AS INTEGER

PRINT "OK"

TYPE example
a AS INTEGER
b AS STRING * 4
END TYPE

DIM test(2) AS example

FOR i = 1 TO 2

<DO SOMETHING WITH> ARRAY(i, x, y)
<ALSO WITH> TYPE(i)

NEXT i

i could be defined as an index which is linking between TYPE and ARRAY...

L


Posted on Jun 19, 2012, 7:43 AM

Respond to this message   

Return to Index


What are the colors in QBasic?

by (Login ComputerGhost)
R

I am working on some graphics in C++, and I have an enum of common colors. I think basing this off of QBasic's first 15 colors would be pretty handy.

I know that the colors are laid out in four bits: [brightness][red][green][blue]. However, I do not recall what the RGB (in 0xrrggbb) values for each of the colors are.

I did find one or two sources in google, but the codes just don't seem right. I remember them differently. Hopefully someone on here remembers right off how the colors are laid out.

Posted on Jun 19, 2012, 6:40 AM

Respond to this message   

Return to Index


This will get the current RGB settings to an array

by (Login burger2227)
R


SUB GetRGB (Array()) 'puts the RGB settings into an Array(0 to 47 or 767)
FOR c = 0 TO NumColors - 1 'SHARED value or 16 or 256
OUT &H3C7, c 'set attribute to read
Array(3 * c) = INP(&H3C9) 'get RGB color settings
Array((3 * c) + 1) = INP(&H3C9)
Array((3 * c) + 2) = INP(&H3C9)
NEXT c
END SUB

Posted on Jun 19, 2012, 6:55 AM

Respond to this message   

Return to Index


Thanks! I guess those sources were right. Well, here are the values:

by (Login ComputerGhost)
R

/**
 * @brief An enumeration of common colors
 */

enum
{
    BLACK = 0x000000, 
BLUE = 0x0000A8, 
GREEN = 0x00A800, 
CYAN = 0x00A8A8, 
RED = 0xA80000, 
MAGENTA = 0xA800A8, 
BROWN = 0xA85400, 
GRAY = 0xA8A8A8, 
DARK_GRAY = 0x545454, 
BRIGHT_BLUE = 0x5454FC, 
BRIGHT_GREEN = 0x54FC54, 
BRIGHT_CYAN = 0x54FCFC, 
BRIGHT_RED = 0xFC5454, 
BRIGHT_MAGENTA = 0xFC54FC, 
YELLOW = 0xFCFC54, 
WHITE = 0xFCFCFC
};

And it's great to see that the QBasic Forum is still as speedy as ever for responses!


P.S. Sorry for the messy code. My code to HTML converter doesn't seem to work on Network54, so we're stuck with ugliness. sad.gif



    
This message has been edited by ComputerGhost on Jun 19, 2012 7:14 AM

Posted on Jun 19, 2012, 7:13 AM

Respond to this message   

Return to Index


BTW, the leading byte is not for brightness

by (Login burger2227)
R

It is used for ALPHA transparencies. In QB64, _RGB and _RGB32 will return the color as fully opaque with an alpha value of 255 or &HFF000000.

_RGBA and _RGBA32 allow the alpha to be set with values from 0 for clear to 255 for opaque.

Posted on Jun 19, 2012, 8:38 AM

Respond to this message   

Return to Index


your numbers are slightly off...

by (Login MCalkins)
Moderator

http://en.wikipedia.org/wiki/Color_Graphics_Adapter#With_an_RGBI_monitor

Note that those colors differ from the normal Windows Console colors (which you can get from the "Properties" of a console window).

In Windows XP, QBASIC in full screen gives you the CGA colors, and in a window gives you the Windows colors. Note that color 6 changes between brown and yellow, based on whether it is full screen.

Here is QB64 code:

DIM i AS LONG
FOR i = 0 TO 15
COLOR i
PRINT HEX$(_PALETTECOLOR(i, 0))
NEXT
END

Regards,
Michael

Posted on Jul 14, 2012, 10:20 PM

Respond to this message   

Return to Index


Re: your numbers are slightly off...

by Vince (no login)

Is it possible to get rgb values of all the screen 13 default palette .colors. do you believe it is possible to relate the value of the screen 13 color default 1 to 256 TO ITS rgb values using elementary functions and boolean operators? Perhaps it is possible to make atleast a good approximation

Posted on Dec 10, 2012, 1:19 AM

Respond to this message   

Return to Index


For color intensity values 0 to 63 multiply by 4 for 0 to 255

by (Login burger2227)
R

Using the INP reads I showed you before. Then you can use them in _RGB(R, G, B) and _RGBA(R, G, B, A).

Colors from picture files can be read too by reading the screen after using _COPYPALETTE.

Posted on Dec 10, 2012, 10:32 AM

Respond to this message   

Return to Index

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